403 Forbidden - You don't have permission to access / on this server.
When i am trying to run my login script i get username and password fields and when i have typed that in and click on "login" i get this error.
My MySQL DB is login6, i have tried a lot of login system as you can see :-)
"You don't have permission to access /login6/< on this server 403 forbidden"
What is wrong ?
Here is the code for the index.php file just in case:
<?
// Use session variable on this page. This function must put on the top of page.
session_start();
////// Logout Section. Delete all session variable.
session_destroy();
$message="";
////// Login Section.
$Login=$_POST['Login'];
if($Login){ // If clicked on Login button.
$username=$_POST['username'];
$md5_password=md5($_POST['password']); // Encrypt password with md5() function.
// Connect database.
$host="localhost"; // Host name.
$db_user="admin"; // MySQL username.
$db_password="1234"; // MySQL password.
$database="login6"; // Database name.
mysql_connect($host,$db_user,$db_password);
mysql_select_db($database);
// Check matching of username and password.
$result=mysql_query("select * from admin where username='$username' and password='$md5_password'"
;
if(mysql_num_rows($result)!='0'){ // If match.
session_register("username"
; // Craete session username.
header("location:main.php"
; // Re-direct to main.php
exit;
}else{ // If not match.
$message="--- Incorrect Username or Password ---";
}
} // End Login authorize check.
?>
<html xmlns="[
www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<? echo $message; ?>
<form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>">
<table>
<tr>
<td>User : </td>
<td><input name="username" type="text" id="username" /></td>
</tr>
<tr>
<td>Password : </td>
<td><input name="password" type="password" id="password" /></td>
</tr>
</table>
<input name="Login" type="submit" id="Login" value="Login" />
</form>
</body>
</html>
And main.php:
<?
// You may copy this PHP section to the top of file which needs to access after login.
session_start(); // Use session variable on this page. This function must put on the top of page.
if(!session_is_registered("username"
){ // if session variable "username" does not exist.
header("location:index.php"
; // Re-direct to index.php
}
?>
<html xmlns="[
www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<p>Hello <? echo $_SESSION['username']; ?>! You are now Logged in.</p>
<p><a href="index.php">Logout</a></p>
</body>
</html>
Hope you have some ideas what is wrong.
Thank you in advance for your suggestions