Lambel
asked on
php, html, js Need to build login to my website
I have an assignment to build a login page for my website with a userID and password input. It can't use a database to hold profiles. It must use a textfile.
I started building it with code from a lab assignment that takes customer inputs, stores them to an array, and then prints them back out onto the page.
Here is what I think I need to do:
1) I need to redirect the echo back to the page, and get it to write to the profile.dat file.
2) I need to have a textfile (profiles.dat) that stores two pieces of data for each record: userID and pswd.
3) Then I need to call up that profiles.dat, and pull all the records into an array.
4) Then loop through each record in the array until I find a userID that matches the input.
If I find a match, then
pull the array(1) field - pswd, and check if it matches the input pswd.
If it matches, then
Redirect to home page.
else
Stay at login page. Alert message: " pswd was not validated"
end
else
Stay at login page. Alert message: " pswd was not validated"
end
Can someone tell me if this sounds like the correct approach? Additional information would be appreciated as to what to avoid or best practices, etc.
Thanks, Lynn
I started building it with code from a lab assignment that takes customer inputs, stores them to an array, and then prints them back out onto the page.
Here is what I think I need to do:
1) I need to redirect the echo back to the page, and get it to write to the profile.dat file.
2) I need to have a textfile (profiles.dat) that stores two pieces of data for each record: userID and pswd.
3) Then I need to call up that profiles.dat, and pull all the records into an array.
4) Then loop through each record in the array until I find a userID that matches the input.
If I find a match, then
pull the array(1) field - pswd, and check if it matches the input pswd.
If it matches, then
Redirect to home page.
else
Stay at login page. Alert message: " pswd was not validated"
end
else
Stay at login page. Alert message: " pswd was not validated"
end
Can someone tell me if this sounds like the correct approach? Additional information would be appreciated as to what to avoid or best practices, etc.
Thanks, Lynn
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just out of curiosity, what would have made this an A answer?
ASKER