Remember the user name on the webpage, which is frequently used. There is a check box below for Logon. You can set that users do not need to log on within 7 days or 1 month, if there is a difference between the user name and password in the cookie query on the website system, extract the information and then query it in the database, if the user name and password in the cookie are the same, the user can log on automatically. Remember the user name on the webpage, which is frequently used. There is a check box below for Logon. You can set that users do not need to log on within 7 days or 1 month, if there is a difference between the user name and password in the cookie query on the website system, extract the information and then query it in the database, if the user name and password in the cookie are the same, the user can log on automatically.
Script ec (2); script
Error_reporting (0 );
Session_start ();
?>
The Code is as follows: |
|
The user name and password can be remembered during webpage Logon (automatic logon is completed)
$ Uid = $ _ cookie ['uid']; $ Pwd = $ _ cookie ['uid']; If ($ uid! = ''& $ Pwd! = '') { // SQL database query Verification $ _ Session ['uid'] = 'abc '; } If ($ _ session ['uid']) { Echo 'Member center, post an article, go to http://www.111cn.net to play '; } Else { ?>
|
The Code is as follows: |
|
} ?>
|
The Code is as follows: |
|
If ($ _ post) { $ Info = $ _ post; If ($ info ['uid']! = ''& $ Info ['pwd']! = '') { // SQL query operation. Verify the user name and password in the database. If (intval ($ info ['checkbox']) { Setcookie ('uid', $ info ['uid'], time () + 3600*24*7, '/', '192. 168.0.118 '); Setcookie ('pwd', $ info ['pwd'], time () + 3600*24*7, '/', '192. 168.0.118 '); } $ _ Session ['uid'] = $ info ['uid']; } } |
// Original article on this site is reprinted with the original article from http://www.111cn.net/php tutorial er/php.html