Jump to content


Photo

One time webpage ? help


  • Please log in to reply
2 replies to this topic

#1 herbat8

herbat8
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 11 July 2006 - 02:49 PM

What i want is a webpage that only can be viewed once per ip.. This script doesnt work for me can someone please fix it or help me rewrite this ? ??? ::)
<?
$key = $_SERVER['REMOTE_ADDR'];
//load file into $fc array
$fc=file("some.txt");
//open same file and use "w" to clear file
$f=fopen("some.txt","w");
//loop through array using foreach
foreach($fc as $line)
{
     if (!strstr($line,$key)) //look for $key in each line
           fputs($f,$line); //place $line back in file
           header("Location:http://www.google.com");
}
fclose($f);


$text = "\n$key";
$file = fopen('some.txt', 'a');
fwrite($file,$text);
fclose($file);
echo "Hello World";
?>


#2 micah1701

micah1701
  • Members
  • PipPipPip
  • Advanced Member
  • 613 posts
  • LocationEllington, CT USA

Posted 11 July 2006 - 03:02 PM

just an FYI, many web users using a proxy connection and all AOL users have ip addresses that change, often everytime they load a new page.
"Confidence in the face of risk."

#3 herbat8

herbat8
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 11 July 2006 - 05:06 PM

Thank you for your response m8.
But my problem is with the script not the user ex. When i vists it for the first time with my ip it will print out Hello World but later when i try reaching the page from another ip it give's me google instead of Hello world :( that is what needs to be fixed if you can see the problem please tell me how to modify it


Best regards




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users