$username = "peopledbuser";
$password = "userpeoplepassdb";
$server = "127.0.0.1";
mysql_connect($server,$username,$password);
@mysql_select_db("people") or die ("Unable to select database \"people\"");
// if there's a variable passed in, let's grab it.
$user_id = $_GET['view'];
$have_user_info = false;
// get the person's information if available
if($user_id == "allms" || $user_id == "allphd") {
}
else if($user_id != "") {
// the almighty input validation
if(ctype_digit($user_id)) {
// do query
$query = "select * from alumni where id='$user_id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
// should only be 1 so verify
if($num != 1) {
$have_user_info = false;
} else {
// store the information for later
$have_user_info = true;
$firstName = mysql_result($result, 0, "fName");
$lastName = mysql_result($result, 0, "lName");
$ms_year = mysql_result($result, 0, "ms_year");
$advisor = mysql_result($result, 0, "advisor");
$employer = mysql_result($result, 0, "employer");
$ms_title = mysql_result($result, 0, "ms_title");
$degree = mysql_result($result, 0, "degree");
$phd_year = mysql_result($result, 0, "phd_year");
$phd_title = mysql_result($result, 0, "phd_title");
}
} else {
// just ignore it and show the normal list
$have_user_info = false;
}
}
else {
$have_user_info = false;
}
echo "\n";
?>
if($user_id == "allms" || $user_id == "allphd") {
?>
if($user_id == "allms") {
echo "
M.S. Alumni
\n";
} else if ($user_id == "allphd") {
echo "
Ph.D Alumni
\n";
}
?>
Year | Name | Advisor | Dissertation Title | Employer |
if($user_id == "allphd") {
$query = "select id, phd_year, lname, fname, advisor, phd_title, employer from alumni where phd_year > 0 order by phd_year desc, lname asc";
}
else if($user_id == "allms") {
$query = "select id, ms_year, lname, fname, advisor, ms_title, employer from alumni where ms_year > 0 order by ms_year desc, lname asc";
}
$result = mysql_query($query);
$num_rows = mysql_numrows($result);
for($i = 0; $i < $num_rows; $i++) {
$uid = mysql_result($result, $i, "id");
if($user_id == "allphd") {
$phd_year = mysql_result($result, $i, "phd_year");
} else if ($user_id == "allms") {
$ms_year = mysql_result($result, $i, "ms_year");
}
$lname = mysql_result($result, $i, "lname");
$fname = mysql_result($result, $i, "fname");
$advisor = mysql_result($result, $i, "advisor");
if($user_id == "allphd") {
$phd_title = mysql_result($result, $i, "phd_title");
} else if($user_id == "allms") {
$ms_title = mysql_result($result, $i, "ms_title");
}
$employer = mysql_result($result, $i, "employer");
print "\n";
if($user_id == "allphd") {
print "$phd_year | \n";
} else if ($user_id == "allms") {
print "$ms_year | \n";
}
print "$lname, $fname | \n";
print "$advisor | \n";
if($user_id == "allphd") {
print "$phd_title | \n";
} else if($user_id == "allms") {
print "$ms_title | \n";
}
print "$employer | \n";
print "
\n";
/* THIS WORKS UP TO HERE */
}
?>
}
else if($have_user_info) {
?>
echo "$firstName $lastName"; ?>
M.S. () - ""
echo "$advisor"; ?>
echo "$employer"; ?>
/* THIS WORKS BECAUSE IT IS ONLY SHOWING THE PERSON'S PROFILE */
?>
}
else {
?>
$phd_year_post = $_POST['phd_year'];
$ms_year_post = $_POST['ms_year'];
print "\n";
if($phd_year_post != "" || $ms_year_post != "") {
if($phd_year_post != "") {
// get all names from this semester/year
print "\n";
$phd_year_query = "select * from alumni where phd_year = '$phd_year_post' order by lname asc";
$phd_year_result = mysql_query($phd_year_query);
$phd_year_num = mysql_numrows($phd_year_result);
print "
\n";
for($i = 0; $i < $phd_year_num; $i++)
{
$phd_lname = mysql_result($phd_year_result, $i, "lname");
$phd_fname = mysql_result($phd_year_result, $i, "fname");
$phd_uid = mysql_result($phd_year_result, $i, "id");
$phd_advisor = mysql_result($phd_year_result, $i, "advisor");
if($phd_advisor == "")
{
$phd_advisor = "n/a";
}
print "- $phd_lname, $phd_fname - $phd_advisor
\n";
}
print "
\n";
print "
";
}
}
else {
$phd_year_query = "select distinct phd_year from alumni order by phd_year desc";
$phd_year_result = mysql_query($phd_year_query);
$phd_year_num = mysql_numrows($phd_year_result);
?>
} //if $phd_year != null else
?>
print "\n";
if($ms_year_post != "" || $phd_year_post != "") {
if($ms_year_post != "") {
// get all names from this semester/year
print "\n";
$ms_year_query = "select * from alumni where ms_year = '$ms_year_post' order by lname asc";
$ms_year_result = mysql_query($ms_year_query);
$ms_year_num = mysql_numrows($ms_year_result);
print "
\n";
for($i = 0; $i < $ms_year_num; $i++) {
$ms_lname = mysql_result($ms_year_result, $i, "lname");
$ms_fname = mysql_result($ms_year_result, $i, "fname");
$ms_uid = mysql_result($ms_year_result, $i, "id");
$ms_advisor = mysql_result($ms_year_result, $i, "advisor");
if($ms_advisor == "") {
$ms_advisor = "n/a";
}
print "- $ms_lname, $ms_fname - $ms_advisor
\n";
}
print "
\n";
print "
";
}
}
else {
$ms_year_query = "select distinct ms_year from alumni order by ms_year desc";
$ms_year_result = mysql_query($ms_year_query);
$ms_year_num = mysql_numrows($ms_year_result);
?>
}// if $ms_year != null else...
// $query = "select * from alumni order by lName asc";
// $result = mysql_query($query);
// $num = mysql_numrows($result);
// for ($i = 0; $i < $num; $i++) {
// $firstName = mysql_result($result, $i, "fName");
// $lastName = mysql_result($result, $i, "lName");
// $advisor = mysql_result($result, $i, "advisor");
// $id = mysql_result($result, $i, "id");
// print "
$lastName, $firstName | $advisor |
\n";
// }
?>
} // if($have_user_info)
?>
include('includes/people_menu.html'); ?>
include('includes/people_footer.php'); ?>