From the course: PHP Practice Challenges

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Write a login form

Write a login form

(playful music) - [Instructor] For the last challenge, we're going to build something that is very common across the web, and that's a login form. While building a real world login form requires lots of things not currently available to us like a database and an SSL certificate, we can still get some practical knowledge when it comes to hashing passwords and authenticating users. So for this challenge, the requirements are: To pass form information to a login function using the generated text file to authenticate against. I'll show you that in a minute. If a username and password pair match, set cookies for the username and for being logged in. If nothing matches, destroy all cookies and display the message "Username and/or Password Incorrect." The login form should maintain state. So you should be able to refresh or reload the page and if a user had successfully logged in, your page should remember and display the welcome message. A couple of important notes. There are lots of ways…

Contents