troubleshooting Question

php, html, js Need to build login to my website

Avatar of Lambel
Lambel asked on
Web DevelopmentWeb Servers
4 Comments2 Solutions482 ViewsLast Modified:
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.
            Stay at login page. Alert message: " pswd was not validated"
     Stay at login page. Alert message: " pswd was not validated"

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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros