Ok. that worked. Now the next problem is that when I enter the last user in... it let's me in. But if I enter the first one or any other user(besides the last) i get access denied. Here is my updated code:
...
<?php
$fd = fopen ("users.txt", "r");
while (!feof ($fd)) {
$userpass = fgets($fd, 4096);
list ($user,$pass) = split ('~', $userpass);
if ($user == $CNUser)
{
echo "YEAH!";
break; //this stops the loop after the user is found.
}
}
fclose ($fd);
//need to recheck user as well as password
//incase the loop exited without finding a user.
echo "$user $pass ... $CNUser $CNPass";
if ($pass == $CNPass) {
echo "Welcome back $user.";
}
else
{
echo "Access Denied.";
}
?>
...
Please help me. Thanks.