- 最後登錄
- 2021-7-21
- 在線時間
- 2 小時
- 註冊時間
- 2009-11-7
- 閱讀權限
- 20
- 精華
- 0
- UID
- 7216774
- 帖子
- 291
- 積分
- 0 點
- 潛水值
- 9040 米
| 成為伊莉的版主,你將獲得更高級和無限的權限。把你感興趣的版面一步步地發展和豐盛,那種滿足感等著你來嚐嚐喔。 很簡單的 不用資料庫的做法- <?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"])) ? "需要密碼才能查看,請輸入密碼。" : "密碼不正確,請重新輸入。";
- }
- }else{
- $isview = false;
- $p = "請輸入密碼查看,獲取密碼可聯系我。";
- }
- }
- if($isview){ ?>
- 這裡是密碼成功後顯示的地方
- <?php }else{ ?>
-
-
- <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>
-
- <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>
複製代碼 ... |
|