<?php 
session_start();
//require_once("header.php");

 
 
if(isset($_POST["uname"])  && isset($_POST["pwd"])){
 

$username=$_POST['uname'];


//$password=md5($_POST['pwd']);

$password=$_POST['pwd'];
require_once("labClass.php");
$con = new labClass();
$rQ=$con->login($username,$password);

if ($rQ->rowCount()>0) {
	$Dr=$rQ->fetch();
	$usn=$Dr['lname'].", ".$Dr['fname'];
	$psn=$Dr['department'];
	  $id1="qsgsfhuw8891o1pggywiuiwpwp8091hhwjmbbbnbsnusbbsggs98202iiahjhabbabbabba89299200gsgshsiisi00200hhshhsbbssbbsbbsk2002002002002";
	  $g="srqwesgbsynnebbdyyeuueumnennenneeyyyoy3yy3uu33iii3o3oo3oo3i3iii3ii3uu3uu3uuu3uuu3uuu3uuu3uuuu3uuu3uu3uu3uuu3uu3ttyy3yy3yy3yy3yy3yyy3yy3yy3yy3yy3shshhshhwhhwhhwhhheh";
	  
	  
	   if ($psn=="Sales and Market") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='staffP.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$usn' </script>";
	   
	    }
	       if ($psn=="Staff") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='receiptionPageStff.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$usn' </script>"; 
	    }
	    
	    if ($psn=="Manager") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='receiptionPage.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$usn' </script>";
	    
	    }

	    if ($psn=="Director") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='receiptionPage.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$usn' </script>";
	    
	    }
	    else{

	    echo $psn;// "<script> window.location.href='index.php' </script>";
	   
	    }
	  ///header("Location:http://www.buda.co.tz/hotel_default_entry.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$md");
	
}
else{
    
	  $r="Invalid usernme and password!..";
	  
	  
	   echo "<script> window.location.href='index.php' </script>";
    // header("Location:http://www.buda.co.tz/home.php?id=$r");
        
}

}
else{
	  $r="None registered user!..";
	    
	    echo  "<script> window.location.href='index.php' </script>";
	   
     //header("Location:http://www.buda.co.tz/home.php?id=$r");
        
}



 
?>