PHP uses cookies for automatic login. Code highlighting produced by Actipro CodeHighlighter (freeware)
Http://www.CodeHighlighter.com/
--> 1 2 // automatic login
3 if ($ _ COOKIE ["userName"] & $ _ COOKIE ["password"])
4 {
5 // Obtain the login information and pass it into the database for verification
6
7 // Print logon information
8 echo 'user name: '. $ _ COOKIE ["userName"].'
Password: '. $ _ COOKIE ["password"];
9}
10
11
12
13 // submit the form
14 if ($ _ GET ['submit '])
15 {
16 // echo 'login .. ';
17 // select "remember password" to write user login information to the cookie.
18 if ($ _ GET ['member'] = 'on ')
19 {
20 setcookie ("userName", $ _ GET ["userName"], time () + 3600 );
21. setcookie ("password", $ _ GET ["pass"], time () + 3600 );
22}
23
24 // refresh the page
25 echo' Location. href = "cookie. php" script ';
26}
27
28 // log out
29 if ($ _ GET ['out'])
30 {
31 // Set cookie timeout
32 setcookie ("userName", $ _ GET ["userName"], time ()-3600 );
33 setcookie ("password", $ _ GET ["pass"], time ()-3600 );
34
35 // refresh the page
36 echo' Location. href = "cookie. php" script ';
37}
38?>
39
40
41
42
43 Input information
44User name
45Password
46 Remember password
47
48 Log out
49