proud Posted February 14, 2007 Share Posted February 14, 2007 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>"; } } Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted February 14, 2007 Share Posted February 14, 2007 It might be that when you click the link and goto the main forum page, there is no session start at the top of that file. If it isn't there, it won't let you continue your sessions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.