<?php
  include "include/dbcon.php";
?>
<?php
  global $conn;
  
  $pid = $_POST["loginId"];
  $ppass = $_POST["pass"];
  $query = "SELECT * FROM attendace_staff WHERE id='$pid' AND password='$ppass'";
  $result = mysqli_query($conn,$query);
  $num = mysqli_num_rows($result);

  if($num>0){
	$_SESSION["teacherSessionId"]=$pid;
    header("location: main.php");
  }else{
	$_SESSION["errmsg"] = "<span style='color:#FF0000;background-color:#FFFFFF;padding:5px 5px 5px 5px'>#ERROR: invalid password</span>";
    header("location: index.php?pg=lg");
  }
?> 