Ejemplo n.º 1
0
                break;
            }
        }
        if (!$finished) {
            returnError("stillrunning");
        }
        $req = $db->prepare("DELETE FROM Files\n\t\t\t\tWHERE ID_File = :file");
        DBQuery($req, array("file" => $_POST["id"]));
        returnSuccess();
        break;
    case "delexport":
        taskBot();
        $req = $db->prepare("SELECT * FROM Exports\n\t\t\t\tWHERE ID_Export = :export");
        DBQuery($req, array("export" => $_POST["id"]));
        $finished = true;
        foreach ($req->fetchAll() as $d) {
            if ($d["Running_Export"] == 1) {
                $finished = false;
                break;
            }
        }
        if (!$finished) {
            returnError("stillrunning");
        }
        $req = $db->prepare("DELETE FROM Exports\n\t\t\t\tWHERE ID_Export = :export");
        DBQuery($req, array("export" => $_POST["id"]));
        returnSuccess();
        break;
    default:
        returnError("noaction");
}
Ejemplo n.º 2
0
 public function deactivateUser($uid)
 {
     $user = $this->getUser($uid);
     if ($user->uid == $this->uid) {
         return returnError("You can't deactivate yourself.");
     }
     $db = new database();
     $db->query("UPDATE tbl_user SET status = 0 WHERE uid = ?");
     $db->bind(1, $user->uid);
     try {
         $db->execute();
     } catch (Exception $e) {
         return returnError("Database error: " . $e->getMessage());
     }
     $app = new app();
     $app->logEvent("DU", "Dectivated {$user->username} ({$user->uid})");
     return returnSuccess("{$user->username}'s acount has been deactivated");
 }