The first file login_frm.php is the login window
code
Copy the code The code is as follows:
Copy code The code is as follows:
if($_POST['username'] = 'admin')
{
setcookie('haha','gogo');
header( "location:index.php");
}
?>
Copy the 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';
}
?>
The above introduces the operation of php cookie to realize code login, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.