thank you.
I adjusted your code you forgot to add the line delimiter in two lines of code
it was not functioning properly but it works now.
PHP Code:
<?php
//get their ip address
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "0.0.0.0";
//read the log file and check it against their ip and redirect if they match then exit script.
$file = fopen("ips.txt", "r");
if($file){
while (!feof($file)) {
$line = fgets($file);
if ($line == $ip."\n"){
//echo "you have visited $ip";
header( 'Location: http://www.yoursite.com/new_page.html' ) ;
exit;
}
}
}
fclose($file);
//if there is no match, add their ip to the list
$file = "ips.txt"; //Select file
$file = fopen($file, "a+"); //Appened file
fwrite($file, $ip."\n"); //Write ip to file
fclose($file); //Close the file
//then show a picture
//echo "you are the first time to visited";
$imagepath="test.jpg";
$image=imagecreatefromjpeg($imagepath);
header('Content-Type: image/jpeg');
imagejpeg($image);
?>
thanks again!