2003-03-21 04:38:55 +00:00
|
|
|
<?php
|
2007-10-28 15:03:14 +00:00
|
|
|
|
|
|
|
require_once("../inc/boinc_db.inc");
|
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/host.inc");
|
2003-03-21 04:38:55 +00:00
|
|
|
|
2003-12-01 06:08:22 +00:00
|
|
|
function fail($msg) {
|
2004-01-08 00:09:26 +00:00
|
|
|
echo "Error: $msg";
|
2003-12-01 06:08:22 +00:00
|
|
|
page_tail();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2004-01-08 00:09:26 +00:00
|
|
|
function get_host($hostid, $user) {
|
2007-10-28 15:03:14 +00:00
|
|
|
$host = BoincHost::lookup_id($hostid);
|
2004-01-08 00:09:26 +00:00
|
|
|
if (!$host || $host->userid != $user->id) {
|
2004-05-30 21:47:11 +00:00
|
|
|
fail("We have no record of that computer");
|
2003-03-21 04:38:55 +00:00
|
|
|
}
|
2004-01-08 00:09:26 +00:00
|
|
|
return $host;
|
|
|
|
}
|
2003-12-01 06:08:22 +00:00
|
|
|
|
2005-10-23 07:11:23 +00:00
|
|
|
$user = get_logged_in_user();
|
2004-01-08 00:09:26 +00:00
|
|
|
|
2005-10-23 07:11:23 +00:00
|
|
|
page_head("Merge computer records");
|
2004-01-08 00:09:26 +00:00
|
|
|
|
2005-11-23 01:54:18 +00:00
|
|
|
$nhosts = get_int("nhosts");
|
|
|
|
$hostid = get_int("id_0");
|
2005-10-23 07:11:23 +00:00
|
|
|
$latest_host = get_host($hostid, $user);
|
|
|
|
for ($i=1; $i<$nhosts; $i++) {
|
|
|
|
$var = "id_$i";
|
2005-11-23 01:54:18 +00:00
|
|
|
$hostid = get_int($var, true);
|
2005-12-10 02:21:06 +00:00
|
|
|
if (!$hostid) continue;
|
2005-10-23 07:11:23 +00:00
|
|
|
$host = get_host($hostid, $user);
|
|
|
|
if ($host->create_time > $latest_host->create_time) {
|
2007-05-30 20:30:28 +00:00
|
|
|
$error = merge_hosts($latest_host, $host);
|
|
|
|
if ($error) {
|
|
|
|
fail($error);
|
|
|
|
}
|
2005-10-23 07:11:23 +00:00
|
|
|
$latest_host = $host;
|
|
|
|
} else {
|
|
|
|
merge_hosts($host, $latest_host);
|
|
|
|
}
|
|
|
|
// reread latest_host from database since we just
|
|
|
|
// updated its credits
|
|
|
|
//
|
2007-10-28 15:03:14 +00:00
|
|
|
$latest_host = BoincHost::lookup_id($latest_host->id);
|
2005-10-23 07:11:23 +00:00
|
|
|
}
|
|
|
|
echo "
|
|
|
|
<p><a href=hosts_user.php>Return to list of your computers</a>
|
|
|
|
";
|
|
|
|
page_tail();
|
2004-01-08 00:09:26 +00:00
|
|
|
|
2005-10-23 07:11:23 +00:00
|
|
|
//Header("Location: show_host_detail.php?hostid=$latest_host->id");
|
2003-03-21 04:38:55 +00:00
|
|
|
|
|
|
|
?>
|