We all have noticed the “Keep Me Logged In” checkbox in most of the websites we log in to. There are different ways and approaches to achieve this through code.
The best approach among those is saving the User information in the user browser as cookies. Basically, we have to store both the Username and the Password in the user’s browser as cookies. Then every time the page loads the session variable will be set. Hence the user can log in without having to enter the Username and Password again until the life of that cookie expires. The example code given below is the way how to remember password checkbox works through PHP.
Output By understanding the above code by reading the comments and explanation you must able to execute the PHP code on the server with storing the Username and Password as cookies in the user’s browser. So in this way remember password task can be achieved.
- How to display logged in user information in PHP ?
- If we delete cookies of a site, we can still logged in without logging again
- How to redirect a user to the registration if he has not logged in?
- How to display popup message when logged out user try to vote ?
- HTTP headers | Keep-Alive
- How to keep compiled files in a separate directory ?
- Underscore.js _.keep() Method
- Lodash _.keep() Method
- Best way to initialize empty array in PHP
- What are the best input sanitizing functions in PHP ?
- 6 Best CSS frameworks You should Know to design Attractive Websites
- What is the best way to include CSS file? Why use @import?
- Best way to make a d3.js visualization layout responsive
- What’s the best way to reload / refresh an iframe?
- Best Books to Learn Front-End Web Development
- Best Books to Learn Back-End Web Development
- Programming For Beginners: 10 Best HTML Coding Practices You Must Know
- 7 Best Sites For Free Web Hosting
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.