Question: please help with this php question 4 Question 4: Sessions (4 marks) Write a PHP script that, when first loaded, presents a simple HTML login
Question 4: Sessions (4 marks) Write a PHP script that, when first loaded, presents a simple HTML login form with just a username prompt, like below: Username: Submit When the user enters a username, create a new PHP session and store the username in it. Ensure to sanitise the username input to remove any tags and special characters in it! Once logged in, your script should show the user a page like this. Hello sc785, you are logged in. Logout The user's session should remain active and the above "logged in page should be shown even if the user refreshes the page or resubmits the form, or closes and reopens the webpage. When the user clicks the "Logout" button, their active session should be destroyed and they should be redirected to the original login form, allowing them to login again
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
