Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User Access Levels
#1
Hello,

I'm trying to create a some-what simple user access level system. What I want, if is a user with the access level of "1" logs in, it will display something. If a user with the access level of "2" logs in, they don't see it.

Here's what I have so far, but can't get it to work.

PHP Code:
<?php
                $connect 
mysql_connect("localhost","--removed--","--removed--");
                
mysql_select_db("--removed--"$connect);
                
$result mysql_query("SELECT * FROM users");
                while(
$row mysql_fetch_array($result))
                {
                    
$level $row['group'];
                }
                if(
$level==1)
                {
                    echo 
"<div class='tabbertab'>";
                    echo 
"<h2>Tools/Settings</h1>";
                    echo 
"<div id='chat'>";
                    echo 
"</div>";
                    echo 
"</div>";
                }
                if(
$level==1)
                {
                    echo 
"<div class='tabbertab'>";
                    echo 
"<h2>User Management</h1>";
                    echo 
"<div id='chat'>";
                    echo 
"</div>";
                    echo 
"</div>";
                }
    
?>

Thanks Smile
Reply
#2
Nevermind, I got it working Big Grin
Reply
#3
I know you got it working, but I want to suggest you something.
Instead of using too many IF blocks, just use SWITCH statement when checking the same variable for different values..
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Could not connect: Access denied for user 'root'@'localhost' nevets04 5 4,462 02-03-2011, 04:52 PM
Last Post: Gaijin
  User Management Script - User Cake Support 9 5,623 05-13-2010, 03:21 PM
Last Post: Julie

Forum Jump:


Users browsing this thread: 1 Guest(s)