/** * removes the temporary user * and cleans up the curl connection. * */ private function cleanup() { if ($this->member) { $this->member->delete(); } curl_close($this->ch); }
function execute() { $return = new stdClass(); $params = Request::_REQUEST(); Config::set("HideDebugger", true); if (isset($params['id'])) { if ($params['id'] == Config::get("Member")->getID()) { $return->error = "ID matches logged in ID and cannot delete!"; echo json_encode($return); return; } $user = new Member($params["id"]); if (isset($user) && $user->isValid()) { $user->delete(); $return->id = $params['id']; $return->deleted = true; echo json_encode($return); return; } else { $return->error = "ID is invalid!"; echo json_encode($return); return; } } else { $return->error = "Missing ID!"; echo json_encode($return); return; } }
public function testDeletesOpauthIdentityOnDelete() { $member = new Member(array('Email' => '*****@*****.**')); $member->write(); $identity = new OpauthIdentity(); $identity->write(); $member->OpauthIdentities()->add($identity); $member->delete(); $this->assertEquals(0, $member->OpauthIdentities()->Count()); }
public function testMemberSpecialCleanup() { // Member relations are configured to be handled in the last // second by JanitorMemberDecorator, be sure that the hack // works as expected. $member = new Member(); $member->Email = '*****@*****.**'; $member->Password = '******'; $member->write(); $memberID = $member->ID; $member->Password = '******'; $member->write(); $this->assertEquals(2, DataObject::get('MemberPassword', "\"MemberID\" = {$memberID}")->Count(), "MemberPassword cleaned prematurely"); $member->delete(); $this->assertFalse((bool)DataObject::get('MemberPassword', "\"MemberID\" = {$memberID}"), "MemberPassword not cleaned propely"); }
public function delete() { if ($this->canDelete(Member::currentUser())) { parent::delete(); } }
function deleteMember() { $member = new Member(array("id" => isset($_POST["memberId"]) ? (int) $_POST["memberId"] : "")); LogEntry::deleteAllForMember($member->getValue("id")); $member->delete(); displaySuccess(); }
var_dump($result); //2件目のデータを登録 $member->set(array('name' => 'テスト名2', 'age' => 31, 'email' => '*****@*****.**')); $result = $member->insert(); var_dump($result); //1件目と同じデータを登録 $member->set(array('name' => 'テスト名', 'age' => 30, 'email' => '*****@*****.**')); $result = $member->insert(); var_dump($result); // 引数で指定されたメールアドレスのユーザーを members テーブルから探し、 // もし見つかった場合、そのデータを以下の形式で返します。 // array( // 'id' => 'members テーブル の id カラムの値', // 'name' => 'members テーブル の name カラムの値', // 'age' => 'members テーブル の age カラムの値', // 'email' => 'members テーブル の email カラムの値', // 'created_at' => 'members テーブル の created_at カラムの値', // ); // ユーザーが見つからなかった場合、false を返します。 $data = $member->findByEmail('*****@*****.**'); var_dump($data); // 引数で指定された id を持つ members テーブルのレコードを削除します。 // 削除が成功した場合は true 、失敗した場合は false を返します。 $result = $member->delete($data['id']); var_dump($result); //削除後のデータを削除 $result = $member->delete($data['id']); var_dump($result); // ここでは false が返ってくるはずです。 $data = $member->findByEmail('*****@*****.**'); var_dump($data);
$countErrors = 0; if ($_POST['submit']) { $delMemberObj = new Member($mysqli); if (!$delMemberObj->select($_POST['deletemember']) || !is_numeric($_POST['deletemember'])) { $dispError = " <b>·</b> You selected an invalid member.<br>"; $countErrors++; } else { // Check if member is disabled if ($delMemberObj->get_info("disabled") != 1) { $dispError = " <b>·</b> You may only delete members who are currently disabled.<br>"; $countErrors++; } } if ($countErrors == 0) { $delMemberUsername = $delMemberObj->get_info_filtered("username"); if ($delMemberObj->delete()) { echo "\n\t\t\t\n\t\t\t\n\t\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t\t<p align='center'>\n\t\t\t\t\t\tSuccessfully deleted " . $delMemberUsername . " from the website!\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tpopupDialog('Delete Member', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t\t</script>\n\t\t\t\n\t\t\t\n\t\t\t"; $member->logAction("Deleted " . $delMemberUsername . " from the website."); } else { $countErrors++; $dispError .= " <b>·</b> Unable to delete member from the database. Please contact the website administrator.<br>"; } } if ($countErrors > 0) { $_POST['submit'] = false; } } if (!$_POST['submit']) { $memberoptions = ""; $result = $mysqli->query("SELECT * FROM " . $dbprefix . "members WHERE disabled = '1' ORDER BY username"); while ($row = $result->fetch_assoc()) {
<?php include "_setup.php"; include_once "classes/member.php"; $member = new Member($mysqli); if ($_POST['submit']) { if ($member->select($_POST['adminaccount']) && $member->delete()) { echo "Admin Account Deleted!<br><br>"; } } $result = $mysqli->query("SELECT * FROM " . $dbprefix . "members WHERE rank_id = '1'"); while ($row = $result->fetch_assoc()) { $options .= "<option value='" . $row['member_id'] . "'>" . $row['username'] . "</option>"; } echo "\n\n\t<form action='deleteadminaccount.php' method='post'>\n\t\n\t\tAdmin Account: <select name='adminaccount'>" . $options . "</select><br>\n\t\t<input type='submit' name='submit' value='Delete Account'>\n\t\n\t</form>\n\n\t<br><br>\n\t<a href='resetadminpassword.php'>Reset Admin Account Password</a>\n\n";
<?php require_once './resource/models/member.php'; if ($_POST['member_id']) { $member = new Member(); if ($_POST["member_id"] != "") { $member->setId($_POST["member_id"]); $result = $member->delete(); if ($result) { $message = "<p class=\"message success\"><i class=\"material-icons\">done</i>Member deleted!</p>"; } else { $message = "<p class=\"message error\"><i class=\"material-icons\">error</i>Error: Member was not deleted</p>"; } } else { $message = "<p class=\"message error\"><i class=\"material-icons\">error</i>Error: Blank member ID specified in POST request</p>"; } } else { $message = "<p class=\"message error\"><i class=\"material-icons\">error</i>Error: No member ID specified in POST request</p>"; }
/** * 删除当前管理员 * * @see OOP_ORM_Data::delete() * @return integer 操作行数 * @throws \Exception */ public function delete() { $id = $this->id; $rs = parent::delete(); if ($rs) { # 删除管理员对应的用户组设置 $orm_group = new \ORM_Admin_MemberGroup_Finder(); $orm_group->db()->where('admin_id', $id)->delete($orm_group->ids_tablename()); } return $rs; }