Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5956789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:18:28+00:00 2026-05-22T18:18:28+00:00

I have the following code in admin.php (admin page for some kind of simple

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:18:29+00:00Added an answer on May 22, 2026 at 6:18 pm

    Problem was in handling MySQL output, in this piece of code:

    $priv = mysql_result($qry, 0) or die(mysql_error());
    

    All works fine, when I rewrite it using mysql_fetch_row

    $x = mysql_fetch_row($qry);
    $priv = $x[0];
    

    Seems strange to me. Anyway, thanks for help, and sorry for not posting the actual problematic code =)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
i have following code to show div on page <div id=all_users> <div id=user11 userid=11
We have following code: try { // some code throwing MyException } catch (MyException
I have the following PHP code which simply grabs a URL behind HTTP-Basic authentication
I have the following url. http://127.0.0.1/ci/index.php/admin/menus/edit/24 I want to get 24 from this to
I'm about to code a php/mysql platform that does the following: Admin panel User
I have the following code: <a href=main.html class=admin><div class=buttonlabel>Admin</div></a> and CSS a.admin { display:block;
I have placed the following code at the top of index.php: if (!isset($_SERVER['REMOTE_ADDR'])){ $_SERVER['QUERY_STRING']
I have the following code: # Initialisations filename='/home/Admin/Desktop/Ncapa/i_capa.txt' f = open(filename, 'r') ty =
I have following code which on save from the admin area creates a duplicate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.