PHP - Checking Rights
<p>I would like to make a code where when you login (already created login and register forms) it checks if you're an admin or not by connecting to the table in the 'social' database.</p>

<p>The table is 'users'
and the thing i want to check is 'rights'(This is in the users table).</p>

<p>Admin Rights is 3.</p>

<p>What i want is the PHP code to get the rights, and if the rights is 3(Admin) then when i login it should say 'Welcome Admin' instead of 'Welcome' as it currently says.</p>

<p>I am currently having trouble making this(I just cant get how to do it) so any help is appreciated.</p>

<p>Code:</p>

<pre><code>&lt;?php 
    include_once("config.php");
?&gt;

&lt;?php if( !(isset( $_POST['login'] ) ) ) { ?&gt;

&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;Experimental X&lt;/title&gt;
        &lt;link rel="stylesheet" type="text/css" href="style.css" /&gt;
    &lt;/head&gt;

    &lt;body&gt;

        &lt;header id="head" &gt;
            &lt;p&gt;Experimental X&lt;/p&gt;
            &lt;p&gt;&lt;a href="register.php"&gt;&lt;span id="register"&gt;Register&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
        &lt;/header&gt;

        &lt;div id="main-wrapper"&gt;
            &lt;div id="login-wrapper"&gt;
                &lt;form method="post" action=""&gt;
                    &lt;ul&gt;
                        &lt;li&gt;
                            &lt;label for="usn"&gt;Username : &lt;/label&gt;
                            &lt;input type="text" maxlength="30" required autofocus name="username" /&gt;
                        &lt;/li&gt;

                        &lt;li&gt;
                            &lt;label for="passwd"&gt;Password : &lt;/label&gt;
                            &lt;input type="password" maxlength="30" required name="password" /&gt;
                        &lt;/li&gt;
                        &lt;li class="buttons"&gt;
                            &lt;input type="submit" name="login" value="Log in" /&gt;
                            &lt;input type="button" name="register" value="Register" onclick="location.href='register.php'" /&gt;
                        &lt;/li&gt;

                    &lt;/ul&gt;
                &lt;/form&gt;

            &lt;/div&gt;
        &lt;/div&gt;

    &lt;/body&gt;
&lt;/html&gt;

&lt;?php 
} else {
    $usr = new Users;
    $usr-&gt;storeFormValues( $_POST );

    if( $usr-&gt;userLogin() ) {
        echo "Welcome"; 
    } else {
        echo "Incorrect Username/Password"; 
    }
}
?&gt;
</code></pre>
