problem reading from a file
Posted: Tue Oct 27, 2009 12:34 am
Hello,
I have a text file where i store the lines as
user|password|question|answer
I'm a beginner, now i just wanna work with files, so i wanna make a login system which stores the user, pass, secret question and answer, in a file, not in a database.
i have the code
When i try to enter the username and pass, it works just regarding to 1st line of the file, the user and pass from other lines does not work.. Why?
How can i check line by line if a user has entered the correct pass?
Thanks!
I have a text file where i store the lines as
user|password|question|answer
I'm a beginner, now i just wanna work with files, so i wanna make a login system which stores the user, pass, secret question and answer, in a file, not in a database.
i have the code
Code: Select all
$fp=fopen($root."\user\users.txt","r");
while(!feof($fp)){
$contents=fread($fp,filesize($root."\user\users.txt"));
fclose($fp);
$info=explode("|",$contents);
$username1=$info[0];
$password1=$info[1];
}
How can i check line by line if a user has entered the correct pass?
Thanks!