File: profile_menu.php

package info (click to toggle)
boinc 5.4.11-4%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 21,440 kB
  • ctags: 16,986
  • sloc: cpp: 70,682; ansic: 45,747; php: 35,513; xml: 10,487; sh: 9,324; python: 4,291; makefile: 1,958; asm: 1,258; perl: 914; sql: 395; csh: 126; pascal: 124
file content (110 lines) | stat: -rw-r--r-- 3,011 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php

require_once("../inc/db.inc");
require_once("../inc/util.inc");
require_once("../inc/profile.inc");
require_once("../inc/uotd.inc");

db_init();

$cmd = $_GET['cmd'];
if ($cmd) {
    execute_command($cmd);
    exit();
}

page_head("Profile Zone");


start_table_noborder();
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>");

$today = getdate(time());
$UOTD_heading = "User of the Day -- " . $today['month'] . " " . $today['mday'] . ", " . $today['year'];
row1($UOTD_heading);
echo "<tr><td>";
    $profile = get_current_uotd();
    if ($profile) {
        $user = lookup_user_id($profile->userid);
        echo uotd_thumbnail($profile, $user);
        echo user_links($user)."<br>";
        echo sub_sentence(strip_tags($profile->response1), ' ', 150, true);
    }

echo "</td></tr>";

rowify("<br>");
row1("User Profile Explorer");
echo "<tr><td>
    <ul>
    <li>View the <a href=" . URL_BASE . "user_profile/user_gallery_1.html>User Picture Gallery</a>.
    <li>Browse profiles <a href=" . URL_BASE . "user_profile/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 <i></i>:<br>
";

include( PROFILE_PATH . "profile_alpha.html" );

echo "<br></ul></td></tr>";

rowify("<br>");
row1("Search user names");

rowify("
    <form action=user_search_action.php method=GET>
    <input name=search_string>
    <input type=submit value=OK>
    </form>
");
row1("Search profile text");
rowify("
    <form action=profile_search_action.php method=GET>
    <input name=search_string>
    <input type=submit value=OK>
    </form>
");
end_table();

page_tail();

function execute_command($cmd) {
    // Request for a random profile.
    //
    if ($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.<br>";
            exit();
        }

        shuffle($userIds);
        header("Location: " . URL_BASE . "view_profile.php?userid=" . $userIds[0]);
        exit();
    }
}

?>