PHP uses cookies to implement the implementation code of remembering user names and passwords
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
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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 "返回";
?>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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";
?>
|
http://www.bkjia.com/PHPjc/990987.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/990987.htmlTechArticlephp uses cookies to remember user names and passwords. This article mainly introduces php to use cookies to remember users. Name and password implementation code, this article directly gives the implementation code, what is needed...