Home >Backend Development >PHP Tutorial >PHP uses cookies to implement code for remembering usernames and passwords_PHP Tutorial
This article mainly introduces the implementation code of PHP using cookies to implement remembering user names and passwords. This article directly gives the implementation code. , friends in need can refer to it
?
|
check_remember.php <🎜>$name = $_POST['name'];<🎜> <🎜>$password = $_POST['password'];<🎜> <🎜>$remember = $_POST['remember'];<🎜> <🎜>if($remember == 1){<🎜> <🎜>setcookie('name',$name,time() 3600);<🎜> <🎜>setcookie('password',$password,time() 3600);<🎜> <🎜>setcookie('remember',$remember,time() 3600);<🎜> <🎜>}else{<🎜> <🎜>setcookie('name',$name,time()-3600);<🎜> <🎜>setcookie('password',$password,time()-3600);<🎜> <🎜>setcookie('remember',$remember,time()-3600);<🎜> <🎜>}<🎜> <🎜>echo "return"; ?> |