Admin and non admin login

I am a newbie to php and have a issue. I have a login code but i need the code to when admin login it sends then to a page with the admin menu bar. When a non admin login it sends them to the same page but with the non admin menu bar.

I have a users table called “teams” with a column name “role” and 1 as admin and 2 as non admin…

Here is my whole login code. Each member has a id so id # 3,15,17 are admin id’s and 1,2,4,5,6,7,8,9,10,11,12,3,14,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31 are non admin id;s… Can anyone help with this code??? Ive tried this ive tried that and i just cant seem to get the dam thing right.

Here is the code:

<?php
if(isset($_COOKIE['logged']))
{
?>
<div id='signin'>

    <form action="http://www.virtualhockeyassociation.com/onlogout.php" method="post" name="logForm" id="logForm" >
        Welcome <?php session_start(); echo $_SESSION['GM'];?>!
        <input type="submit" value="Log Out" />
    </form>
</div>
<?php
}
if(isset($_POST['doLogin']))
{
$email=$_POST['usr_email'];
$password=$_POST['pwd'];
if(file_exists('php_classes/config.php'))
    include_once 'php_classes/config.php';
else
    include_once '../php_classes/config.php';
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
echo "SELECT * FROM teams where email='$email' and password='$password'";
$result = mysql_query("SELECT * FROM teams where email='$email' and password='$password'");
mysql_close();
if(mysql_num_rows($result) >0)
{
    session_start();
    $row=mysql_fetch_array($result);
    setcookie('logged',$row['id'],time()+1000);
    $_SESSION['uid']=$row['id'];
    $_SESSION['GM']=$row['GM'];
    $_SESSION['tid']=$row['newsid'];
    $_SESSION['teamname']=$row['teamname_l'];
    $_SESSION['teamabr']=$row['teamabr'];
    header("location: http://www.virtualhockeyassociation.com/teams/teampage_admin.php?id=".$_SESSION['tid']);
}
else
{
    header("location: http://www.virtualhockeyassociation.com/index.php?status=loginerror");
}
}
?>
<div id='signin'>
                <form action="http://www.virtualhockeyassociation.com/signin.php" method="post" name="logForm" id="logForm" >
                    <label class='loginLBL' for='username'>USERNAME:</label><input name="usr_email" type="text" class="required" id="txtbox" size="20">
                    <label class='loginLBL' for='password'>PASSWORD:</label><input name="pwd" type="password" class="required password" id="txtbox" size="25">
                    <input name="doLogin" type="submit" id="doLogin3" value="Login">
                </form>
            </div>

It has to easy. Im missing something but my php verbal knowledge isnt where it needs to be. Im a disabled vet and have taught all i know myself by reading and reading. Problem is part of my disability is a mental, memory thing… Anyway if anyone could show me how and what im doing wrong i would be very greatfull.

Thank you and god bless

~Scott

How does the system know which users are admins and which ones arent? $_SESSION[‘GM’] ?

PS: This line will not work:

        Welcome <?php session_start(); echo $_SESSION['GM'];?>!   

session_start must be called before any output is made. Make it your first line of code. (Sessions should be started regardless of whether a user is signed in or not.)

EDIT: Wow, okay i cant read apparantly. Go me. So commit $_SESSION[‘role’] to the record, and then if($_SESSION[‘role’] == 1) { serve admin bar } else { serve non-admin bar }

Ahh… thank you sir. That did the trick.