教你如何加密一个php页面,给PHP页面加密码才能访问!引流必备!
将下面代码添加页头
<!-- (^ω^)=☞源码下载:bbs.8gws.com 页头开始-->
<?php
header('Content-type:text/html;charset=utf-8');
$password = "zygx"; // 这里是正确密码
$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"])) ? "需要密码才能查看,请输入密码。(扫码回复:2468)" : "密码不正确,请重新输入。(扫码回复:2468)";
}
}else{
$isview = false;
$p = "如果你对本页反感,请立即关闭!谢谢!</br>关注微信公众号:小辉网络(SSN5068)回复:2468 即可获取密码!";
}
}
if($isview){ ?>
<!-- (^ω^)=☞源码下载:bbs.8gws.com 页头结束-->
将下面代码添加最后
<!-- (^ω^)=☞源码下载:bbs.8gws.com 页尾开始-->
<?php }else{ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<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>Q绑查询</title>
<meta name="keywords" content="PHP加密">
<meta name="description" content="PHP加密">
<!--[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:150px;
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;
}
.post-content-post {
border: 1px dashed #F60;
padding: 10px;
margin: 10px 0;
line-height: 200%;
color: #F00;
background-color: #FFF4FF;
overflow: hidden;
clear: both;
}
</style>
<div class="post-content-post">
<div class="huoduan_hide_box" style="border:10px dashed #F60; padding:10px; margin:10px 0; line-height:200%; color:#F00; background-color:#FFF4FF; overflow:hidden; clear:both;">
<p><img loading="lazy" data-original="https://cdn.jsdelivr.net/gh/993124/pay@master/img/ewm.jpg" width="300" height="300" class="alignnone size-medium img-lazyload" /></p>
输入查看密码<form action="" method="post" style="margin:0px;">
<input type="password" name="pwd" style="border:none;float:left;width:100px; height:32px; line-height:30px; padding:0 5px; border:1px solid #FF6600;-moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius:0px;"/> <input type="submit" value="查看" style="border:none;float:left;width:80px; height:32px; line-height:32px; padding:0 5px; background-color:#F60; text-align:center; border:none; cursor:pointer; color:#FFF;-moz-border-radius: 0px; font-size:14px; -webkit-border-radius: 0px; border-radius:0px;"/>
</form></br></br>
<?php echo $p; ?>
</div>
</div>
</body>
</html>
<?php
} ?>
<!-- (^ω^)=☞源码下载:bbs.8gws.com 页尾结束-->
我们有时候建一个页面不想让别人看到,或者必须得经过你的允许才能看到!那么就可以用到以上的php代码