I am using this 3 script. Why on the 3rd script (main.php), It always go to
You are not allowed to access this page.
---index.php
<form action="verify.php">
Username : <input type="text" class="textbox" name="username" size="30"><br>
Password : <input type="text" class="textbox" name="password" size="30">
<br>
<input type="submit" class="button" name="Submit" value="Enter">
</form>
---verify.php
<?php
include('conn.php');
$username=$POST["username"];
$password=$POST["password"];
$qstr ="SELECT * FROM user WHERE user = '$username' AND password = '$password'";
$result = mysql_query($qstr);
session_start();
if (mysql_num_rows($result)) {
$username=$HTTP_POST_VARS["username"];
$permission="yes";
session_register("permission");
session_register("username");
[U]header("Location: main.php"); [/U]
}
else
{
header("Location: index.php");
}
?>
---main.php
<?php
session_start();
$permission=$_SESSION['permission'];
if ($permission=="yes") {
?>
<html>
<title>Page 1</title>
<body>
Hi, welcome to Page 1 <BR>
This page is empty at the moment, but it will be very interesting in the next future
</body>
</html>
<?php }else{ ?>
You are not allowed to access this page
<?php } ?>