diff --git a/ajax.php b/ajax.php index 098ed707..23902156 100644 --- a/ajax.php +++ b/ajax.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-01-16 23:01:33 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 18:47:47 + * @Last Modified time: 2016-03-26 22:01:59 * * - login, register, logout * - upload, change, delete @@ -223,14 +223,19 @@ if ($action == "change") { } else if ($action == "delete") { if (isset($_SESSION['token']) && $_SESSION['token'] == $user->getToken()) { if (checkPost()) { - if ($user->checkPasswd($_POST['passwd'])) { - session_destroy(); - $user->unRegister(); - $json['errno'] = 0; - $json['msg'] = "账号已经成功删除,再见~"; + if (!$user->is_admin) { + if ($user->checkPasswd($_POST['passwd'])) { + session_destroy(); + $user->unRegister(); + $json['errno'] = 0; + $json['msg'] = "账号已经成功删除,再见~"; + } else { + $json['errno'] = 1; + $json['msg'] = "错误的密码。"; + } } else { $json['errno'] = 1; - $json['msg'] = "错误的密码。"; + $json['msg'] = "管理员账号不能被删除哟~"; } } } else { diff --git a/user/profile.php b/user/profile.php index 8f292a06..0068ada5 100644 --- a/user/profile.php +++ b/user/profile.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-02-03 16:12:45 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 18:47:50 + * @Last Modified time: 2016-03-26 21:59:57 */ require "../libraries/session.inc.php"; $data['style'] = <<< 'EOT' @@ -68,10 +68,15 @@ View::show('header', $data);

删除账号

+ is_admin): ?>

确定要删除你在 上的账号吗?

此操作不可恢复!我们不提供任何备份,或者神奇的撤销按钮。

我们警告过你了,确定要这样做吗?

+ +

管理员账号不能被删除。

+ +