为了给PHP的小网页做一些简答的加密,所以用上了这个代码
上代码
*
* 然后把本页代码命名为password.php即可.
*
* PS:需要退出登录就直接在页面的后面加入请求password.php?action=logout
*/
$page_pwd = md5('小小酥'); //你要设置的密码
$page_cookname = 'my-page-password'; //你要设置的cookie名
$page_now = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
$action = @$_GET['action'];
$page_postpwd = @$_POST['page_pwd'];
$page_cookiepwd = @$_COOKIE["$page_cookname"];
$page_cookietime = time() + 60 * 60 * 24 * 7;
//输出网页的头部
$head = '
product
';
//退出登录
if ($action == "logout") {
setcookie($page_cookname, "", time() - 1);
echo '
退出成功,2秒后自动跳转
点此马上跳转