Jump to content

Recommended Posts

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 ? ??? ::)
[code]
<?
$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";
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/14299-one-time-webpage-help/
Share on other sites

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
Link to comment
https://forums.phpfreaks.com/topic/14299-one-time-webpage-help/#findComment-56315
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.