<?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=="Doctor") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='doctorHome.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$usn' </script>";
	    
	    }
	   if ($psn=="Receiption") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='mapokezi.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$usn' </script>";
	    
	    }
	    
	    if ($psn=="Nurse") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='nurseH.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$usn' </script>";
	    
	    }
	    if ($psn=="Lab") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='maabara.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=="Pharmacy") 
	    {
	   	$suc="LOGIN SUCCESSFULLY";
	    echo "<script> window.location.href='phHome.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$usn' </script>";
	    
	    }
	    else{

	    echo  "<script> window.location.href='index.php' </script>";//$psn;//
	   
	    }
	  ///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");
        
}



 
?>