If you haven't already, you can create your own user profile for others to see!
");
rowify("
");
$today = getdate(time());
$UOTD_heading = "User of the Day -- " . $today['month'] . " " . $today['mday'] . ", " . $today['year'];
row1($UOTD_heading);
echo "
";
include("uotd.html");
echo " |
";
rowify("
");
row1("User Profile Explorer");
echo "
|
";
rowify("
");
row1("Name Search");
rowify("
");
end_table();
echo "
";
end_table();
page_tail();
function execute_command() {
// Request for a random profile.
if ($_GET['cmd'] == "rand") {
if ($_GET['pic'] == 0) {
$result = mysql_query("SELECT userid FROM profile WHERE has_picture = 0");
} else if ($_GET['pic'] == 1) {
$result = mysql_query("SELECT userid FROM profile WHERE has_picture = 1");
} else if ($_GET['pic'] == -1) {
$result = mysql_query("SELECT userid FROM profile");
}
while ($row = mysql_fetch_row($result)) {
$userIds[] = $row[0];
}
if (count($userIds) == 0) {
echo "No profiles matched your query.
";
exit();
}
shuffle($userIds);
header("Location: " . URL_BASE . "view_profile.php?userid=" . $userIds[0]);
exit();
}
else if ($_GET['cmd'] == "search") {
if ($_GET['name']) {
$result = mysql_query("SELECT id FROM user WHERE name LIKE \"%" . $_GET['name'] . "%\"");
while($row = mysql_fetch_assoc($result)) {
$result2 = mysql_query("SELECT userid FROM profile WHERE userid = " . $row['id']);
if ($result2) {
$row2 = mysql_fetch_assoc($result2);
if ($row2['userid']) {
$members[] = $row2['userid'];
}
}
}
show_search_results($members);
}
}
}
// TODO: This function should generate multiple pages, and should possibly take the number
// of results to display from a user-input parameter. Look at build_profile_pages for an
// example of a good way to do this (albeit writing to a file in that case).
function show_search_results($members) {
page_head("Profile Search Results");
if (count($members) > 0) {
show_user_table($members, 0, 20, 2);
} else {
echo "No profiles matched your query.
";
}
page_tail();
}
?>