请帮忙!
当我尝试登录时出现以下错误:
访问被禁止!
您无权访问请求的对象。它是读取保护的或服务器不可读的。
如果您认为这是服务器错误,请与网站站长联系。
错误403
本地主机
Apache / 2.4.3(Win32)OpenSSL / 1.0.1c PHP / 5.4.7
我的login.php代码如下:
session_start();
require("config.php");
require("functions.php");
$db = mysql_connect($localhost, $dbuser, $dbpassword);
mysql_select_db($dbdatabase, $db);
if(isset($_POST['submit'])) {
$sql = "SELECT * FROM users WHERE username = '" . $_POST['username'] . "' AND password = '" . $_POST['password'] . "';";
$result = mysql_query($sql);
$numrows = mysql_num_rows($result);
if($numrows == 1) {
$row = mysql_fetch_assoc($result);
if($row['active'] == 1) {
session_register("USERNAME");
session_register("USERID");
$_SESSION['USERNAME'] = $row['username'];
$_SESSION['USERID'] = $row['id'];
switch($_GET['ref']) {
case "addbid":
header("Location: " . $config_basedir
. "/itemdetails.php?id=" . $_GET['id'] . "#bidbox");
break;
case "newitem":
header("Location: " . $config_basedir . "/newitem.php");
break;
case "images":
header("Location: " . $config_basedir
. "/addimages.php?id=" . $_GET['id']);
break;
default:
header("Location: " . $config_basedir);
break;
}
}
else {
require("header.php");
echo "This account is not verified yet. You were
emailed a link to verify the account. Please click on the
link in the email to continue.";
}
}
else {
header("Location: " . $config_basedir . "/login.php?error=1");
}
}
else {
require("header.php");
echo "
Login
";if(isset($_GET['error'])) {
echo "Incorrect login, please try again!";
}
?>
Username | |
Password | |
Don't have an account? Go and Register!
}
require("footer.php");
?>在其他问题上关于本网站的一些建议后,我更改了httpd.conf中的代码,该代码如下:
AllowOverride All
Require all denied
并且:
Allow from all
AllowOverride None
Options None
Require all granted
数据库中的用户表:
id int(11)AUTO_INCREMENT主要
username varchar(10)latin1_swedish-ci
密码varchar(10)latin1_swedish-ci
email varchar(100)latin1_swedish-ci
verifystring varchar(20)latin1_swedish-ci
主动tinyint(4)