<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>免登录</title>
</head>
<body>
<?php
if(isset($_POST['dl'])){
$user =$_POST["us"];
$paw =$_POST['pw'];
$che =$_POST['che'];
setcookie('user',$user,time()+10*24*3600,"/");
setcookie('paw',$paw,time()+10*24*3600,"/");
setcookie('che',$che,time()+10*24*3600,"/");
header('location:5-22-01.php');
}
else if(@$_COOKIE['che']=="yes"){
header('location:5-22-01.php');
}
?>
<form method="post">
<input type="text" placeholder="用户名" name="us" value=""/><br/>
<input type="password" placeholder="密码" name="pw" value=""/><br/>
<input type="checkbox" name="che" value="yes" checked/>十天内免登录<br/>
<input type="submit" value="登陆" name="dl"/>
</form>
</body>
</html>
PHP之cookie免登录
最新推荐文章于 2024-01-14 17:34:47 发布