<?PHP 
include("database.php");
//echo "hiii";
$username = $_POST['user_name'];
//echo $username;
$password = $_POST['password'];  
//echo $password; 
$result = mysql_query("select * from adminlogin where username='$username' AND password ='$password'"); 
//echo $result;
$row = mysql_fetch_array($result);
//echo $row;
$rowCheck = mysql_num_rows($result); 
echo $rowCheck;
//echo $rowCheck;

	if($rowCheck > 0)
	{  
		 $login="success";
		 session_start();
		 $_SESSION['user']=$username;
		 $_SESSION['pass']= $password;
	 
		 $_SESSION['userid']=$row['id'];
		
	?>
			<script language="javascript" type="text/javascript">
			window.location="adminhome.php"
			</script>
	<?php
	}
    else
	{
	 	$login="fail";
	?>
		<script language="javascript" type="text/javascript">
        alert("Enter Correct Username And Password");
        window.location="adminlogin.php"
        </script>
	<?php
	}                                    
?>