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 ' an array' that contains the information. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!