Question
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
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 a table in MySQL. You may not store the password in original text (use mysql MD5 https://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html#function_md5). (Links to an external site.)Links to an external site. If the username/password pair is correct , display a welcome message and save a cookie that identifies the user to the server if the "Remember me!" checkbox is checked. On further visits to the page, the user should appear logged in, even if the browser has been closed and restarted; If not, display the message Invalid username or password followed by the same login form. The output should be one of following 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 (the login form may contain the auto filled input user and password fields) .
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 (which contains the empty input user and password fields).
'Remember me' should last at least a week.
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