
<?php
//session_start();
include 'dbc.php';


$user_name=$_POST["user_name"];
$user_pass=$_POST["user_pass"];

$sql="Select * from users where username='$user_name' and userpwd='$user_pass'";
$data=mysql_query($sql) or die ("Error:" . mysql_error());
$rows=mysql_num_rows($data);
$user_data=mysql_fetch_array($data);
  if($rows==0)
    {
	   echo "Wrong Id or Password";
	  }
	  else
	  {
	  $_SESSION["userid"]=$user_data["userid"];
	  $_SESSION["username"]=$user_data["username"];
	  $_SESSION["usertype"]=$user_data["usertype"];
	  
	  if($_SESSION["usertype"]=="Admin")
	  {
	  header("location:add_users.php");
	  }
	  elseif ($_SESSION["usertype"]=="User")
	  {
	  header("location:admission_form_raheem.php");
	  }
	  elseif ($_SESSION["usertype"]=="Teacher")
	  {
	  header("location:parents.php");
	  }
	  elseif ($_SESSION["usertype"]=="Sub User")
	  {
	  header("location:admission_form_raheem.php");
	  }
	  elseif ($_SESSION["usertype"]=="Inventory")
	  {
	  header("location:inventory.php");
	  }
	  }
?>
<a href="signin.php"> Back </a>