I'm a semi-newbie; I've been into PHP for about 4 months and I already know quite a few things.
I'm trying to write a simple script involving user authentication against a flatfile database (yes, I know how much better MySQL is, and I still want to use a flatfile.)
In the code, I have a crucial line:
if (($userinfo[0] == $name) && ($userinfo[1] == $pass))
{
echo "Authorized.<br>";
die;
}
This is supposed to check if two variables in an array are identical to two variables predetermined in a form, but it doesn't. The script automatically assumes that the two aren't identical. I know that I'm passing the variables properly, because I've tried printing them out in the same script.
The weird thing is, if I just use
if ($userinfo[0] == $name)
{
echo "Authorized.<br>";
die;
}
to check the $name variable, the code works perfectly. Is it a syntax problem? Is there something wrong with the $pass variable? Your help would be greatly appreciated.