2013-04-23 337 views
-2

请帮忙! 我在尝试登录时遇到以下错误:错误403 localhost Apache/2.4.3(Win32)OpenSSL/1.0.1c PHP/5.4.7

访问被禁止!

您没有权限访问请求的对象。它是读取保护的或服务器不可读的。

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

错误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> 

和也:

ID INT(11)AUTO_INCREMENT主 用户名VARCHAR(10)latin1_swedish-Cl 密码VARCHAR(10)latin1_swedish-CI:

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

在数据库用户表 email varchar(100)latin1_swedish-ci verifystring varchar(20)latin1_swedish-ci active tinyint(4)

+0

其他页面正常打开? – 2013-04-23 09:52:21

+0

文件所在目录的文件列表(包括隐藏文件和属性)比源代码更有用。 – 2013-04-23 09:53:38

+0

@YogeshSuthar,是的其他网页正常打开,也可以访问数据库。例如我的itemdetails.php可以显示数据库中的项目。 – Shahnawaz 2013-04-23 10:07:51

回答

0

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