<?php 
$t="a";
require'includes/head.php';?>
<h3>AdminLogin</h3><hr /><br><br>	
	<form action="login.php?try" method="POST">
	<input  name="user" type="text" placeholder="Username"  required style="font-size:16pt;width:8em; background-color:#ffffff; border-style:none"><br><br>
	<input  name="pass" type="password" placeholder="Password" required style="font-size:16pt;width:8em; background-color:#ffffff; border-style:none"><br><br>
	<button  class="button" id="submit" style="font-size:16pt;width:8em; background-color:#000000; border-style:none; color:#ffffff">LOGIN
	</button>
	</form>					
<?php
    	require'../includes/foot.php';
		session_start();
		if( isset($_REQUEST['try']) ) {
				
				require'../connections/conn.php';
				
				$user=($_POST['user']);
				$pass=($_POST['pass']);
				
				$options1 = ['cost1' => 10,'salt1' => '91BnO-2011-HaW89'];
				$pass=crypt($pass, $options1['salt1']);
				
				$sql2 = "SELECT * FROM admin WHERE username='$user' AND password='$pass'";
				$result = $conn->query($sql2 );
				
				
				if($users1=mysqli_fetch_array($result)){
					$_SESSION['admin_id'] = $users1['a_id'];
					echo "<script type='text/javascript'>
		           window.location.href='home.php'
		        </script>";
				}
				echo  "<script type='text/javascript'>";
				echo"alert('Your Name or Password is Incorrect')";
				echo"</script>";
		}
	
	?>