/**
* UserInfo.php
*
* This page is for users to view their account information
* with a link added for them to edit the information.
*
* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated: August 26, 2004
*/
include("include/session.php");
?>
View User Information
/* Requested Username error checking */
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
!eregi("^([0-9a-z])+$", $req_user) ||
!$database->usernameTaken($req_user)){
die("Username not registered");
}
/* Logged in user viewing own account
if(strcmp($session->username,$req_user) == 0){
echo "
My Account
";
}
/* Visitor not viewing own account
else{
echo "
User Info
";
}
*/
/* Display requested user information */
//$req_user_info = $database->getUserInfo($req_user);
$req_user_info = mysql_fetch_array(mysql_query("SELECT * FROM `users` LEFT JOIN `memberlist` ON users.username=memberlist.mandrewid WHERE users.username='".$req_user."'"));
switch($req_user_info[mandrewid])
{
case "sfarring":
$title = "staff member";
break;
case "wnace":
$title = "professor";
break;
default:
$deglvl = ($req_user_info['deglvl'] == "Cho")? '': $req_user_info['deglvl'];
$title = $deglvl." student";
}
//$degLvlTxt = ($req_user_info['deglvl'] && $req_user_info['deglvl'] != "Cho")? "".$req_user_info['deglvl']." ".$title."" : $title;
$concTxt = ($req_user_info['ececonc'] && $req_user_info['ececonc'] != "Choose.")? ", with a focus in ".$req_user_info['ececonc']."" : "";
$headlineTxt = ($req_user_info['headline'])? "".$req_user_info['headline']."" : "".$req_user_info['mfirstname']." has not posted a headline yet.";
$phoneTxt = ($req_user_info['phone'])? "".$req_user_info['phone']."" : "".$req_user_info['mfirstname']." has not added a phone number yet.";
$siteTxt = ($req_user_info['site'])? "".$req_user_info['site']."" : "".$req_user_info['mfirstname']." has not added a website yet.";
$userPronoun = ($req_user_info['gender'] && $req_user_info['gender']!="Choose")? (($req_user_info['gender'] == 'male')? "He":"She")." was" : "They were";
switch($req_user_info[userlevel])
{
case 2: // Regular / Validating
$authLvl = "Members";
break;
case 9:
$authLvl = "Administrators";
break;
default:
$authLvl = "Validating";
break;
}
// Check if we should display the user info
if($req_user_info['userlevel'] <= 1)
{
/* logged in user viewing own account */
if(strcmp($session->username,$req_user) == 0)
{
echo("
".$req_user_info['username']."(".$authLvl.")
Click validation link in the welcome email.
");
}
else
{
echo("
".$req_user_info['username']."(".$authLvl.")
");
}
}
else if(!$req_user_info['mandrewid'])
{
/* logged in user viewing own account */
if(strcmp($session->username,$req_user) == 0)
{
echo("
".$req_user_info['username']."(".$authLvl.")
Either you are not a listed HKN member, or admin validation is required. Contact the webmaster if you feel this is an error.
");
}
else
{
echo("
".$req_user_info['username']."(".$authLvl.")
This is not a listed HKN member.
");
}
}
else
{
echo("
".$req_user_info['mfirstname']." ".$req_user_info['mlastname']."(".$authLvl.")
".$headlineTxt."
");
/* If logged in user viewing own account, give link to edit */
if(strcmp($session->username,$req_user) == 0)
{
echo "Edit Account Information ";
}
echo("
ACADEMIC / PROFESSIONAL INFO
".$req_user_info[mfirstname]." was an Electrical & Computer Engineering ".$title." at Carnegie Mellon University".$concTxt.". ".$userPronoun." inducted into Eta Kappa Nu (Sigma chapter) in the ".strtoupper($req_user_info[indsemester])." semester.
CONTACT INFO
".$req_user_info[mandrewid]." // ANDREW
".$phoneTxt."
".$siteTxt."
");
}
/**
* Note: when you add your own fields to the users table
* to hold more information, like homepage, location, etc.
* they can be easily accessed by the user info array.
*
* $session->user_info['location']; (for logged in users)
*
* ..and for this page,
*
* $req_user_info['location']; (for any user)
*/
/* Link back to main */
//echo " Back To [Main] ";
?>