<?php 
  include('connection.php');
  if(isset($_POST['submit'])){
    $email = $_POST['email'];
    $password=md5($_POST['pass']);

    $select = mysqli_query($conn,"SELECT * FROM admin where name='$email' AND pass='$password'");
    $rw = mysqli_fetch_array($select);

      if($rw['pass'] == $password) {
        header('location:dashbord.php');
      }else{
        $sms = '<button class="btn btn-danger">Invalid credential provided</button>';
      }
    }
 ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>REIMETA PRE & PRIMARY SCHOOL</title>

    <!-- Bootstrap -->
    <link href="images/logo1.png" rel="ICON">
    <link href="vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="vendors/nprogress/nprogress.css" rel="stylesheet">
    <!-- Animate.css -->
    <link href="vendors/animate.css/animate.min.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="build/css/custom.min.css" rel="stylesheet">
  </head>

  <body class="login">
    <div>
      <a class="hiddenanchor" id="signup"></a>
      <a class="hiddenanchor" id="signin"></a>

      <div class="login_wrapper">
        <div class="animate form login_form">
            <img src="images/logo.jpg " width="1800px" height="250px" style="border-radius: 30px; margin-left:-730px;">
              <section class="login_content">
            <form action="" method="post">
              <h1>REIMETA ACCOUTANT PANEL</h1>
              <div>
                <input type="text" class="form-control" placeholder="Username" name="email" required="" autocomplete="off" />
              </div>
              <div>
                <input type="password" class="form-control" placeholder="Password" name="pass" required=""  autocomplete="off" />
              </div>
              <div>
                <div> 
               <?php if(isset($sms)){echo $sms;} ?>
              </div>
                <input type="submit" name="submit" class=" btn btn-primary" value="Log In">
                <a class="reset_pass" href="#">forgot your password?</a>
              </div>
              </form>
              <div class="clearfix"></div>

              <div class="separator">
                
                <div class="clearfix"></div>
                <br />

                <div>
                  <h2><img style="width: 20%; height: 10vh;" src="images/logo1.png"> Reimeta Pre &amp; Primary School</h2>
                  <p>©2020 All Rights Reserved. </p>
                </div>
              </div>
            
          </section>
        </div>

      </div>
    </div>
  </body>
</html>
