2002-04-30 22:22:54 +00:00
|
|
|
<?php
|
|
|
|
|
2002-11-08 17:21:45 +00:00
|
|
|
function show_user_stats($user) {
|
2003-03-17 22:37:49 +00:00
|
|
|
row1("Account data for $user->name");
|
2003-03-03 19:13:16 +00:00
|
|
|
$row = sprintf("%s User since", $project);
|
2003-02-27 22:30:31 +00:00
|
|
|
row2($row, time_str($user->create_time));
|
|
|
|
row2("Total credit", $user->total_credit);
|
|
|
|
row2("Recent average credit", $user->expavg_credit);
|
2002-11-08 17:21:45 +00:00
|
|
|
if ($user->teamid) {
|
|
|
|
$result = mysql_query("select * from team where id = $user->teamid");
|
|
|
|
$team = mysql_fetch_object($result);
|
2003-02-27 22:30:31 +00:00
|
|
|
row2("Team", "<a href=team_display.php?id=$team->id>$team->name</a>");
|
2002-11-08 17:21:45 +00:00
|
|
|
} else {
|
2003-02-27 22:30:31 +00:00
|
|
|
row2("Team", "None");
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
2003-03-17 22:37:49 +00:00
|
|
|
row2("Country", $user->country);
|
|
|
|
row2("Hosts", "<a href=hosts_user.php?userid=$user->id>Click to view</a>");
|
2003-02-19 20:34:33 +00:00
|
|
|
}
|
|
|
|
|
2002-11-08 17:21:45 +00:00
|
|
|
function show_user_profile($user) {
|
2003-02-19 20:34:33 +00:00
|
|
|
if (is_valid_email_addr($user->email_addr)) {
|
|
|
|
$email_text = $user->email_addr;
|
2002-11-12 17:01:16 +00:00
|
|
|
} else {
|
2003-02-19 20:34:33 +00:00
|
|
|
$email_text = "Verification pending";
|
2002-11-12 17:01:16 +00:00
|
|
|
}
|
2003-03-06 17:42:49 +00:00
|
|
|
row1("Account information");
|
|
|
|
row2("Name", $user->name);
|
|
|
|
row2("Email address", $email_text);
|
|
|
|
row2("Country", $user->country);
|
|
|
|
row2("Postal code", $user->postal_code);
|
|
|
|
row2("", "<a href=edit_email_form.php>Edit email address</a>");
|
|
|
|
row2("", "<a href=edit_user_info_form.php>Edit other info</a>");
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
function show_hosts($user) {
|
2002-12-06 21:37:30 +00:00
|
|
|
$result = mysql_query("select * from host where userid=$user->id order by rpc_time desc");
|
2003-03-06 00:42:18 +00:00
|
|
|
start_table();
|
2002-12-06 21:37:30 +00:00
|
|
|
echo "<tr><td>Host name</td><td>Total Credit</td><td>Recent credit</td></tr>";
|
2002-04-30 22:22:54 +00:00
|
|
|
while ($host = mysql_fetch_object($result)) {
|
2002-08-13 20:00:37 +00:00
|
|
|
echo "<p>\n";
|
2002-12-06 21:37:30 +00:00
|
|
|
show_host_brief($host);
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
2002-12-06 21:37:30 +00:00
|
|
|
echo "</table>\n";
|
2002-04-30 22:22:54 +00:00
|
|
|
mysql_free_result($result);
|
|
|
|
}
|
|
|
|
|
2002-12-06 21:37:30 +00:00
|
|
|
function show_host_brief($host) {
|
|
|
|
echo "<tr>
|
2003-02-08 02:06:35 +00:00
|
|
|
<td><a href=show_host_detail.php?hostid=$host->id>$host->domain_name</a></td>
|
|
|
|
<td>$host->total_credit</td>
|
|
|
|
<td>$host->expavg_credit</td>
|
|
|
|
</tr>
|
|
|
|
";
|
2002-12-06 21:37:30 +00:00
|
|
|
}
|
|
|
|
|
2002-11-08 17:21:45 +00:00
|
|
|
// show a summary of the user.
|
|
|
|
// NOTE: This is intended to be shown only to that user.
|
|
|
|
// it has info that other users aren't supposed to see
|
|
|
|
|
|
|
|
function show_user_page_private($user) {
|
2003-03-06 17:42:49 +00:00
|
|
|
start_table();
|
2002-08-12 22:16:34 +00:00
|
|
|
show_user_profile($user);
|
2002-11-08 17:21:45 +00:00
|
|
|
show_user_stats($user);
|
2003-03-06 17:42:49 +00:00
|
|
|
end_table();
|
2002-08-05 23:20:57 +00:00
|
|
|
echo "<ul>";
|
2002-12-01 06:14:28 +00:00
|
|
|
echo "<li><a href=show_hosts.php>Your computer(s)</a></li>";
|
2003-03-06 17:42:49 +00:00
|
|
|
echo "<li><a href=prefs.php?subset=global>General preferences</a></li>";
|
|
|
|
echo "<li><a href=prefs.php?subset=project>".PROJECT." preferences</a></li>";
|
2002-08-05 23:20:57 +00:00
|
|
|
echo "</ul>";
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
2002-11-08 17:21:45 +00:00
|
|
|
|
|
|
|
function user_table_start() {
|
2003-03-06 00:42:18 +00:00
|
|
|
start_table();
|
|
|
|
echo "
|
2003-03-17 22:37:49 +00:00
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Recent average credit</th>
|
|
|
|
<th>Total credit</th>
|
|
|
|
<th>Country</th>
|
|
|
|
<th>Participant since</th>
|
|
|
|
</tr>
|
2003-03-06 00:42:18 +00:00
|
|
|
";
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function show_user_row($user) {
|
|
|
|
echo "<tr>
|
2003-03-17 22:37:49 +00:00
|
|
|
<td><a href=show_user.php?userid=$user->id>$user->name</a></td>
|
2002-11-08 17:21:45 +00:00
|
|
|
<td>$user->expavg_credit</td>
|
|
|
|
<td>$user->total_credit</td>
|
2003-03-17 22:37:49 +00:00
|
|
|
<td>$user->country</td>
|
2002-11-08 17:21:45 +00:00
|
|
|
<td>".time_str($user->create_time)."</td>
|
2003-03-17 22:37:49 +00:00
|
|
|
</tr>\n";
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
?>
|