Your lack of error trapping would be why you have had difficulty finding the error.
You can check this by just changing this line:
Code: Select all
$file = fopen('users.txt', 'rb');
Code: Select all
if($file = fopen('users.txt', 'rb')){
}else{
echo "Your file failed to open and you should feel bad about that.";
}