-
forbidden error
hi I wrote login script, the erro "Forbidden
You don't have permission to access /cmt3092/< on this server." ocurred could anyone help me. Thanks
Code:
<?php
session_start();
include "conn.inc.php";
// if the form is submited
if (isset($_POST['submit']))
{
// create the sql query
$query= "select username,password from users where username = '".$_POST['username']."'
and password = '".$_POST['password']."';";
//excute the query
$result = mysql_query($query)
//exit and display error if not excuted
or die(mysql_error());
// get number of rows that match username and password
if (mysql_num_rows($result) == 1)
{
$_SESSION['user_logged'] = $_POST['username'];
$_SESSION['user_password'] = $_POST['password'];
header ("Refresh: 5; URL=" . $_POST['redirect'] . "");
echo "You are being redirected to your original page request!<br>";
echo "(If your browser doesn't support this, <a href=\"index1.php" .
$_POST['redirect']. "\">click here</a>)";
}
else
{
?>
<html>
<head>
<title>user Login</title>
</head>
<body>
<fieldset>
Invalid Username and/or Password<br>
Not registered? <a href="register.php">Click here</a> to register.<br>
<form action="user_login.php" method="post">
<input type="hidden" name="redirect"
value="<?php echo $_POST['redirect']; ?>">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br><br>
<input type="submit" name="submit" value="Login">
</form>
</fieldset>
</bpdy>
</html>
<?php
}
}
else
{
if(isset($_GET['redirect']))
{
$redirect = $_GET['redirect'];
}else
{
$redirect="index1.php";
}
?>
<html>
<head>
<title>User Login</title>
</head>
<body>
<fieldset>
Login below by supplying your username/password...<br>
Or <a href="register.php">click here</a> to register.<br><br>
<form action="user_login.php" method="post">
<input type="hidden" name="redirect" value="<? echo $redirect; ?>">
Username: <input type="text" name="username" ><br>
Password: <input type="password" name="password" ><br><br>
<input type="submit" name="submit" value="Login">
</form>
</fieldset>
</body>
</html>
<?php
}
?>
-
Re: forbidden error
You probably need to chmod that file it make it world readable.