如果不做用户数据表的验证,而与配置文件中的密码做校验,那么上面的验证代码可修改为:
<?php
session_start();
require("./config.php");
if($_POST){
$username = $_POST['username'];
$password = $_POST['password'];
if($password == $gb_password)){
session_register("username");
// 重定向至留言管理界面
header("Location: http://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\'
)."/admin.php");
exit;
} else {
echo '密码错误!';
}
}
?>