<?php
include('connection.php');
//session_save_path('/tmp/');
session_start();
if(isset($_POST['signin']))
{
		$username=mysqli_real_escape_string($con, $_POST['username']);
		$password=mysqli_real_escape_string($con, $_POST['password']);
		//$password=md5($password);
	    $result=mysqli_query($con,"select * from admin where username='$username' and password='$password'");  
		if(mysqli_num_rows($result)==1)
		{ 
			$row1=mysqli_fetch_assoc($result);
			
				$_SESSION['loggedin']=$row1['id']; 
			    header("location:index.php");
			
		}
		else
		{   
				echo "<script>alert('wrong credentials');</script>";
		}
		
   
}

?>


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Admin Login</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
  <!-- icheck bootstrap -->
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
</head>
<body class="hold-transition login-page">
<div class="login-box">
  <!-- /.login-logo -->
  <div class="card card-outline">
    <div class="card-header text-center" style="background-color:rgb(27 125 151);color:white;">
      <h1 class="h1"  style="font-size:24px;"><b>Admin Login</b></h1>
    </div></br>
    <div class="card-header text-center">
      <form method="post">
        <div class="input-group mb-3">
          <input type="text" name="username" class="form-control" placeholder="Login ID" required>
          <div class="input-group-append">
            <div class="input-group-text">
            </div>
          </div>
        </div>
        <div class="input-group mb-3">
          <input type="password" name="password" class="form-control" placeholder="Password" required>
          <div class="input-group-append">
            <div class="input-group-text">
            </div>
          </div>
        </div>
        <div class="row">
		   <div class="col-4">
		   </div>
          <div class="col-4">
              <input type="submit" name="signin" value="Login" class="btn btn-info">
            
          </div>
		  <div class="col-4">
		   </div>
        </div>
      </form>
    </div>
  </div>
</div>
<!-- /.login-box -->

<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
</body>
</html>
