2013-04-23 332 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連接。