I have the following code in admin.php (admin page for some kind of simple CMS):
<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
//Some work with MySQL, setting $logged boolean and $priv variable (user's privileges)
//If $_POST['newspost'] set, processing request and setting $status
<!DOCTYPE html>
<html>
<head>
<!-- some JS and CSS includes -->
</head>
<body>
<div id="adm-content">
<h2 id="adm">Settings</h2>
<p id="news-status"><?php if (!empty($status)) echo $status; ?></p>
<?php if ($logged && $priv > 0){ ?> //user logged in and is admin
<p id="adm-status">Hello, <?php echo $_COOKIE['user'] ?></p>
<!-- some admin forms -->
<?php
}
else if ($priv == 0){ //user logged in and isn't admin
?>
<p id="adm-status">Hello, <?php echo $_COOKIE['user'] ?></p>
<p>You are not admin</p>
<?php
}
else{ ?>
<!-- login form displayed -->
?php
}
?>
</body>
</html>
All works fine except the second case (user logged in, but isn’t admin). Then a blank page is displayed. As I see in FireBug, GET admin.php response comes empty. Where the problem could be?
Thanks for your time.
Problem was in handling MySQL output, in this piece of code:
All works fine, when I rewrite it using mysql_fetch_row
Seems strange to me. Anyway, thanks for help, and sorry for not posting the actual problematic code =)