if(isset($_POST['submit']))
{
if(!empty($_POST['login_username']) && !empty($_POST['login_password']))
{
$uname = $_POST['login_username'];
$pass = $_POST['login_password'];
$res="SELECT count(*),uname,role FROM users WHERE uname='$uname' and password='$pass' ";
$query=mysql_query($res)or die (mysql_error());
list($result,$uname,$role) = mysql_fetch_row($query);
$_SESSION['username'] = $uname;
$_SESSION['role'] = $role;
if(isset($_SESSION['username']) && $_SESSION['role']=="admin")
{
if($result>0)
{
header ('Location:Dashboard.php');
}
else
{
header ('Location:loginform.php');
}
}