<?php
session_start();
include('includes/class.user.php');
$user = new User(); 
include('includes/class.helper.php');
$helper = new Helper(); 
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$username=$_POST['email']; 
$password=$_POST['password'];
if($_POST['usertype']=="Administrator"){ 
$login = $user->check_login($username, $password);
	    if ($login) {
	       
	       header("location: dashboard.php");
	    } 
		else 
		{
		$error="Your Username or Password is invalid";
		}
}
else {
$login = $user->check_member_login($username,$password,$_POST['usertype']);
        if ($login) {
	       
	       header("location: dashboard.php");
	    } 
		else 
		{
		$error="Your Username or Password is invalid";
		}
	
}
}
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Top Notch Real Estate | Log in</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- iCheck -->
  <link rel="stylesheet" href="plugins/iCheck/square/blue.css">
<link rel="stylesheet" href="dist/css/style.css">
</head>
<body class="hold-transition login-page">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12" style="height: 657px;background: #e8f0fe;"> 
<p style="text-align: center; padding-top: 35%;">
<img src="../images/logo.png">
<!--
<p style="text-align: center;font-weight: 600;">Office 136, 1st Floor, Emarat Artium Building, P.O. Box 126487,<br> Sheikh Zayed Road, Dubai, U.A.E.</p>
<p style="text-align: center;font-weight: 600;">Phone : +971 4 303 9333</p>
-->
	</p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12" style=" background:#fff;">
<div class="login-box" style="padding-top: 30%;">
  <!-- /.login-logo -->
  <div class="login-box-body">
    <form action="" method="post">
      <div class="form-group has-feedback">
        <input type="text" name="email" class="form-control" placeholder="Username">
        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" name="password" class="form-control" placeholder="Password">
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
      <input type="hidden" name="usertype" value="Administrator"/> 
      
      </div>
      <div class="row">
        
        <div class="col-xs-12">
          <button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
        </div>
        <!-- /.col -->
        <?php
		if($error!=""){
			?>
            <button class="btn btn-block btn-danger btn-sm" type="button">Your Username & Passwords were wrong</button>
         <?php
		}
		?>
      </div>
    </form>
     

    <!--<a href="forget.php">I forgot my password</a><br> -->

  </div>
  <!-- /.login-box-body -->
</div>
	</div>

<!-- jQuery 2.2.3 -->
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="plugins/iCheck/icheck.min.js"></script>
<script>
  $(function () {
    $('input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '20%' // optional
    });
  });
</script>
</body>
</html>
