"); exit(); } $user = get_user_from_id($userid); if (!$user) { profile_error_page("No user exists for that ID, or there was a database error.

"); exit(); } // Check for recommendation or rejection votes. if ($_POST['recommend']) { process_results("recommend"); exit(); } else if ($_POST['reject']) { process_results("reject"); exit(); } $result = mysql_query("SELECT * FROM profile WHERE userid = $user->id"); if ($result) { $profile_info = mysql_fetch_array($result, MYSQL_ASSOC); } else { profile_error_page("No profile exists for that user, or there was a database error.

"); exit(); } $logged_in_user = get_logged_in_user(false); // (false) since anyone can look at profiles. $can_edit = $logged_in_user && $user->id == $logged_in_user->id; page_head("User Profile: ".$user->name); if ($can_edit) { echo "[Edit Your Profile]"; } start_table_noborder(); echo ""; show_profile_summary(); echo ""; show_profile_heading1(); echo "", $profile_info['response1'], "

"; show_profile_heading2(); echo "", $profile_info['response2'], ""; end_table(); page_tail(); function show_profile_summary() { global $user; global $profile_info; global $can_edit; echo " \n \n

$user->name

"; if (!$can_edit) { show_buttons(); } echo "
\n"; // Only display an image if the user has uploaded one. if (file_exists(IMAGE_PATH . $user->id . '_sm.jpg')) { echo " id , '.jpg' . "\">id , '_sm.jpg' . "\">\n"; } echo " Country: ", $user->country, "  Language: ", $profile_info['language'], "
Email: email_addr, "\">", $user->email_addr, "
Total Credit: ", $user->total_credit, "
"; if ($user->teamid) { $result = mysql_query("select * from team where id = $user->teamid"); $team = mysql_fetch_object($result); echo "Team: id>$team->name
"; } echo " Date Registered: ", date_str($user->create_time), "

\n"; } function show_buttons() { global $userid; echo "

what is recommend?
what is vote to reject?
"; } function process_results($vote) { global $userid; if ($vote != "recommend" && $vote != "reject") { echo "Invalid vote type.
"; exit(); } $result = mysql_query("SELECT * FROM profile WHERE userid = $userid"); $profile = mysql_fetch_array($result); $newValue = $profile[$vote] + 1; $newresult = mysql_query("UPDATE profile SET $vote = $newValue WHERE userid = $userid"); page_head("Vote Recorded"); start_table_noborder(); row1("Thank you"); if ($vote == "recommend") { rowify("Your recommendation has been recorded."); } else { rowify("Your vote to reject has been recorded."); } end_table(); echo "
Return to profile."; page_tail(); } ?>