<?php
  ob_start();
  session_start();
  include('dbconnection.php');
  $email=$_POST['email'];
  $password=$_POST['password'];
  $sql="select * from admin where mailid='$email' and password='$password'";
  $result=mysql_query($sql);
  if($row=mysql_fetch_assoc($result))
	{
  	$_SESSION['uid']=$row['admin_id'];
	$_SESSION['name']=$row['mailid'];
  	$url='home.php';
  	echo '<script language="javascript">location.href=\'' . $url. '\'</script>';
  }
  else
  {
  	echo '<script language="javascript">alert("Invalid Mail Id and Password");location.href=\'' . $_SERVER['HTTP_REFERER'] . '\'</script>';
  }
?>