2003-07-11 22:33:59 +00:00
|
|
|
<?php
|
|
|
|
|
2003-08-22 05:36:25 +00:00
|
|
|
require_once("db.inc");
|
2003-07-11 22:33:59 +00:00
|
|
|
require_once("util.inc");
|
2003-07-15 22:29:39 +00:00
|
|
|
require_once("project_specific/project.inc");
|
2003-07-17 23:58:42 +00:00
|
|
|
require_once("profile.inc");
|
|
|
|
|
2003-07-11 22:33:59 +00:00
|
|
|
|
|
|
|
db_init();
|
|
|
|
|
|
|
|
if ($_GET['cmd']) {
|
|
|
|
execute_command();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
page_head("Profile Zone");
|
|
|
|
|
|
|
|
start_table_noborder();
|
2003-07-15 19:04:55 +00:00
|
|
|
rowify("
|
|
|
|
User profiles provide a way for individuals to share backgrounds and opinions with the " . PROJECT . " community. Explore the diversity of your fellow searchers, and contribute your own views for others to enjoy.
|
|
|
|
<p>
|
|
|
|
If you haven't already, you can <a href=create_profile.php>create your own user profile</a> for others to see!
|
|
|
|
");
|
2003-08-07 00:44:54 +00:00
|
|
|
rowify("<br>");
|
|
|
|
|
|
|
|
$today = getdate(time());
|
|
|
|
$UOTD_heading = "User of the Day -- " . $today['month'] . " " . $today['mday'] . ", " . $today['year'];
|
|
|
|
row1($UOTD_heading);
|
|
|
|
echo "<tr><td>";
|
|
|
|
include("uotd.html");
|
|
|
|
echo "</td></tr>";
|
|
|
|
|
2003-07-15 19:04:55 +00:00
|
|
|
rowify("<br>");
|
|
|
|
row1("User Profile Explorer");
|
2003-07-22 20:36:54 +00:00
|
|
|
echo "<tr><td>
|
2003-07-11 22:33:59 +00:00
|
|
|
<ul>
|
2003-07-15 19:04:55 +00:00
|
|
|
<li>View the <a href=" . PROFILE_PATH . "user_gallery_1.html>User Picture Gallery</a>.
|
|
|
|
<li>Browse profiles <a href=" . PROFILE_PATH . "profile_country.html>by country</a>.
|
|
|
|
<li>Browse profiles <a href=" . $_SERVER['PHP_SELF'] . "?cmd=rand&pic=-1>at random</a>,
|
2003-07-11 22:33:59 +00:00
|
|
|
<a href=" . $_SERVER['PHP_SELF'] . "?cmd=rand&pic=1>at random with pictures</a>, or
|
|
|
|
<a href=" . $_SERVER['PHP_SELF'] . "?cmd=rand&pic=0>at random without pictures</a>.
|
|
|
|
|
2003-07-22 20:36:54 +00:00
|
|
|
<li>Alphabetical profile listings <i></i>:<br>";
|
|
|
|
include "profile_alpha.html";
|
|
|
|
echo "<br></ul></td></tr>";
|
2003-07-15 19:04:55 +00:00
|
|
|
|
|
|
|
rowify("<br>");
|
|
|
|
row1("Name Search");
|
|
|
|
rowify("<br>");
|
2003-07-11 22:33:59 +00:00
|
|
|
end_table();
|
|
|
|
|
2003-07-22 20:36:54 +00:00
|
|
|
|
2003-07-11 22:33:59 +00:00
|
|
|
echo "
|
|
|
|
<form action=", $_SERVER['PHP_SELF'], " method=\"GET\">
|
|
|
|
<input type=\"hidden\" name=\"cmd\" value=\"search\">
|
|
|
|
<input type=\"text\" name=\"name\">
|
|
|
|
<input type=\"submit\" value=\"Submit\">
|
|
|
|
</form>";
|
|
|
|
|
|
|
|
end_table();
|
|
|
|
page_tail();
|
|
|
|
|
|
|
|
function execute_command() {
|
|
|
|
|
|
|
|
// Request for a random profile.
|
|
|
|
if ($_GET['cmd'] == "rand") {
|
2003-07-15 19:04:55 +00:00
|
|
|
|
|
|
|
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) {
|
2003-07-11 22:33:59 +00:00
|
|
|
$result = mysql_query("SELECT userid FROM profile");
|
|
|
|
}
|
|
|
|
|
|
|
|
while ($row = mysql_fetch_row($result)) {
|
|
|
|
$userIds[] = $row[0];
|
|
|
|
}
|
|
|
|
|
2003-07-17 18:22:15 +00:00
|
|
|
if (count($userIds) == 0) {
|
|
|
|
echo "No profiles matched your query.<br>";
|
|
|
|
exit();
|
|
|
|
}
|
2003-07-17 20:41:44 +00:00
|
|
|
|
2003-07-11 22:33:59 +00:00
|
|
|
shuffle($userIds);
|
|
|
|
|
2003-07-17 18:22:15 +00:00
|
|
|
header("Location: " . URL_BASE . "view_profile.php?userid=" . $userIds[0]);
|
2003-07-11 22:33:59 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ($_GET['cmd'] == "search") {
|
|
|
|
|
|
|
|
if ($_GET['name']) {
|
2003-07-15 19:04:55 +00:00
|
|
|
$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'];
|
|
|
|
}
|
2003-07-11 22:33:59 +00:00
|
|
|
}
|
|
|
|
}
|
2003-07-15 19:04:55 +00:00
|
|
|
|
|
|
|
show_search_results($members);
|
2003-07-11 22:33:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-07 00:44:54 +00:00
|
|
|
// 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).
|
|
|
|
|
2003-07-15 19:04:55 +00:00
|
|
|
function show_search_results($members) {
|
|
|
|
page_head("Profile Search Results");
|
|
|
|
|
|
|
|
if (count($members) > 0) {
|
2003-08-07 00:44:54 +00:00
|
|
|
show_user_table($members, 0, 20, 2);
|
2003-07-15 19:04:55 +00:00
|
|
|
} else {
|
|
|
|
echo "No profiles matched your query.<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
page_tail();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-07-15 22:29:39 +00:00
|
|
|
?>
|