}
// the form is then redirected (look for the stars above) to blah.php
// the following code would be enclosed by ... ?> for php but if I do, then
//you wouldnt be able to see it :)
$link=mysql_connect("mysql.tjhsst.edu", "syousuf", "xxxxx"); // connects to mySql
mysql_select_db("syousuf", $link);
$query= "select * from stores";
$result = mysql_query($query, $link);
$num_rows = mysql_num_rows($result);
if($ViewMethod=="DC") // checks distribution center password
{
if($pass=="66666")
header("Location: action2.php"); // if correct, send to this page
else
header("Location: blah2.php"); // if incorrect, sent here
}
else
{
for($i=0; $i<$num_rows; $i++) // finds the corresponding data in database
{
$row=mysql_fetch_array($result);
$num=$row["Number"];
$realpass=$row["Password"];
if($num==$ViewMethod)
{
if($realpass==$pass) // checks the passwords
header("Location: action.php"); // if correct, go here
else
header("Location: blah2.php"); // if incorrect, go here
}
}
}
// action.php and action2.php are the pages where the stores/dc work
// here is the code for blah2.php (the page where for incorrect password)
{
Print("Error - incorrect password - Will Refresh Automatically");
echo< 'meta http-equiv="refresh" content="2; URL=hello.php"'> // refreshes page automatically in four seconds
Click here if browser does not refresh
}