mirror of https://github.com/BOINC/boinc.git
Fixed random profile viewing functionality, and added name search.
svn path=/trunk/boinc/; revision=1678
This commit is contained in:
parent
687a002d83
commit
6b1e8eaa69
|
@ -2,6 +2,7 @@
|
|||
|
||||
require_once("util.inc");
|
||||
require_once("project.inc");
|
||||
require_once("gallery.inc");
|
||||
|
||||
db_init();
|
||||
|
||||
|
@ -12,21 +13,32 @@ if ($_GET['cmd']) {
|
|||
|
||||
page_head("Profile Zone");
|
||||
|
||||
|
||||
|
||||
start_table_noborder();
|
||||
row1("User Profiles");
|
||||
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!
|
||||
");
|
||||
rowify("<br>");
|
||||
row1("User Profile Explorer");
|
||||
rowify("
|
||||
<ul>
|
||||
<li>View the <a href=" . PROFILE_PATH . "user_gallery_1.html>User Picture Gallery</a>. <a href=generate_picture_pages.php>[Generate]</a>
|
||||
<li>Browse profiles <a href=" . PROFILE_PATH . "profile_country.html>by country</a>. <a href=generate_country_pages.php>[Generate]</a>
|
||||
<li>Browse profiles <a href=" . $_SERVER['PHP_SELF'] . "?cmd=rand>at random</a>,
|
||||
<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>,
|
||||
<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>.
|
||||
|
||||
<li>Alphabetical profile listings:<br>A B C D E F G H I J K L M N O P Q R S T U V W X Y Z<BR>
|
||||
<li>Alphabetical profile listings <i>(Coming Soon)</i>:<br>A B C D E F G H I J K L M N O P Q R S T U V W X Y Z<BR>
|
||||
</ul>");
|
||||
row1("Search");
|
||||
|
||||
// TODO: Create management page with links to generate galleries.
|
||||
// <a href=generate_picture_pages.php>[Generate]</a>
|
||||
// <a href=generate_country_pages.php>[Generate]</a>
|
||||
|
||||
rowify("<br>");
|
||||
row1("Name Search");
|
||||
rowify("<br>");
|
||||
end_table();
|
||||
|
||||
echo "
|
||||
|
@ -43,13 +55,12 @@ function execute_command() {
|
|||
|
||||
// Request for a random profile.
|
||||
if ($_GET['cmd'] == "rand") {
|
||||
if ($_GET['pic']) {
|
||||
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'] == 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");
|
||||
}
|
||||
|
||||
|
@ -66,16 +77,35 @@ function execute_command() {
|
|||
else if ($_GET['cmd'] == "search") {
|
||||
|
||||
if ($_GET['name']) {
|
||||
$result = mysql_query("SELECT id FROM user WHERE name = " . $_GET['name']);
|
||||
if ($result) {
|
||||
while ($row = mysql_fetch_row($result)) {
|
||||
echo "<br>ID ", $row['0'], " has a name that matches your query.";
|
||||
$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'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "No names matched your query.<br>";
|
||||
}
|
||||
|
||||
show_search_results($members);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show_search_results($members) {
|
||||
page_head("Profile Search Results");
|
||||
|
||||
if (count($members) > 0) {
|
||||
show_user_table($members, 0, 10, 2);
|
||||
} else {
|
||||
echo "No profiles matched your query.<br>";
|
||||
}
|
||||
|
||||
page_tail();
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue