Jump to content

Problem with the admin area?


proud

Recommended Posts

I'm trying to design a user administration area for a forum, my target is that when a user logs to the system with his username and password if he is an administrator he is supposed to see three links (admin,main forum and logout) but when he is not an admin he must only see two links (main forum and logout).

so this piece of code works when I log into the system as an admin with my username and password and i see the three links but when I enter the main forum link and return back I just find the two links (main forum and logout) without the admin link...

could anyone know what is wrong with this piece of the code, i dont know whether the problem has to do with the session or something else?

note:This part of the code is where i think the problem is existing although i'm not definitely sure.

 


if(session_is_registered("valid_user"))
{

  $sql2 = "SELECT * FROM users WHERE user_name = '$userid'";
  $result2 = mysql_query( $sql2 );
  $row = mysql_fetch_array( $result2 );


if( $row['user_admin'] == 'y' )
{
  
    echo"<a href='admin.php'>admin</a><br><br>";
    echo"<a href='main_forum.php'>Main forum</a><br><br>";
    echo"<a href='21.php'>Logout</a><br>";

}

if( $row['user_admin'] == 'n' )

{

echo"<a href='main_forum.php'>Main forum</a><br><br>";
echo"<a href='21.php'>Logout</a><br>";  

}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.