0) and (verification = 0) ORDER BY recommend DESC "; break; case 'rejected': $sql = $sql . "WHERE (uotd_time IS NULL) AND (verification = -1 ) "; break; case 'uotd': $sql = $sql . "WHERE uotd_time IS NOT NULL ORDER BY uotd_time ASC "; break; case 'all': } $sql = $sql . "LIMIT " . $num . ", 1"; $result = mysql_query($sql); if (!$result) { // TODO: DB error page; } else { $profile = mysql_fetch_assoc($result); if (!$profile) { echo $sql; echo "
No more profiles in this category.

Return to ", PROJECT, " Project Management"; exit(); } if (array_key_exists('submit', $_POST)) { if ($_POST['submit'] == ACCEPT) { $vote = 1; } else if ($_POST['submit'] == REJECT) { $vote = -1; } else if ($_POST['submit'] == SKIP) { $vote = 0; } else { echo "Invalid score. Please press back and try again."; } if ($vote == -1 || $vote == 1) { $sql = "UPDATE profile SET verification = $vote WHERE userid = " . $profile['userid']; mysql_query($sql); } $header = "Location: profile_ops.php?set=" . $set . "&num=" . ($num+1); header($header); } // TODO: Make this a standard ops page head; echo "$title\n"; show_verify_tools($num, $profile); // Put the profile itself into a table to separate it visually from the controls. echo "

"; show_profile($profile['userid'], true); echo "
"; echo "

Return to ", PROJECT, " Project Management

"; } exit(); } echo "

User of the day validation

"; $result = mysql_query("SELECT * FROM profile WHERE (verification = 1) AND (uotd_time IS NULL)"); $result2 = mysql_query("SELECT * FROM profile WHERE (verification = 0) AND (uotd_time IS NULL)"); if ($result && $result2) { echo "

There are currently ", mysql_numrows($result), " profiles which have been approved for User of the Day; ", mysql_num_rows($result2), " unverified potential candidates.

"; mysql_free_result($result); mysql_free_result($result2); } else { // DATABASE ERROR PAGE; } $result = mysql_query("SELECT *, (recommend - reject) AS score FROM profile WHERE uotd_time IS NULL ORDER BY score DESC"); if ($result && mysql_numrows($result) > 0) { echo "Verify additional profiles"; } function show_verify_tools($num, $profile) { global $verification; global $set; echo " \n\n
User ID: ", $profile['userid'], "
Last selected UOTD: "; if ($profile['uotd_time']) { echo date("F jS, Y", $profile['uotd_time']); } else { echo "Never"; } echo "
", $profile['recommend'], " recommendation(s), ", $profile['reject'], " rejection(s).
"; echo "Current status: ", $verification[$profile['verification']]; echo"
"; } ?>