-2

请帮忙!尝试登录时出现以下错误:

禁止访问!

您无权访问请求的对象。它要么是读保护的,要么是服务器不可读的。

如果您认为这是服务器错误,请联系网站管理员。

错误 403

本地主机 Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7

我的 login.php 代码如下:

<?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 "<h1>Login</h1>";

if(isset($_GET['error'])) {
echo "Incorrect login, please try again!";
}
?>
<form action="<?php echo
pf_script_with_get($SCRIPT_NAME); ?>" method="post">
<table>
<tr>
<td>Username</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Login!"></td>
</tr>
</table>
</form>
Don't have an account? Go and <a href="register.php">Register</a>!
<?php
}
require("footer.php");
?>

在遵循本网站上关于其他问题的一些建议后,我更改了 httpd.conf 中的代码,如下所示:

<Directory />
    AllowOverride All
     Require all denied
</Directory>

并且:

<Directory "C:/xampp/cgi-bin">
    Allow from all
    AllowOverride None
    Options None
    Require all granted
</Directory>

数据库中的用户表:

id int (11) AUTO_INCREMENT 主用户名 varchar(10) latin1_swedish-ci 密码 varchar(10) latin1_swedish-ci email varchar(100) latin1_swedish-ci verifystring varchar(20) latin1_swedish-ci active tinyint(4)

4

1 回答 1

0

也许您的login进程register尝试通过 SSL 连接进行处理,但您没有启用 SSL 连接。如果您使用脚本包。转到管理面板并禁用 SSL 连接。

于 2013-04-23T11:09:13.070 回答