Home >Backend Development >PHP Tutorial >PHP cookie operation implementation code (login)_PHP tutorial

PHP cookie operation implementation code (login)_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-21 15:32:46742browse

The first file login_frm.php is the login window
Code

Copy the code The code is as follows:






User:





The second file login.php is to handle login
Copy the code The code is as follows:

if($_POST['username'] = 'admin')
{
setcookie('haha','gogo');
header("location:index.php ");
}
?>

Look at the effect of the third file index.php
Copy code The code is as follows:

if($_COOKIE['haha'] == 'gogogo')
{
echo $_COOKIE['haha'];
echo 'You have set a cookie';
}
else
{
echo 'You have not set a cookie';
}
?>

For more basic information, please refer to PHP Cookies

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322753.htmlTechArticleThe first file login_frm.php is the login window code. Copy the code as follows: html head meta http-equiv= "Content-Type" content="text/html;charset=utf8" / /head body form meth...
Statement:
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