Exemplo n.º 1
0
require_once "../../includes/initialize.php";
$what = $_POST['what'];
$ids = $_POST['ids'];
$response = "error";
global $session;
if (!$session->is_logged_in()) {
    die("not logged in");
}
if ($what == "user") {
    foreach ($ids as $id) {
        SchoolUser::delete_all_by_userid($id);
        BatchUser::delete_all_by_userid($id);
        SectionUser::delete_all_by_userid($id);
        ClubUser::delete_all_by_userid($id);
        GroupUser::delete_all_by_userid($id);
        User::get_by_id($id)->delete();
    }
    $log = new Log($session->user_id, $clientip, "WEB", "DELETED MULTIPLE USERS");
    $log->create();
    $response = "success";
} else {
    if ($what == "school") {
        foreach ($ids as $id) {
            $school = School::get_by_id($id);
            $folder_path = "../../public/schools/" . $school->id;
            if (file_exists($folder_path) && $folder_path != "../../public/schools/") {
                rrmdir($folder_path);
            }
            //===================SECTION=============================//
            SectionUser::delete_all_by_schoolid($school->id);
Exemplo n.º 2
0
        $user->comments = $_POST['comments'];
        $user->pending = $_POST['pending'];
        $user->enabled = $_POST['enabled'];
        $user->username = $_POST['username'];
        $user->password = $_POST['password'];
        $user->email = $_POST['email'];
        $user->firstname = $_POST['firstname'];
        $user->middlename = $_POST['middlename'];
        $user->lastname = $_POST['lastname'];
        $user->address = $_POST['address'];
        $user->moto = $_POST['moto'];
        $user->birthdate = $_POST['birthdate'];
        $user->number = $_POST['number'];
        $user->update();
        $log = new Log($session->user_id, $clientip, "WEB", "UPDATED USER: "******"WEB", "DELETED USER: " . $_POST['id']);
                $log->create();
                SchoolUser::delete_all_by_userid($_POST['id']);
                BatchUser::delete_all_by_userid($_POST['id']);
                SectionUser::delete_all_by_userid($_POST['id']);
                ClubUser::delete_all_by_userid($_POST['id']);
                GroupUser::delete_all_by_userid($_POST['id']);
                User::get_by_id($_POST['id'])->delete();
            }
        }
    }
}