帝国CMS PHP 输入正确密码 查看隐藏内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <?php $password = "123456" ; // 这里是密码 $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 { ?> <div style= "text-align:center; font-size:13px; padding-top:50px; line-height:25px;" > <form action= "ShowInfo.php?classid=[!--classid--]&id=[!--id--]" method= "post" style= "margin:0px;" >输入密码:<input type= "password" name= "pwd" /> <input type= "submit" value= "查看" /> <font color= "#FF0000" ><?php echo $p ; ?>
<?php } ?> |
此文由 at-lib网站目录 编辑,未经允许不得转载!: