2002-04-30 22:22:54 +00:00
|
|
|
<?php
|
|
|
|
|
2002-11-08 17:21:45 +00:00
|
|
|
function show_user_stats($user) {
|
2002-12-06 21:37:30 +00:00
|
|
|
echo TABLE2."\n";
|
2002-12-18 20:37:42 +00:00
|
|
|
echo "<tr>".TD2.LG_FONT."<b>User Stats:</b></font></td></tr>\n";
|
|
|
|
$row = sprintf("<b>%s user since: </b>", $project);
|
2002-11-08 17:21:45 +00:00
|
|
|
row($row, time_str($user->create_time));
|
|
|
|
row("<b>Total credit: </b>", $user->total_credit);
|
2002-12-01 06:14:28 +00:00
|
|
|
row("<b>Recent average credit: </b>", $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);
|
|
|
|
row("<b>Team: </b>", "<a href=team_display.php?id=$team->id>$team->name</a>");
|
|
|
|
} else {
|
2002-12-06 21:37:30 +00:00
|
|
|
row("<b>Team: </b>", "None");
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
2002-12-06 21:37:30 +00:00
|
|
|
echo "</table>\n";
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function show_user_profile($user) {
|
2002-12-06 21:37:30 +00:00
|
|
|
echo TABLE2."\n";
|
|
|
|
echo "<tr>".TD2.LG_FONT."<b>User Information:</b></font></td></tr>\n";
|
|
|
|
row("<b>email address</b>", $user->email_addr);
|
2002-12-01 06:14:28 +00:00
|
|
|
row("<b>country</b>", $user->country);
|
|
|
|
row("<b>postal (ZIP) code</b>", $user->postal_code);
|
2002-12-06 21:37:30 +00:00
|
|
|
echo "<tr><td align=right><a href=edit_user_info.php>Edit user information</a></td>\n";
|
2002-11-12 17:01:16 +00:00
|
|
|
if (1) {
|
|
|
|
echo "<td><br></td></tr>\n";
|
|
|
|
} else {
|
|
|
|
echo "<td align=center><a href=change_password.php>Change Password</a></td></tr>\n";
|
|
|
|
}
|
2002-12-06 21:37:30 +00:00
|
|
|
echo "</table>\n";
|
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");
|
|
|
|
echo VISTABLE."\n";
|
|
|
|
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>
|
2002-12-18 20:37:42 +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) {
|
2002-12-01 06:14:28 +00:00
|
|
|
echo "<table cellpadding=4>\n";
|
2002-08-12 22:16:34 +00:00
|
|
|
show_user_profile($user);
|
2002-11-08 17:21:45 +00:00
|
|
|
show_user_stats($user);
|
2002-12-01 06:14:28 +00:00
|
|
|
echo "</table>\n";
|
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>";
|
|
|
|
echo "<li><a href=prefs.php>Your 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() {
|
2002-12-06 21:37:30 +00:00
|
|
|
echo VISTABLE."
|
2002-11-08 17:21:45 +00:00
|
|
|
<tr><th>Name</th><th>Average credit</th><th>Total credit</th>
|
|
|
|
<th>Participant since</th></tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_user_row($user) {
|
|
|
|
echo "<tr>
|
|
|
|
<td>$user->name</td>
|
|
|
|
<td>$user->expavg_credit</td>
|
|
|
|
<td>$user->total_credit</td>
|
|
|
|
<td>".time_str($user->create_time)."</td>
|
|
|
|
<tr>\n";
|
|
|
|
}
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
?>
|