再次分享一篇输入密码才可以浏览网页的php代码,密码功能代码都差不多,这款的UI好看点。
给网页加个漂亮的密码访问功能[php代码]
直接复制粘贴到需要加密的页面,就可以给网站开启了密码保护,让页面输入密码才能访问!
修改也非常简单,直接替换4行密码,替换48行要跳转的链接即可。
PHP代码示例
<?php
header(‘Content-type:text/html;charset=utf-8’);
$password = “11px”; // 这里是正确密码
$p = “”;
if(isset($_COOKIE[“isview”]) && $_COOKIE[“isview”] == $password){
$isview = true;
}else{
if(isset($_POST[“pwd”])){
if($_POST[“pwd”] == $password){
setcookie(“isview”,$_POST[“pwd”],time()+3600*0.2);
$isview = true;
}else{
$p = (empty($_POST[“pwd”])) ? “需要密码才能查看,请输入密码。” : “密码不正确,请重新输入。”;
}
}else{
$isview = false;
$p = “源码来源www.hu6.cc”;
}
}
if($isview){ ?>
<!– (^ω^)=☞源码下载:bbs.lxh5068.com 页头结束–>
<!– (^ω^)=☞源码下载:bbs.lxh5068.com 加密开始–>
<!DOCTYPE html>
<html><head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<meta charset=”utf-8″>
<title>演示</title>
<p>演示</p>
</body>
</html>
<!– (^ω^)=☞源码下载:bbs.lxh5068.com 加密结束–>
<!– (^ω^)=☞源码下载:bbs.lxh5068.com 页尾开始–>
<?php }else{ ?>
<!DOCTYPE html>
<html><head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<meta charset=”utf-8″>
<title>本站开启了验证码保护</title>
<meta name=”keywords” content=”PHP加密”>
<meta name=”description” content=”PHP加密”>
<style type=”text/css”>
html{background-color:#FFF}body,button,input{font:14px/20px “Microsoft Yahei”,”Helvetica Neue”,Helvetica,Arial,sans-serif}body{color:#585858;letter-spacing:1px}i{font-style:normal}p{margin:0}a{color:#007aff;text-decoration:none}a:hover{color:#0065ea;text-decoration:underline}button,i,img,input{vertical-align:middle}.tc{text-align:center}.auto{margin:0 auto}.mb20{margin-bottom:20px}.fl{float:left;display:inline}.oh{overflow:hidden}.fr{float:right}.i1{display:inline-block;margin-right:10px;width:80px;height:80px;border:1px solid #007aff;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}.i1 img{margin-top:18px}.i2,.i2 span{position:absolute}.i2{left:123px;margin-top:-1px;bottom:-.5em;color:#dcdcdc;font:20px/1em Arial,Helvetica,sans-serif}.i2 span{color:#FFF;left:0;top:2px}.hd{font-weight:400;padding:20px 0;width:568px;margin-top:10%;border-bottom:1px solid #dcdcdc;position:relative}.bd{width:370px}.int1{border:1px solid #DDD;line-height:20px;padding:5px 10px;width:8em}.int1:focus{border-color:#007aff}.btn1{cursor:pointer;display:block;width:100%;line-height:20px;padding:5px 0;background-color:#007aff;color:#FFF;border:none 0}.btn1:hover{background-color:#0065ea}.p2_s1 img{margin:0 20px}.p2_s2{padding-top:5px}.p3{font-size:12px;color:#737373;margin-top:30px}</style>
</head>
<body>
<h1 class=”hd auto tc mb20″><i class=”i1″><img src=”https://pic1.zhimg.com/80/v2-dfeb5bdc6c835bb98eef84d99a293cdf_720w.jpg” width=”39″ height=”48″ src=”22″></i>本站开启了密码保护<i class=”i2″>◆<span>◆</span></i></h1>
<form id=”captcha_form” class=”bd auto” action=”http://bbs.lxh5068.com/10169.html” method=”post”>
<p class=”mb20″><?php echo $p; ?></p>
<p class=”mb20 oh”>
<span class=”fl p2_s1″>
<input type=”password” name=”pwd” placeholder=”请输入密码” class=”int1″ autocomplete=”off”>
</span></p>
<input type=”submit” value=”提交” class=”btn1″></input>
</form>
</body></html>
<?php
} ?>