Home > Backend Development > PHP Tutorial > PHP uses cookies to implement code for remembering usernames and passwords_PHP Tutorial

PHP uses cookies to implement code for remembering usernames and passwords_PHP Tutorial

WBOY
Release: 2016-07-13 09:55:58
Original
845 people have browsed it

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
Remember username and password
Username:
Password:
Remember username and password < ?php }else{($_COOKIE['remember'] == "")?>< ;/td>
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"; ?>

www.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...
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template