Game-Jaming/Backend/Controllers/GameJam/NewGameJam.php

34 lines
993 B
PHP
Raw Normal View History

2021-03-09 09:45:05 +00:00
<?php
require_once "../../../bootstrap.php";
2021-03-12 10:10:14 +00:00
require_once "../Admin/Admin.php";
2021-03-09 09:45:05 +00:00
use Backend\Models\GameJam;
2021-03-12 10:10:14 +00:00
//var_dump($_POST);
2021-03-12 10:10:14 +00:00
//session_start();
if(isAdmin()){
if(isset($_POST['newGameJam'])){
2021-03-09 09:45:05 +00:00
$gameJam = New GameJam();
$gameJam->name = $_POST["gameJamName"];
$gameJam->start_time = $_POST["startDate"]."T".$_POST["startTime"];
$gameJam->end_time = $_POST["endDate"]."T".$_POST["endTime"];
2021-03-09 09:45:05 +00:00
$gameJam->description = $_POST["description"];
if($gameJam->save()){
2021-03-17 08:43:09 +00:00
header("location: ../../../Frontend/Html/AdminPage.html?success=UploadedFile");
exit();
2021-03-09 09:45:05 +00:00
}
else{
2021-03-17 08:43:09 +00:00
header("location: ../../../Frontend/Html/AdminPage.html?error=FailToSaveGameJam");
exit();
2021-03-09 09:45:05 +00:00
}
2021-03-17 08:43:09 +00:00
}else{
header("location: ../../../Frontend/Html/AdminPage.html?error=FailedToMakeGameJam");
exit();
2021-03-09 09:45:05 +00:00
}
2021-03-17 08:43:09 +00:00
}else{
header("location: ../../../Frontend/index.html?error=NotAdmin");
exit();
2021-03-09 09:45:05 +00:00
}