Jump to content

Archived

This topic is now archived and is closed to further replies.

karthikeyan_coder

IP Ban and redirect an exact ip

Recommended Posts

i want to redirect an exact ip.... i want to redirect him to some other sites.. i used this code... tell me whats wrong...

[code]
$ipadd = $_SERVER['REMOTE_ADDR'];
if($ipadd == "209.61.157.78") // This ip was banned in dnsstuff too...
{
$filename = 'textfile';
if (is_writable($filename)) {
  if (!$handle = fopen($filename, 'a')) {
      //  echo "Cannot open file ($filename)";
        exit;
  }

  // Write somecontent to our opened file.
  if (fwrite($handle, "Kicked") === FALSE) {
      // echo "Cannot write to file ($filename)";
      exit;
  }
 
////  echo "Success, wrote ($somecontent) to file ($filename)";
 
  fclose($handle);

} else {
  //echo "The file $filename is not writable";
}
header("Location: http://google.com");
}[/code]

tell me your suggestions and ideas...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.