//BEGIN DELETE privilege_user_revoke FIRST=================================== if ($iduser_group_old != $iduser_group) { $qry_del = "DELETE FROM privilege_user_revoke WHERE iduser={$iduser}"; $ret_del = $OBCrud->destroy($qry_del); if (!$ret_del["success"]) { echo json_encode($ret_del); break; } } //END DELETE privilege_user_revoke FIRST***************************** $set_qry = "SET `username`={$username}, `iduser_group`={$iduser_group}, `fullname`={$fullname}, email={$email}"; if (!empty($password)) { $set_qry .= ", `password`={$password}"; } $qry_upd = "UPDATE `user` {$set_qry}\n\t\t\tWHERE `iduser`={$iduser} LIMIT 1"; echo json_encode($OBCrud->update($qry_upd)); break; case "destroy": $iduser = $_REQUEST["iduser"]; $ret_arr = array("success" => true, "error_msg" => ""); if (!empty($iduser)) { //BEGIN DELETING privilege_user============ $qry_del_pu = "DELETE FROM privilege_user WHERE iduser={$iduser}"; $res_del_pu = $OBCrud->destroy($qry_del_pu); if ($res_del_pu["success"] === true) { $qry_del_pur = "DELETE FROM privilege_user_revoke WHERE iduser={$iduser}"; $res_del_pur = $OBCrud->destroy($qry_del_pur); if ($res_del_pur["success"] === true) { $qry_del_u = "DELETE FROM `user` WHERE iduser={$iduser}"; $res_del_u = $OBCrud->destroy($qry_del_u); if ($res_del_u["success"] !== true) {
<?php require_once '../config.php'; bsession_life(SESSION_PATH); require_once '../db.php'; require_once '../class/BLogin.php'; require_once '../class/BCrud.php'; $OBLogin = new BLogin($bfurn_db); $OBLogin->login_protect(); $OBCrud = new BCrud($bfurn_db); switch ($_REQUEST["crud"]) { case "read": echo json_encode($OBCrud->read("SELECT * FROM config", "SELECT COUNT(`key`) FROM config")); break; case "update": $json_request = file_get_contents('php://input'); $json = json_decode($json_request); echo json_encode($OBCrud->update("UPDATE `config` SET `value`='{$json->value}' WHERE `key`='{$json->key}' LIMIT 1")); break; }