next up previous
Next: portfolio.php Up: Appendix I: Code Previous: interface.php

viewer.php

<?

/*connection to MySQL account, selection of database, accessing table of users
and passwords*/

//magnesium.tjhsst.edu is the alias for mysql.tjhsst.edu

$link = mysql_connect("magnesium.tjhsst.edu", "jhess", "939525");
mysql_select_db("jhess", $link);

$query = "select * from portfolio";
$result = mysql_query($query, $link);
$num_rows = mysql_num_rows($result);

//check for correct password
//only users are Mr. Latimer and Yosemite Sam

if ($ViewMethod=="Mr. Latimer")
{
 if ($password=="compsys")
  header("Location: portfolio.php?ViewMethod=$ViewMethod&password=compsys");
 else header ("Location: reject.php");
}

if ($ViewMethod=="Yosemite Sam")
{
 if ($password=="boots")
  header("Location: portfolio.php?ViewMethod=$ViewMethod&password=boots");
 else header ("Location: reject.php");
}

?>


Joseph B. Hess 2003-06-13