boinc/html/user/delete_account.php

79 lines
2.5 KiB
PHP
Raw Normal View History

<?php
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2011 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// "delete" an account:
// - set email address and authenticator to "deleted_pid_time"
// - clear name, country, postal_code
// - remove from team
// - delete posts, subscriptions, and forum prefs
// - delete private messages (sent and received)
// - delete profile and associated image
// for each host:
// - clear domain_name, last_ip_addr
require_once("../inc/util.inc");
require_once("../inc/host.inc");
require_once("../inc/profile.inc");
require_once("../inc/pm.inc");
function delete_account($user) {
$x = "deleted_".time()."_".random_string();
$retval = $user->update("email_addr='$x', authenticator='$x', name='', country='', postal_code='', has_profile=0");
if (!$retval) return false;
user_quit_team($user);
forum_delete_user($user);
pm_delete_user($user);
anonymize_hosts($user);
delete_profile($user);
return true;
}
$user = get_logged_in_user();
$cmd = get_str("cmd", true);
if ($cmd == "delete") {
$retval = delete_account($user);
if (!$retval) {
error_page("Couldn't delete account");
} else {
page_head("Account deleted");
echo "
Your account has been deleted.
";
page_tail();
}
} else {
page_head("Confirm delete account");
echo "
<table><tr><td>
Deleting your account will remove all of your
personal information from our servers,
including your profile and message-board posts.
No jobs will be issued to any computers attached
to this account.
<p>
Are you sure you want to delete your account?
";
show_button("delete_account.php?cmd=delete", "Yes", "Delete this account");
show_button("index.php", "No", "Do not delete this account");
echo "</td></tr></table>\n";
page_tail();
}