Пример #1
0
 if ($request == "admin" && isset($_SESSION['User']) && $_SESSION['User']->isAdmin()) {
     include __DIR__ . '/../models/Image.php';
     include __DIR__ . '/../controllers/images.php';
     include __DIR__ . '/../views/admin.php';
 } else {
     if ($request == "login") {
         include __DIR__ . '/../controllers/login.php';
         $user = LoginController::LoginUser($_POST['email'], $_POST['password']);
         if ($user != null) {
             $_SESSION['User'] = $user;
             header("Location: dashboard");
         }
     } else {
         if ($request == "register") {
             include __DIR__ . '/../controllers/register.php';
             RegisterController::createUser($_POST['email'], $_POST['password1']);
             header("Location: index");
         } else {
             if ($request == "delete" && isset($_SESSION['User'])) {
                 include __DIR__ . '/../models/Image.php';
                 include __DIR__ . '/../controllers/images.php';
                 ImageController::DeleteImage($_SESSION['User']->getID(), $_POST['imageid']);
                 header("Location: dashboard");
             } else {
                 if (isset($_SESSION['User'])) {
                     header("Location: dashboard");
                 } else {
                     include __DIR__ . '/../views/frontpage.php';
                 }
             }
         }