错误403 localhost Apache / 2.4.3(Win32)OpenSSL / 1.0.1c PHP / 5.4.7

时间:2013-04-23 09:49:44

标签: php

请帮忙! 我尝试登录时遇到以下错误:

禁止访问!

您无权访问请求的对象。它受读保护或服务器无法读取。

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

错误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主要 username 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)

1 个答案:

答案 0 :(得分:0)

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