Q: Login - User Level I would like to make a login page with 2 different user level, Admin & Staff. How can i do it using d code below.
Thank u.
    <?php

    $host="localhost";  
    $username="root";   
    $password="";  
    $db_name="profile";  
    $tbl_name="company";  


    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("Cannot Select Database");

    // username and password sent from form  
    $myusername=$_POST['myusername'];  
    $mypassword=$_POST['mypassword'];


    $myusername = stripslashes($myusername);  
    $mypassword = stripslashes($mypassword);  
    $myusername = mysql_real_escape_string($myusername);  
    $mypassword = mysql_real_escape_string($mypassword);   

    $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";  
    $result=mysql_query($sql);  

    // Mysql_num_row is counting table row  
    $count=mysql_num_rows($result);  

if($count==1){  

$_SESSION['myusername'] = $myusername;  
$_SESSION['mypassword'] = $mypassword; 
header("location:Admin_home.php");
}  
else {  
echo "Wrong Username or Password";  
}  
?> 

Login success :
session_start();   
if(!session_is_registered(myusername))
{     

header("location:Admin_home.php");    

}   
?>  
<html>
<body>
Login Successful  
</body>
</html>


A: Step 1:
Create a file with a <form> in that directs to that script. Presumably you need 3 inputs (submit, username, password).
Step 2:
Create a file that is named "login_success.php" so that it will redirect to it when it's done. Except you said you need two, one for admin one for normal. 
Given your specifications of the project, that's all I can help you with. Try working with it a little bit, then show us what you have if you are still having problems. 
If you know which user is admin:
$admin = "admin_username";
if($myusername == $admin) header("Location: admin_page.php");
else header("Location: normal_page.php");

but you have to know if the user is an admin or not. Either by hardcoding $admin or by adding a column to your sql that is is_admin or something. 
