focus310,
Your error appears to be in the logic where the actual include call is made.
You have:
if (@mysql_num_rows($result) == 1) { // A match was made.
// Register the values & redirect.
$row = mysql_fetch_array ($result, MYSQL_NUM);
mysql_free_result($result);
mysql_close(); // Close the database connection.
$_SESSION["status"] = "Logged";
$_SESSION['username'] = $row[1];
$_SESSION['user_id'] = $row[0];
$_SESSION['admin_access'] = $row[2];
if ($_SESSION['admin_access'] = 1) {
header("Location:welcome.php");
} elseif
($_SESSION['admin_access'] = 2) {
header("Location:index.html");
}
}
Which should look something more like:
if (@mysql_num_rows($result) == 1) { // A match was made.
// Register the values & redirect.
$row = mysql_fetch_array ($result, MYSQL_NUM);
mysql_free_result($result);
mysql_close(); // Close the database connection.
$_SESSION["status"] = "Logged";
$_SESSION['username'] = $row[1];
$_SESSION['user_id'] = $row[0];
$_SESSION['admin_access'] = $row[2];
if ($_SESSION['admin_access'] == 1) {
header("Location:welcome.php");
} elseif
($_SESSION['admin_access'] == 2) {
header("Location:index.html");
}
}
You remembered to use the comparative operator when checking the row count, but switched to the assignment operator when check the access level. since $admin_access = 1 will always resolve true (you are just assigning the value 1), welcome.php is loaded.