Copy Code code as follows:
<?php
$password = "1234"; This is the code.
$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"])? "Requires a password to view, please enter a password." ":" The password is incorrect, please re-enter it. ";
}
}else{
$isview = false;
$p = "Please enter the password to view, get the password to contact me." ";
}
}
if ($isview) {?>
This is where the password was displayed after it was successful.
<?php}else{?>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<meta http-equiv= "Pragma" content= "No-cache"/>
<meta http-equiv= "Cache-control" content= "No-cache"/>
<meta http-equiv= "Expires" content= "0"/>
<title> Cloud Communities remind you to enter your password </title>
<!--[If Lt IE 6]>
<style type= "Text/css" >
. z3_ie_fix{
Float:left;
}
</style>
<! [endif]-->
<style type= "Text/css" >
<!--
body{
Background:none;
}
. passport{
border:1px solid red;
Background-color: #FFFFCC;
width:400px;
height:100px;
Position:absolute;
left:49.9%;
top:49.9%;
margin-left:-200px;
margin-top:-55px;
font-size:14px;
Text-align:center;
line-height:30px;
Color: #746A6A;
}
-->
</style>
<div class= "Passport" >
<div style= "padding-top:20px;" >
<form action= "yes" method= "post" style= "margin:0px;" > enter View password
<input type= "password" name= "pwd"/> <input type= "Submit" value= "View"/>
</form>
<?php echo $p;?>
</div>
</div>
<?php
}?>
</body>