Support Forums

Full Version: User Access Levels
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Nevermind, I got it working Big Grin
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..