示例#1
0
            }
            //
            header('Location: ' . BASE_URL . 'academia/majors/success');
        } else {
            throw new Exception("Either you're trying to hack this app or something wrong went. In either case the\n            developers were just notified about this.");
        }
    } else {
        if (isBtnSavePrsd()) {
            $newMajorCode = trim($_POST['major_code']);
            $newMajorName = trim($_POST['major_name']);
            Major::create($newMajorCode, $newMajorName);
            header('Location: ' . BASE_URL . 'academia/majors/success');
            exit;
        } else {
            if (isBtnDeletePrsd()) {
                Major::delete($_POST['delMajorIdModal']);
                header('Location: ' . BASE_URL . 'academia/majors/success');
                exit;
            }
        }
    }
} catch (Exception $e) {
    $errors[] = $e->getMessage();
}
/**
 * http://stackoverflow.com/a/4128377/2790481
 *
 * @param $needle
 * @param $courses
 * @param bool $strict
 * @return bool