I have tried and tried to get this to work. Essentially I want to read a line of a text file and compare it to the user input. If they are the same then it will continue the log in process.
For now I am just using an echo to see if it actually finds something. it seems that the if statement doesn't see the two inputs as a match even when they are.
$myFile = fopen("users.txt", "r");
$username = $_POST['username'];
while(!feof($myFile))
{
$userN = fgets($myFile);
//compares entered user to text file users
if (($username === $userN)){
echo 'found';
}
}
The only time that it ever finds a match is if the input is left blank as it will be matched with the final line of the file.