2003-03-17 22:37:49 +00:00
|
|
|
<?php
|
2003-03-19 21:01:32 +00:00
|
|
|
// show all the hosts for a user.
|
|
|
|
// if $userid is absent, show hosts of logged-in user
|
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once("../inc/db.inc");
|
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/host.inc");
|
2004-07-23 01:07:18 +00:00
|
|
|
require_once("../inc/cache.inc");
|
2003-03-17 22:37:49 +00:00
|
|
|
|
|
|
|
db_init();
|
|
|
|
$userid = $_GET["userid"];
|
2003-03-19 21:01:32 +00:00
|
|
|
if ($userid) {
|
2004-07-23 01:07:18 +00:00
|
|
|
$cache_args = "userid=$userid";
|
2004-11-18 20:01:12 +00:00
|
|
|
$caching=true;
|
|
|
|
start_cache(USER_PAGE_TTL, $cache_args);
|
2003-03-19 21:01:32 +00:00
|
|
|
$result = mysql_query("select * from user where id=$userid");
|
|
|
|
$user = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
2004-01-05 23:38:13 +00:00
|
|
|
if ($user->show_hosts) {
|
|
|
|
page_head("Computers belonging to $user->name");
|
2004-05-31 00:50:06 +00:00
|
|
|
user_host_table_start(false);
|
2004-01-05 23:38:13 +00:00
|
|
|
} else {
|
|
|
|
echo "Hidden\n";
|
2004-11-22 19:17:13 +00:00
|
|
|
end_cache(USER_PAGE_TTL, $cache_args);
|
2004-01-05 23:38:13 +00:00
|
|
|
exit();
|
|
|
|
}
|
2003-03-19 21:01:32 +00:00
|
|
|
$private = false;
|
|
|
|
} else {
|
2004-07-23 01:07:18 +00:00
|
|
|
$caching=false;
|
2003-03-19 21:01:32 +00:00
|
|
|
$user = get_logged_in_user();
|
|
|
|
$userid = $user->id;
|
|
|
|
page_head("Your computers");
|
2004-05-31 00:50:06 +00:00
|
|
|
user_host_table_start(true);
|
2003-03-19 21:01:32 +00:00
|
|
|
$private = true;
|
|
|
|
}
|
2003-03-17 22:37:49 +00:00
|
|
|
$i = 1;
|
2003-03-19 21:01:32 +00:00
|
|
|
$result = mysql_query("select * from host where userid=$userid order by expavg_credit desc");
|
|
|
|
while ($host = mysql_fetch_object($result)) {
|
2003-12-15 02:31:29 +00:00
|
|
|
show_host_row($host, $i, $private, false);
|
2003-03-17 22:37:49 +00:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
mysql_free_result($result);
|
|
|
|
echo "</table>\n";
|
2004-11-18 20:01:12 +00:00
|
|
|
if ($caching) {
|
|
|
|
page_tail(true);
|
2004-11-22 19:17:13 +00:00
|
|
|
end_cache(USER_PAGE_TTL, $cache_args);
|
2004-11-18 20:01:12 +00:00
|
|
|
} else {
|
|
|
|
page_tail();
|
|
|
|
}
|
2003-03-17 22:37:49 +00:00
|
|
|
?>
|