1<?php
2// This file is part of BOINC.
3// http://boinc.berkeley.edu
4// Copyright (C) 2008 University of California
5//
6// BOINC is free software; you can redistribute it and/or modify it
7// under the terms of the GNU Lesser General Public License
8// as published by the Free Software Foundation,
9// either version 3 of the License, or (at your option) any later version.
10//
11// BOINC is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19require_once("../inc/boinc_db.inc");
20require_once("../inc/util.inc");
21require_once("../inc/host.inc");
22
23check_get_args(array("hostid", "ttok", "tnow"));
24
25$user = get_logged_in_user();
26check_tokens($user->authenticator);
27
28$hostid = get_int("hostid");
29$host = BoincHost::lookup_id($hostid);
30if (!$host || $host->userid != $user->id) {
31    error_page(tra("We have no record of that computer."));
32}
33
34$nresults = host_nresults($host);
35if ($nresults == 0) {
36    $host->delete();
37} else {
38    error_page(tra("You can not delete our record of this computer because our database still contains work for it. You must wait a few days until the work for this computer has been deleted from the project database."));
39}
40page_head(tra("Delete record of computer"));
41echo tra("Record deleted.")."
42    <p><a href=hosts_user.php>".tra("Return to list of your computers")."</a>
43";
44page_tail();
45
46?>
47