<?php
session_start(); // Starting Session
error_reporting(0);

$error=''; // Variable To Store Error Message

/*if (empty($_POST['name']) || empty($_POST['pass'])) {

$error = "Username or Password is invalid";

}*/
if ( ! empty( $_POST['name'] ) ) {
include_once("connection.php");	
$username=$_POST['name'];
$password=$_POST['pass'];



// SQL query to fetch information of registerd users and finds user match.
$sql ="select Admin_Id from tbl_admin where User_Name='$username' AND Pwd='$password'";
$query=mysqli_query($conn, $sql) or die("Error");
$rows = mysqli_num_rows($query);
if ($rows == 1) {
	
	 $row= mysqli_fetch_assoc($query);
$_SESSION['login_user']=$row['Admin_Id'];


echo "<script type='text/javascript'>window.location.href = 'superadmin.php';</script>";
 // Redirecting To Other Page
	
} 
else
{

 echo "<script type='text/javascript'>alert('UserName or Password Wrong...........!');</script>";
echo "<script type='text/javascript'>window.location.href = 'index.php';</script>";
	
}

mysql_close($connection); // Closing Connection
}

?>
