给PHP网页加密码访问
<?php session_start(); if (isset( $_POST [ 'password' ]) && $_POST [ 'password' ] == 'admin' ){ $_SESSION [ 'ok' ] = 1; header( 'location:?' ); } if (!isset( $_SESSION [ 'ok' ])){ exit (' <form method= "post" > 密码:答<input type= "password" name= "password" /> <input type= "submit" value= "登陆" /> </form> '); } ?> |
1
2
3
4
5
6
7
8
|
<html> <head> <title>title</title> </head> <body> 输入密码才能访问这个页面 </body> </html> |
近期评论