Home  >  Article  >  Backend Development  >  一个简单的网页密码登陆php代码_php实例

一个简单的网页密码登陆php代码_php实例

WBOY
WBOYOriginal
2016-05-17 09:10:031282browse
复制代码 代码如下:

$password = "1234"; // 这里是密码
$p = "";
if(isset($_COOKIE["isview"]) and $_COOKIE["isview"] == $password){
$isview = true;
}else{
if(isset($_POST["pwd"])){
if($_POST["pwd"] == $password){
setcookie("isview",$_POST["pwd"],time()+3600*3);
$isview = true;
}else{
$p = (empty($_POST["pwd"])) ? "需要密码才能查看,请输入密码。" : "密码不正确,请重新输入。";
}
}else{
$isview = false;
$p = "请输入密码查看,获取密码可联系我。";
}
}
if($isview){ ?>
这里是密码成功后显示的地方








脚本之家提醒你输入密码




输入查看密码





} ?>


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