die;
}
//Prevent the user visiting the logged in page if he is not logged in
if (!isUserLoggedIn()) {
    header("Location: login.php");
    die;
}
if (isset($_GET['id'])) {
    if (is_numeric($_GET['id'])) {
        $id = $_GET['id'];
        require_once "models/dbcontroller.php";
        $corsi = dbcontroller::getLezioniDelCorsoCompleto();
        $ids = array();
        foreach ($corsi as $corso) {
            $ids[] = $corso['_id'];
        }
        if (in_array($id, $ids)) {
            if (dbcontroller::deleteCorsoMonotematico($id)) {
                header("location: admin_corso_completo.php?msg=success-delete");
            } else {
                header("location: admin_corso_completo.php?msg=error-delete-db");
            }
        } else {
            header("location: admin_corso_completo.php?msg=error-delete");
        }
    } else {
        header("location: admin_corso_completo.php?msg=error-delete");
    }
} else {
    header("location: admin_corso_completo.php?msg=error-delete");
}