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 redirect a user to the registration if he has not logged in?
- 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 display popup message when logged out user try to vote ?
- T-Test Approach in R Programming
- Modular Approach in Programming
- Random Forest Approach for Regression in R Programming
- View Recycling in Android with ListView
- HTML DOM Range insertNode() Method
- HTML DOM Range setEnd() Method
- 8 Useful Testing Tools, Libraries and Frameworks For React Developers
- GRE | List of words to enhance your vocabulary with root alphabet ‘G’
- ISCII Encoding
- How to merge arrays and preserve the keys in PHP ?
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.