Hi - I've got a small problem that I've been trying to figure out for a little while. Basically I have an admin pannel but only users with a particular rank can access certain pages, so I'm using "authcheck.php" to check the page against the rank in the database, where $page = "mypage".
Here's the code:
<?php
session_start()
if (!$_SESSION['username']) {
header("Location: $siteurl/login.php");
exit;
}
if (!$_SESSION['user_rank']) {
header("Location: $siteurl/authfail.php");
exit;
}
$username = $_SESSION['username'];
$rank = $_SESSION['user_rank'];
$stop = mysql_query("SELECT * FROM authcheck WHERE rank='$rank'")
or die("Error, could not connect to the database.");
While ($row = mysql_fetch_array($result))
{
If $row['page'] != $page
{
header("location: $siteurl/authfail.php");
}
else
{
?>
Now whether you can spot the problem or not, I don't know but the main problem is with the
If $row['page']...
bit onwards. Any help will be appreciated, thanks,
Chris