Jump to content



Recommended Posts

this script is supposed to only register a user if he has not been on my website, but this script keep on adding the IP of a person all the time


$filref = fopen("tekst.txt", "a");$ip = $_SERVER['SERVER_ADDR'];$les_fil = fread($filref, filesize("tekst.txt"));if(!strchr($les_fil, $ip) ){ fwrite($filref, $ip);}else{ echo "cannot register more";}

Link to comment
Share on other sites

when using a, it sets the pointer to the end of the file.



so fread is always checking at the end of the file.


you might want to review the answers here


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...