when i use a predefined variable within the php code, but i dont want to do it that way.
I have a text file hidden on my web server and i want the php code to test to see if the password the user
entered is the same as the one stored in the text file.
It does not match when i enter the correct password, and when i was trying to debug it i found
that if i do a strlen on the text file it is adding 1 to the answer, ie i was expecting 7 and i get 8.
Code: Select all
$password=file_get_contents("password.txt");
print strlen($password);i know i could use substr and extract the 1st 7 char's but this seems a bit OTT.
I am assuming it is counting a (/n) newline char.
Can anyone tell me a simple way of getting the correct answer from strlen.
Thanks