Question: Solving a PHP problem Write a PHP script that, when first loaded, presents a simple HTML login form with just a username prompt, like below:
Solving a PHP problem

Write a PHP script that, when first loaded, presents a simple HTML login form with just a username prompt, like below: 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 user you are logged in. 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
