- Messages
- 2
- Reaction score
- 0
- Points
- 0
I'm doing an assignment for school and we have to use a PHP script to check the user name and password when they try logging in.
So I have file users.txt sitting on the server and all it contains is a list of user, 1 per line. It has the users first name, space, last name, space, and then email. Like this:
userFirst userLast name@domain.com
So for I've been able to get to this, but being new to PHP I am a bit stumped and unsure how to proceed...
$fName=$_GET['txtFirstName'];
$lName=$_GET['txtLastName'];
$email=$_GET['txtEmail'];
$lines=file("users.txt");
foreach($lines as $line_num => $line){
if ()
//no matter what i try in here, I get stuck
}
All I need to check if the 3 fields entered by the user match any one of the lines in user.txt. Users can enter lower or upper case letter for names and email but not the password, but for that part I just plan on having two compare statements for each name.
Any help with how to make the foor loop work would be greatly appreciated!
So I have file users.txt sitting on the server and all it contains is a list of user, 1 per line. It has the users first name, space, last name, space, and then email. Like this:
userFirst userLast name@domain.com
So for I've been able to get to this, but being new to PHP I am a bit stumped and unsure how to proceed...
$fName=$_GET['txtFirstName'];
$lName=$_GET['txtLastName'];
$email=$_GET['txtEmail'];
$lines=file("users.txt");
foreach($lines as $line_num => $line){
if ()
//no matter what i try in here, I get stuck
}
All I need to check if the 3 fields entered by the user match any one of the lines in user.txt. Users can enter lower or upper case letter for names and email but not the password, but for that part I just plan on having two compare statements for each name.
Any help with how to make the foor loop work would be greatly appreciated!