Page 1 of 1
File contents & string aren't matching
Posted: Sat Nov 07, 2009 12:41 pm
by matt1234
Code: Select all
$1 = file_get_contents("/path/to/whatever.txt");
$2 = file_get_contents("/path/to/whatever2.txt");
$user = md5($_POST['1']);
$pwd = md5($_POST['2']);
if (($user == $1) AND ($pwd == $2)) { echo 'Logged in'; die(); }
else { echo 'Not logged in'; die(); }
These aren't equaling each other. I've echo printed all values and they look like the values should match.
And I'm pretty sure it wouldn't be including an EOL or EOF character at the end of $1 and $2, right?
Re: File contents & string aren't matching
Posted: Sat Nov 07, 2009 3:05 pm
by Eric!
Something must be different. Have you checked the string lengths?
Re: File contents & string aren't matching
Posted: Sat Nov 07, 2009 3:39 pm
by matt1234
trim() function worked. Must have been putting the end of file character into the string...
Re: File contents & string aren't matching
Posted: Sat Nov 07, 2009 5:12 pm
by Eric!
Some browsers append a CR or LN text string in the form variable. I think firefox does this.
Re: File contents & string aren't matching
Posted: Sat Nov 07, 2009 6:55 pm
by Eric!
Well, I don't remember the details (this was some time ago) but before I inserted a call to trim() had had several firefox users having login problems that I traced to their string submissions. I don't remember what firefox version they had or what character was being added...sorry. It is a standard input type=text, though.