How would I properly write a script to set cookies to remember a user’s username and password upon checking a checkbox on the login form?
Also, if this could be done in PHP please let me know.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In PHP, set a cookie with the session information (username, password) by copying the appropriate values from
$_SESSIONinto$_COOKIEusingset_cookie. When the user visits a page, check first for the existence of$_SESSIONvariables, then for$_COOKIEvariables. If the$_COOKIEvariables exist but the$_SESSIONones don’t, copy from$_COOKIEinto$_SESSION. (That is, if the user checks the box.)