Home >Backend Development >PHP Tutorial >A simple web password login php code_PHP tutorial

A simple web password login php code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:17:411117browse

Copy code The code is as follows:

$password = "1234"; // Here is the password
$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"])) ? "A password is required to view, Please enter the password. " : "The password is incorrect, please re-enter ";
}
}else{
$isview = false;
$p = "Please enter the password to view it. You can get the password. Contact me. ";
}
}
if($isview){ ?>
This is where the password will be displayed after the password is successful








Script House reminds you to enter your password









} ?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325631.htmlTechArticleCopy the code code as follows: ?php $password = "1234"; // Here is the password $p = "" ; if(isset($_COOKIE["isview"]) and $_COOKIE["isview"] == $password){ $isview = true; }else{ if(isset($...
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