① php网页如果需要查看信息必须输入密码,验证后才可显示出内容的代码如何实现啊
新建一个PHP文件如下:
<?php
header('Content-type:text/html;charset=utf-8');
$password = "1234"; // 这里是正确密码
$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 = "请输入密码查看,获取密码可联系我。";
}
}
if($isview){ ?>
密码成功显示的内容
<?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>测试</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="" method="post" style="margin:0px;">输入查看密码
<input type="password" name="pwd" /> <input type="submit" value="查看" />
</form>
<?php echo $p; ?>
</div>
</div>
</body>
</html>
<?php
} ?>
② 出现dede保存目录数据时失败,请检查你的输入资料是否存在问题!后执行了9个SQL语句但是之成功了6个 如下:
INSERT INTO `dede_sysconfig` (`aid`, `varname`, `info`, `groupid`, `type`, `value`) VALUES (746, 'cfg_album_mark', '图集是否使用水印(小图也会受影响)', 3, 'bool', 'N')
这句错误在于该表设置了主键,该字段不允许插入重复的值
ALTER TABLE `dede_arctype` ADD `seotitle` VARCHAR( 80 ) NOT NULL DEFAULT ''
表中已存在列名 seotitle ,故加列失败
ALTER TABLE `dede_tagindex` ADD `typeid` SMALLINT( 5 ) UNSIGNED DEFAULT '0' NOT NULL
表中已存在列名 typeid,故加列失败
③ PHP网页如果需要查看信息必须输入密码,验证后才可显示出内容的代码如何实现
相关代码如下:
④ php session存在哪个文件夹
session不存文件夹 session是一个网页的缓存 你只要清一下网页的缓存就会没有 所以session是没有文件夹的
⑤ 打开网站后出现这样Parse error: syntax error,
这个意思是
在function.php的第746行
你有一个字符【/】的格式错误,或者不该出现这个字符
你可以检查一下那个php是怎么回事,你最近做过什么修改
希望能帮助到你
⑥ 偷星九月天266回
偷星九月天266 267回https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg https://gss0..com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/.jpg
⑦ 求php解密高手,这个php加密的谁能解密
php7.2.3安装
⑧ php代码中加一个判断
<?php
header("Location: http://你的链接");
}else{?>
这样输正确会直接跳转到你的链接,如果你要先显示“恭喜你,密码正确”后再跳转,就在这句话前面加一个延迟:header("Refresh:3;你的链接");
修改后完整代码:
<?php //输入密码后访问本页内容
$password = "3210";//这里是密码
$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"])) ? "需要密码才能查看,请输入密码。" : "<div style=\"color:#F00;\">密码不正确,请重新输入。</div>";}
}else{$isview = false;$p = "请输入密码查看,获取密码可联系我。";}}?>
<?php if($isview){?>
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>提醒你输入密码</title>
<style type="text/css">body{background:none;}.passport{width:400px;position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-55px;font-size:18px;text-align:center;line-height:30px;color:red;}</style>
</head><body>
<div class="passport">恭喜你!密码输入正确</div>
</body></html>
<?php
header("Refresh:3;http://www..com");
}else{?>
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>提醒你输入密码</title>
<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>
</head><body>
<div class="passport"><div style="padding-top:20px;">
<form action="" method="post" style="margin:0px;">输入查看密码
<input type="password" name="pwd" /> <input type="submit" value="查看" />
</form>
<?php echo $p;?>
</div></div>
</body></html>
<?php }?>