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

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

$username=$_POST['uname'];


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

require_once("buda_connect.php");

$con = new connect_class();

$rQ=$con->login($username,$password);

if ($rQ->rowCount()>0)
 {
	$Dr=$rQ->fetch();
	$depart=$Dr['department'];

	
    $id1="qsgsfhuw8891o1pggywiuiwpwp8091hhwjmbbbnbsnusbbsggs98202iiahjhabbabbabba89299200gsgshsiisi00200hhshhsbbssbbsbbsk2002002002002";
	$g="srqwesgbsynnebbdyyeuueumnennenneeyyyoy3yy3uu33iii3o3oo3oo3i3iii3ii3uu3uu3uuu3uuu3uuu3uuu3uuuu3uuu3uu3uu3uuu3uu3ttyy3yy3yy3yy3yy3yyy3yy3yy3yy3yy3shshhshhwhhwhhwhhheh";

	if ($depart=="Receiption and cashier") 

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

	{ 
	   
	 $suc="LOGIN SUCCESSFULLY";
	 echo "<script> window.location.href='hotel_default_entry.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$md' </script>";
	 
	}
	else if ($depart=="Lab") 

	{ 
	   
	 $suc="LOGIN SUCCESSFULLY";
	 echo "<script> window.location.href='hotel_default_entry.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$md' </script>";
	 
	}

  else if ($depart=="") 

	{ 
	   
	 $suc="LOGIN SUCCESSFULLY";
	 echo "<script> window.location.href='hotel_default_entry.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$md' </script>";
	 
	}

   else ($depart=="") 

	{ 
	   
	 $suc="LOGIN SUCCESSFULLY";
	 echo "<script> window.location.href='hotel_default_entry.php?suc=$suc&eqsgsfhuw8=$id1&rsrqwes=$g&id=$md' </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='home.php?id=$r' </script>";
    // header("Location:http://www.buda.co.tz/home.php?id=$r");
        
   }

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



 /*

$valid=mysql_query("select owner_id from owner_credential where  username= '$name' and secret_no='$secret'") or die("Error:".mysql_error());

$no=mysql_num_rows($valid);

if($no>0){
	$re = array();
	
	$outD = mysql_fetch_array($valid);
	
	array_push($re,array( 'owner_id'=>$outD[0]
	                       
	                       ));
						   
$chCate=mysql_query("select own_regno fname,mname, lname, btown_dist,bstreet_vil,email,rtown,rstreet from  account_owner where owner_id='$outD[0]'") or die("Error:".mysql_error());

$ownO=mysql_num_rows($chCate);
if($ownO>0){
	$ownpro=array();
	
	$OwnD=mysql_fetch_array($chCate);
	
	array_push($ownpro, array('own_regno'=>$OwnD[0],
	                          'fname'=>$OwnD[1],
							  'mname'=>$OwnD[2],
							  'lname'=>$OwnD[3],
							  'btown_dist'=>$OwnD[4],
							  'bstreet_vil'=>$OwnD[5],
							  'email'=>$OwnD[6],
							  'rtown'=>$OwnD[7],
							  'rstreet'=>$OwnD[8]
	));
	
$hotel=mysql_query("select hotel_id,hname,ltown_city,lstreet_vil,paddress,email,reg_date from  hotel where owner_id='$OwnD[0]'")or die("Error:".mysql_error());

$hotno=mysql_num_rows($hotel);

if($hotno>0){
	
	 $gethoD = array();
	 
	 $OuthD=mysql_fetch_array($hotel);
	 
	 array_push($gethoD,array('hotel_id'=>$OuthD[0],
	                         'hname'=>$OuthD[1],
							 'ltown_city'=>$OuthD[2],
							 'lstreet_vil'=>$OuthD[3],
							 'paddress'=>$OuthD[4],
							 'email'=>$OuthD[5],
							 'reg_date'=>$OuthD[6]
							  
	             
				 ));
	 
	
	
	
	
}else{
	$test="TRUE";
}							   
include("hotel_after_login_home.php");	
}else{
echo "Sorry you no hotel registered for advertisement!..";	
}						
	
}else{
	echo "You are not registered yet!..";
}



}else{
echo "Not found";
}
 */
?>