<?php 
	ob_start();
  session_start();
	require "lmhlibs/dbcon.php";
  require "lmhlibs/trangchu.php";
 ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <link rel="icon" type="image/png" href="<?php ?>" sizes="32x32" />
  <title>Đăng nhập</title>
  <link rel="stylesheet" href="public/lib/bootstrap/css/bootstrap.min.css">
  <link rel="stylesheet" href="public/lib/fontawesome/css/all.css">
  <link rel="stylesheet" href="public/css/stylelogin.css">
  <script src="public/lib/jquery.min.js"></script>
</head>
<body>
<?php
$flag=false;
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$login = new trangchu;  
$adminUser=htmlentities($_POST['adminUser']);
$adminUser = str_replace("'","", $adminUser);
$adminPass=md5($_POST['adminPass']);
$result = $login -> login();
while($row=mysqli_fetch_array($result))
  {
    if (($row['lmhuser']==$adminUser) && ($row['lmhpass']==$adminPass))
    {
      $flag=true;
      $_SESSION['user']=$adminUser;
      $_SESSION['pass']=$adminPass;
      $_SESSION['HoTen'] = $row['hoten'];
      $_SESSION['idGroup'] = $row['idgroup'];
      $_SESSION['iduser'] = $row['iduser'];
      $thoigian = date("Y-m-d h:i:s");
    }
  }
 if($flag==true)
 {
  $login -> updatelogin($_SESSION['iduser'],$thoigian);
  header("Location:quantritueba.php?page=baiviet&trang=1");
 } 
 else $baoloi="Không chính xác vui lòng nhập lại";
}
?> 
 <section class="login-block">
    <div class="container">
    <div class="row">
        <div class="col-md-4 login-sec">
            <a href="http://tueba.edu.vn"><h2 class="text-center">TUEBA</h2></a>
  <form class="login-form" action="" method="post">
  <div class="form-group">
    <label  class="text-uppercase">Tên đăng nhập</label>
    <input type="text" class="form-control" placeholder="" name="adminUser">
    
  </div>
  <div class="form-group">
    <label  class="text-uppercase">Mật khẩu</label>
    <input type="password" class="form-control" placeholder=""  name="adminPass">
  </div>
  <div class="dangnhap">
  <button type="submit" class="btn btn-login dangnhap " value="Login">ĐĂNG NHẬP</button>
  </div>
  <div style="color:red;"><?php if(isset($baoloi)) echo "<br>$baoloi";?></div> 
</form>
<div class="copy-text">Created with <i class="fa fa-heart"></i> by <a href="#">LMH</a></div>
        </div>
        <div class="col-md-8 banner-sec">
            <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
                 <ol class="carousel-indicators">
                    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
                  </ol>
            <div class="carousel-inner" role="listbox">
    <div class="carousel-item active">
      <img class="d-block img-fluid" src="public/images/adminslide/1.jpg" alt="First slide">
      <div class="carousel-caption d-none d-md-block">
        <div class="banner-text">
            <h2>HAVE A GOOD TIME</h2>
            <p>Life is like riding a bicycle. To keep your balance, you must keep moving. ― Albert Einstein</p>
        </div>    
  </div>
    </div>
    <div class="carousel-item">
      <img class="d-block img-fluid" src="" alt="First slide">
      <div class="carousel-caption d-none d-md-block">
        <div class="banner-text">
            <h2></h2>
            <p></p>
        </div>    
    </div>
    </div>
    <div class="carousel-item">
      <img class="d-block img-fluid" src="" alt="First slide">
      <div class="carousel-caption d-none d-md-block">
        <div class="banner-text">
            <h2></h2>
            <p></p>
        </div>    
    </div>
  </div>
            </div>       
            
        </div>
    </div>
</div>
</section> 
</body>
</html>