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.
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.
In PHP, set a cookie with the session information (username, password) by copying the appropriate values from $_SESSION
into $_COOKIE
using set_cookie
. When the user visits a page, check first for the existence of $_SESSION
variables, then for $_COOKIE
variables. If the $_COOKIE
variables exist but the $_SESSION
ones don't, copy from $_COOKIE
into $_SESSION
. (That is, if the user checks the box.)