login problem
Posted: Fri Mar 19, 2004 12:36 am
When the the password is enter correctly, it will direct to query2 page. What i wanted was that when either the staff or student enter their password correctly, it will direct to the suppose pages.Whats went wrong to my script? Could someone help me?
Code: Select all
<?
$uid=$userid;
$pwd=$userpassword;
$db=mysql_connect("localhost","@@","@@");
mysql_select_db("user");
$query1="select * from staff where userid='$userid' and userpassword='$userpassword'";
$result1=mysql_query($query1);
$numrows=mysql_num_rows($result1);
if($numrows1>0)
{
echo "<meta http-equiv='refresh' content='0;URL=search2.htm'>";
}
else
{
echo "<b>Login failed. Please try again<br>";
echo "<a href='login.htm'>Back To Login Page</a>";
}
$query2="select * from student where userid='$userid' and userpassword='$userpassword'";
$result2=mysql_query($query2);
$numrows2=mysql_num_rows($result2);
if($numrows2>0)
{
echo "<meta http-equiv='refresh' content='0;URL=view2.php'>";
}
else
{
echo "<b>Login failed. Please try again<br>";
echo "<a href='login.htm'>Back To Login Page</a>";
}
?>