Jump to content


Photo

IP Ban and redirect an exact ip


  • Please log in to reply
1 reply to this topic

#1 karthikeyan_coder

karthikeyan_coder
  • Members
  • PipPipPip
  • Advanced Member
  • 201 posts

Posted 14 September 2006 - 08:25 PM

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

 $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");
}

tell me your suggestions and ideas...
www.karthi.us

#2 karthikeyan_coder

karthikeyan_coder
  • Members
  • PipPipPip
  • Advanced Member
  • 201 posts

Posted 14 September 2006 - 08:32 PM

that code writes "Kicked" in txt file.. but it is not redirecting the user... do i need to replace header() with die() ?



www.karthi.us




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users