<?php
session_start();
error_reporting(0);
include('phpaccess/linkme.php');
if(isset($_POST['submit']))
{
	$username=$_POST['username'];
	$password=md5($_POST['password']);
$ret=mysqli_query($con,"SELECT * FROM admin WHERE username='$username' and password='$password'");
$num=mysqli_fetch_array($ret);
if($num>0)
{
$extra="dashboard.php";//
$_SESSION['alogin']=$_POST['username'];
$_SESSION['id']=$num['id'];
$host=$_SERVER['HTTP_HOST'];
$uri=rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
header("location:http://$host$uri/$extra");
exit();
} elseif($num==0) {
$ret1=mysqli_query($con,"SELECT * FROM users WHERE UserName='$username' and Password='$password'");
$num1=mysqli_fetch_array($ret1);
if($num1>0)
{
$acctstatus=$num1['IsActive'];
if($acctstatus=='1'){
$extra="staff/dashboard.php";//
$_SESSION['subalogin']=$_POST['username'];
$_SESSION['suid']=$num1['id'];
$host=$_SERVER['HTTP_HOST'];
$uri=rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
header("location:http://$host$uri/$extra");
exit();
}else{
$_SESSION['errmsg']="Your account is blocked. Please contact administrator.";	
}
}else
{
$_SESSION['errmsg']="Invalid username or password";
}
}
}
?>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="favicon.ico">
    <title>Web Admin LogIN - ENL Consortium Limited</title>
    <!-- Simple bar CSS -->
    <link rel="stylesheet" href="css/simplebar.css">
    <!-- Fonts CSS -->
    <link href="https://fonts.googleapis.com/css2?family=Overpass:ital,wght@0,100;0,200;0,300;0,400;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
    <!-- Icons CSS -->
    <link rel="stylesheet" href="css/feather.css">
    <!-- Date Range Picker CSS -->
    <link rel="stylesheet" href="css/daterangepicker.css">
    <!-- App CSS -->
    <link rel="stylesheet" href="css/app-light.css" id="lightTheme">
    <link rel="stylesheet" href="css/app-dark.css" id="darkTheme" disabled>
  </head>
  <body style="background-image: url('assets/images/1.jpg');" >

    <!--div class="wrapper vh-100" style=" background-color: #cccccc"-->
    <div class="wrapper vh-100"  style="background-image: url('assets/images/1.jpg');" >
    <!--div class="wrapper vh-100" style="background-image: url("../assets/1.jpg");" -->
      <div class="row align-items-center h-100">
        <div class="col-lg-6 d-none d-lg-flex">
        </div> <!-- ./col -->
        <div class="col-lg-6" style="background-color: #bdc1cabd;">
          <div class="w-50 mx-auto">
            <form class="mx-auto text-center"  method="post">
              <a class="navbar-brand mx-auto mt-2 flex-fill text-center" href="./index">
             <img src="assets/images/logo-full.png" alt="ENL Consortium Limited">
              </a>
              <h1 class="h1 mb-3">Staff Sign in</h1>
              <div class="form-group">
                <label for="inputEmail" class="sr-only">Username </label>
                <input type="text" name="username" id="inputEmail" class="form-control form-control-lg" placeholder="Enter your Username" required="" autofocus="">
              </div>
              <div class="form-group">
                <label for="inputPassword" class="sr-only">Password</label>
                <input type="password" id="inputPassword" name="password"  class="form-control form-control-lg" placeholder="Password" required="">
              </div>
              <div class="checkbox mb-3">
                <label>
                  <input type="checkbox" value="remember-me"> Stay logged in </label>
              <button class="btn btn-lg btn-primary btn-block" type="submit" name="submit">Let me in</button>
              </div>
			  
            </form>
          </div> <!-- .card -->
        </div> <!-- ./col -->
      </div> <!-- .row -->
    </div>
    <script src="js/jquery.min.js"></script>
    <script src="js/popper.min.js"></script>
    <script src="js/moment.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/simplebar.min.js"></script>
    <script src='js/daterangepicker.js'></script>
    <script src='js/jquery.stickOnScroll.js'></script>
    <script src="js/tinycolor-min.js"></script>
    <script src="js/config.js"></script>
    <script src="js/apps.js"></script>
  
  </body>
</html>
</body>
</html>