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
https://forums.phpfreaks.com/topic/38520-problem-with-the-admin-area/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.