Question
PHP and HTMl class Write the login form Write a PHP file that will output a form containing 3 fields: username, password and Remember me!
PHP and HTMl class
Write the login form
Write a PHP file that will output a form containing 3 fields: username, password and Remember me! checkbox. Upon submission of the form, the code should check against MySQL table to see whether the username/password pair was correct. If so, display a welcome message and save a cookie that identifies the user to the server. On further visits to the page, the user should appear logged in, even if the browser has been closed; If not, display the message Invalid username or password followed by the same login form. Once again,there should only be one PHP file, and you should redirect to the same place after submitting. The output should be one of three options:
The login form.
The invalid message and the login form, if failed login.
The welcome message containing a Log Out button, if successful login.
When user clicks Log out button, remove the cookie so that the user is logged out. Clicking the button should redirect the user to the same page, which now shows a login form.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started