<?php 
error_reporting(0);
define('INCLUDE_CHECK',true);
session_start();
session_destroy();
require 'classes/config.php';

$msg="";
if(isset($_POST['login'])){
	$email = htmlspecialchars($_POST['email']);
	$authp = htmlspecialchars($_POST['authp']);
//	$authp = mysql_real_escape_string($_POST['authp']);
	$sql=("SELECT * FROM staff_details WHERE username='$email' AND authp='$authp' AND status='active' OR email='$email' AND authp='$authp' AND status='active'");
	 $result = $conn->query($sql);
	 
	 
	 	if ($result->num_rows > 0) {
            	while($row = $result->fetch_assoc()) {
	// $count=mysql_num_rows($sql);
	//	if($count >0){
		//	$row=mysql_fetch_array($sql);
				$_SESSION['id']= $row['id'];
				$_SESSION['surname'] = $row['surname']; 
				$_SESSION['othernames'] = $row['othernames'];
				$_SESSION['staffno'] = $row['staff_no'];
				$_SESSION['pix'] = $row['pix'];

				if ($row['email']!=""){
					header("location: dashboard.php?action=home");
				}else{
					header("location: dashboard.php?action=change_password");
				}
				exit(); 
				
		}
		}else{
			$msg ="<div style=color:#fff; font-size:14px;>Invalid Staff_no/Password</div>";
		}

}
//mysql_close();
$conn->close();

?>




<!DOCTYPE html>
<html lang="en">
	<head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>Osun state College of Technologym Esa Oke== Staff Profile Login</title>
        <link href="assets/css/login.css" rel="stylesheet">
        <style type="text/css">
<!--
.style1 {
	color: #FFF
}
-->
        </style>
</head>
  
<body >
<div class="wrapper">
<div class="the-head">
	<!--<a href="#" style="border:none;"></a> --></div>


<div class="main_container">
	<div class="topbar">
	  <div class="fill">
    		<h1>Staff Profile Login</h1>
	  </div>
	</div>

<div class="container">
    <div class="contentpadded">

<div class="">
    <form method="post" action="" class="form-stacked" name="frmlogin">

<div class="row">
		<div class="col60">
			<p style="font-size: 17px; line-height: 1.5; margin-left: -20px; margin-right: 20px"></p>
			<div class="">
				<div style="margin-top:20px;margin-top: 20px; border-bottom: 1px solid #EBEBEB; padding-bottom: 16px; width: 80%;">
					<img src="assets/img/logo2.png" style="margin-right:20px;" align="left">
					
					<h4><u>Instructions</u></h4>
					<p style="margin-left: 100px; margin-top: 20px;"><strong> Please login with </strong><br> <br>
					
					Username* and  Password*
				<!--	<strong>Username:</strong>Your E - mail &amp;  <strong>Password:</strong> Your Identification Number --> </p>
                    <p style="margin-left: 100px; margin-top: 20px;">Ensure you fill in all the available fields that are compulsory. (*)<br> <br>Make sure you upload your passport photograph.</p>
                    <p style="margin-left: 100px; margin-top: 20px;">Keep your Username and Password secured in a safe place</p>

				</div>
				<div style="clear:both;"></div>
				
                
			</div>
		</div>

    <div class="col40">
	
	    <div class="well" style=" width: 280px; ">
        	<?php echo $msg; ?>
			<h2 id="loginhead">Login Menu</h2>
			<div class="clearfix">
				<label for="username"><span class="style1">Email Address:</span></label>
				<div class="input">
					<input class="xlarge" style="padding: 8px; width: 90%;" name="email" type="text" autocomplete="off" required placeholder="Email">
				</div>
			</div>

			<div class="clearfix">
				<label for="authp"><span class="style1">Password</span>:</label>
				<div class="input">
					<input class="xlarge" style="padding: 8px; width: 90%;" name="authp" type="password" placeholder="Password" required>
				</div>
			</div>

			<div align="center">
			  <div class="loginbtn"><input class="btn large"  name="login" value="Login" type="submit"></div>
			  <br>
			  <br>
			  <p><a href="#" class="style1"><span class="style1">Request a Password Reset</span></a></p>
			</div>
		</div>

	</div>

</div>

</form>

<script language="javascript">
document.frmlogin.username.focus();
</script>

</div>




    </div>
</div>
</div>



</div>

<div class="footer">
<!--<a href="#">Report your problems encounter or  difficult to Portal manager or Desk Officer.</a> -->
<span style="float:right;"><?php
		$yea = date("Y");
		 echo '&copy;'." ".$yea;?> Osun State College of Technology, Esa Oke| Powered by: ICT.</span>
</div>

</body></html>