<?php include "adminapi.php"; if (!isset($_GET["id"])) { return header("Location: index.php"); } $id = $_GET['id']; $form = findOrgAccountById($id); if (!isset($form)) { $form = findGroupAccountById($id); } if (isset($_POST['id'])) { // Return to the 'proper' place we were coming from $from = $_GET['from']; if (!isset($from)) { $from = ''; } $rs = deleteAccount($id); if ($from == 'user') { header("Location: edituser.php?id={$form['memberid']}"); return; } if ($from == 'org') { header("Location: editorg.php?id={$form['orgid']}"); return; } if ($from == 'group') { if (isset($form['groupName'])) { header("Location: editgroup.php?id={$form['groupid']}"); } else { header("Location: editgroup.php?id={$form['memberid']}");
function deleteAccount($id) { $acct = findOrgAccountById($id); if (isset($acct)) { deleteOrgAccount($id); } $acct = findGroupAccountById($id); if (isset($acct)) { deleteGroupAccount($id); } }
<?php include "adminapi.php"; if (isset($_REQUEST["accountID"])) { // this is the response to an Ajax Request $id = $_REQUEST["accountID"]; $account = findOrgAccountById($id); if (isset($account)) { $newRole = $_REQUEST["newRole"]; $values["sfdc"] = $account["sfdc"]; $values["role"] = $newRole; $values["status"] = $account["status"]; updateOrgAccount($id, $values); return header('HTTP/1.0 200 OK'); } $account = findGroupAccountById($id); if (isset($account)) { $values["status"] = $account["status"]; updateGroupAccount($id, $values); return header('HTTP/1.0 200 OK'); } return header('HTTP/1.0 404 Not Found'); } if (isset($_GET["orgid"])) { // adds an account to an org (allows for both user and group) $id = $_GET["orgid"]; $pageInfo = "Organization does not exist"; $org = findOrgByID($id); $user = findUserByName($_POST["userName"]); if (!isset($user)) { $group = findGroupByName($_POST["userName"]);