<?
session_start();
include("opendb.php");
$result=mysqli_query($db,"select * from logindb") or die(mysqli_error());
$row=mysqli_fetch_array($result);
session_register("user");
print"<body bgcolor=silver>";
if($log==$row[0] && $pswd==$row[1])
{
 $user=$log;
 print "<script>document.location='index1.htm' </script>";
 print "<font face=verdana size=2 color=green>You are logged in as $user </font>";
}
else if($log=='staff')
{
 $user=$log;
 print "<script>document.location='index2.htm' </script>";
 print "<font face=verdana size=2 color=green>You are logged in as $user </font>";
}

else
{
 print "<script>alert('Invalid Login'); history.back(1);</script>";
 return;
}
?>
