一個(gè)簡(jiǎn)單的網(wǎng)頁(yè)密碼登陸php代碼
更新時(shí)間:2012年07月17日 10:33:10 作者:
密碼對(duì),就可以看到指定內(nèi)容, 密碼不對(duì)就進(jìn)不去
復(fù)制代碼 代碼如下:
<?php
$password = "1234"; // 這里是密碼
$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"])) ? "需要密碼才能查看,請(qǐng)輸入密碼。" : "密碼不正確,請(qǐng)重新輸入。";
}
}else{
$isview = false;
$p = "請(qǐng)輸入密碼查看,獲取密碼可聯(lián)系我。";
}
}
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="?yes" method="post" style="margin:0px;">輸入查看密碼
<input type="password" name="pwd" /> <input type="submit" value="查看" />
</form>
<?php echo $p; ?>
</div>
</div>
<?php
} ?>
</body>
</html>
您可能感興趣的文章:
- 詳解PHP處理密碼的幾種方式
- php登陸頁(yè)的密碼處理方式分享
- php+mysql實(shí)現(xiàn)簡(jiǎn)單登錄注冊(cè)修改密碼網(wǎng)頁(yè)
- php+MySQL實(shí)現(xiàn)登錄時(shí)驗(yàn)證登錄名和密碼是否正確
- php password密碼驗(yàn)證正則表達(dá)式(8位長(zhǎng)度限制)
- 允許phpmyadmin空密碼登錄的配置方法
- php中實(shí)現(xiàn)記住密碼下次自動(dòng)登錄的例子
- 理解php Hash函數(shù),增強(qiáng)密碼安全
- php中實(shí)現(xiàn)記住密碼自動(dòng)登錄的代碼
- PHP中常見的密碼處理方式和建議總結(jié)
相關(guān)文章
Laravel框架實(shí)現(xiàn)定時(shí)Task Scheduling例子
今天小編就為大家分享一篇Laravel框架實(shí)現(xiàn)定時(shí)Task Scheduling例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-10-10PHP抓取、分析國(guó)內(nèi)視頻網(wǎng)站的視頻信息工具類
VideoUrlParser是一款基于PHP根據(jù)視頻URL抓取視頻信息的工具,支持優(yōu)酷、土豆、酷六、56、樂(lè)視、搜狐、騰訊、新浪。2014-04-04Joomla數(shù)據(jù)庫(kù)操作之JFactory::getDBO用法
這篇文章主要介紹了Joomla數(shù)據(jù)庫(kù)操作之JFactory::getDBO用法,實(shí)例分析了Joomla靜態(tài)類JFactory使用getDBO取得數(shù)據(jù)庫(kù)對(duì)象的相關(guān)操作技巧,需要的朋友可以參考下2016-05-05php 判斷過(guò)去離現(xiàn)在幾年的函數(shù)(實(shí)例代碼)
下面小編就為大家?guī)?lái)一篇php 判斷過(guò)去離現(xiàn)在幾年的函數(shù)(實(shí)例代碼)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-11-11PHP獲取input輸入框中的值去數(shù)據(jù)庫(kù)比較顯示出來(lái)
這篇文章主要介紹了PHP獲取input輸入框中的值去數(shù)據(jù)庫(kù)比較顯示出來(lái)的相關(guān)資料,前端還算比較簡(jiǎn)單,php后臺(tái)接受并查詢,本文給大家介紹的非常詳細(xì),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-11-11