Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
Minik Gaarde Lambrecht 2021-03-26 18:25:39 +01:00
commit ccdcda713e
52 changed files with 1577 additions and 167 deletions

0
.gitignore vendored Normal file → Executable file
View File

View File

@ -1 +1,2 @@
Header set Access-Control-Allow-Origin: * Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"

0
.idea/.gitignore vendored Normal file → Executable file
View File

0
.idea/Game-Jaming.iml Normal file → Executable file
View File

0
.idea/misc.xml Normal file → Executable file
View File

0
.idea/modules.xml Normal file → Executable file
View File

0
.idea/php.xml Normal file → Executable file
View File

0
.idea/vcs.xml Normal file → Executable file
View File

11
Backend/CheckSetup.php Normal file
View File

@ -0,0 +1,11 @@
<?php
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
header('Content-Type: application/json;charset=UTF-8');
if(!file_exists('../config/database.json')){
echo json_encode(['data' => false]);
}elseif(0 === filesize('../config/database.json')){
echo json_encode(['data' => false]);
}else{
echo json_encode(['data' => true]);
}

View File

@ -8,3 +8,15 @@ function isAdmin(): bool
return isset($_SESSION['admin']); return isset($_SESSION['admin']);
} }
/**
* @param string $userName
*/
function makeAdminLogin(string $userName)
{
setcookie("userName", $userName, [
'expires' => 0,
'samesite' => 'Strict',
'path' => '/'
]);
}

View File

@ -20,16 +20,17 @@ if(isset($_POST['aLogin'])){
$_SESSION['admin'] = true; $_SESSION['admin'] = true;
$_SESSION['success'] = "You are now logged in"; $_SESSION['success'] = "You are now logged in";
http_response_code(200); http_response_code(200);
makeAdminLogin($userName);
}else{ }else{
session_destroy(); session_destroy();
echo "Fail to verify password";
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "wrong password"]);
} }
}else{ }else{
session_destroy(); session_destroy();
echo "No user";
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "admin don't exist"]);
} }
}else{ }else{
http_response_code(400); http_response_code(400);

View File

@ -19,4 +19,5 @@ if (isAdmin()){
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not admin"]);
} }

View File

@ -5,7 +5,8 @@
* @return string * @return string
*/ */
function ZipFileHandler(string $gameFileName, string $gameFileTmp){ function ZipFileHandler(string $gameFileName, string $gameFileTmp): string
{
$fileExtGame = explode('.', $gameFileName); $fileExtGame = explode('.', $gameFileName);
$fileActualExtGame = strtolower(end($fileExtGame)); $fileActualExtGame = strtolower(end($fileExtGame));
@ -21,11 +22,10 @@ function ZipFileHandler(string $gameFileName, string $gameFileTmp){
rename($gameFileTmp,"../../Games/".$gameFileNewName); rename($gameFileTmp,"../../Games/".$gameFileNewName);
return $gameFileNewName; return $gameFileNewName;
}else{ }else{
echo "Wrong file type";
http_response_code(400); http_response_code(400);
echo json_encode(["message" => "Wrong file type gameFile"]);
exit(); exit();
} }
return NULL;
} }
/** /**
@ -33,7 +33,8 @@ return NULL;
* @param string $thumbnailFileTmp * @param string $thumbnailFileTmp
* @return string * @return string
*/ */
function imagesFileHandler(string $thumbnailFileName, string $thumbnailFileTmp){ function imagesFileHandler(string $thumbnailFileName, string $thumbnailFileTmp): string
{
$fileExtThumb = explode('.', $thumbnailFileName); $fileExtThumb = explode('.', $thumbnailFileName);
$fileActualExtThumb = strtolower(end($fileExtThumb)); $fileActualExtThumb = strtolower(end($fileExtThumb));
@ -49,9 +50,8 @@ function imagesFileHandler(string $thumbnailFileName, string $thumbnailFileTmp){
rename($thumbnailFileTmp,"../../../Frontend/images/".$thumbnailFileNewName); rename($thumbnailFileTmp,"../../../Frontend/images/".$thumbnailFileNewName);
return $thumbnailFileNewName; return $thumbnailFileNewName;
}else{ }else{
echo "Wrong file type";
http_response_code(400); http_response_code(400);
echo json_encode(["message" => "Wrong file type thumbnailFile"]);
exit(); exit();
} }
return NULL;
} }

View File

@ -17,4 +17,4 @@ if(isset($_GET['gameDataId'])){
header("Access-Control-Allow-Methods: GET"); header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept"); header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
header('Content-Type: application/json;charset=UTF-8'); header('Content-Type: application/json;charset=UTF-8');
echo $openGameDataStream->toJson(JSON_PRETTY_PRINT); echo json_encode(array('data' => $openGameDataStream->jsonSerialize()));

View File

@ -37,14 +37,15 @@ if(isLogin()){
} }
$gameData->is_web_Based = $isWebBased; $gameData->is_web_Based = $isWebBased;
if(!$gameData->save()){ if(!$gameData->save()){
http_response_code(500); http_response_code(500);
}else{ }else{
http_response_code(201); http_response_code(201);
} }
}else{ }else{
http_response_code(400); http_response_code(400);
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not login"]);
} }

View File

@ -58,18 +58,21 @@ if(isLogin()){
http_response_code(201); http_response_code(201);
} }
}else{
http_response_code(500);
} }
}else{ }else{
http_response_code(400); http_response_code(400);
} }
}else{ }else{
echo "Can only upload one file";
http_response_code(400); http_response_code(400);
echo json_encode(["message" => "Can only upload one file"]);
} }
}else{ }else{
echo "Can only upload when the game jam has started";
http_response_code(400); http_response_code(400);
echo json_encode(["message" => "Can only upload when the game jam has started"]);
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not login"]);
} }

View File

@ -15,6 +15,7 @@ if(isset($_GET['gameJamId'])){
} }
header('Content-Type: application/json;charset=UTF-8'); header('Content-Type: application/json;charset=UTF-8');
echo $dbValue->toJson(JSON_PRETTY_PRINT);
echo json_encode(array('data' => $dbValue->jsonSerialize()));
//var_dump(headers_list()); //var_dump(headers_list());

View File

@ -14,6 +14,9 @@ if(isAdmin()){
$gameJam->name = $_POST["gameJamName"]; $gameJam->name = $_POST["gameJamName"];
$gameJam->start_time = $_POST["startDate"]."T".$_POST["startTime"]; $gameJam->start_time = $_POST["startDate"]."T".$_POST["startTime"];
$gameJam->end_time = $_POST["endDate"]."T".$_POST["endTime"]; $gameJam->end_time = $_POST["endDate"]."T".$_POST["endTime"];
if (!empty($_POST['keyWord'])) {
$gameJam->key_word = $_POST['keyWord'];
}
$gameJam->description = $_POST["description"]; $gameJam->description = $_POST["description"];
if($gameJam->save()){ if($gameJam->save()){
@ -27,4 +30,5 @@ if(isAdmin()){
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not admin"]);
} }

View File

@ -26,10 +26,14 @@ if(isAdmin()){
}else{ }else{
http_response_code(500); http_response_code(500);
} }
}else{
http_response_code(400);
echo json_encode(["message" => "game jam not found"]);
} }
}else{ }else{
http_response_code(400); http_response_code(400);
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not admin"]);
} }

View File

@ -15,4 +15,4 @@ else{
header("Access-Control-Allow-Methods: GET"); header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept"); header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
header('Content-Type: application/json;charset=UTF-8'); header('Content-Type: application/json;charset=UTF-8');
echo $groups->toJson(JSON_PRETTY_PRINT); echo json_encode(array('data' => $groups->jsonSerialize()));

View File

@ -5,6 +5,7 @@ use Backend\Models\Group;
use Backend\Models\Password; use Backend\Models\Password;
session_start(); session_start();
/** /**
* @param string $token * @param string $token
* @return Group|null ; * @return Group|null ;
@ -42,4 +43,15 @@ function passwordValidate(string $password1): bool
return true; return true;
} }
else return false; else return false;
}
function makeLogin(string $groupName, int $groupId)
{
$cookieCon = array(
'expires' => 0,
'samesite' => 'Strict',
'path' => '/'
);
setcookie("groupName", $groupName, $cookieCon);
setcookie("groupId", $groupId, $cookieCon);
} }

View File

@ -1,13 +1,13 @@
<?php <?php
require "../../../bootstrap.php"; require_once "../../../bootstrap.php";
require_once "Group.php";
use Backend\Models\Group; use Backend\Models\Group;
use Backend\Models\Password; use Backend\Models\Password;
use Illuminate\Support\Str; use Illuminate\Support\Str;
//Start the php session //Start the php session
session_start();
if(isset($_POST['login'])){ if(isset($_POST['login'])){
@ -22,9 +22,9 @@ if(isset($_POST['login'])){
$groupPassword = Password::firstWhere('group_id', $group->id); $groupPassword = Password::firstWhere('group_id', $group->id);
$groupPassword->remember_token = $token; $groupPassword->remember_token = $token;
if($groupPassword->save()){ if($groupPassword->save()){
$_SESSION['groupName'] = $groupName;
$_SESSION['token'] = $token; $_SESSION['token'] = $token;
$_SESSION['success'] = "You are now logged in"; $_SESSION['success'] = "You are now logged in";
makeLogin($groupName,$group->id);
//header('location: ../../../Frontend/index.php?login=success'); //header('location: ../../../Frontend/index.php?login=success');
//exit(); //exit();
http_response_code(200); http_response_code(200);
@ -37,12 +37,16 @@ if(isset($_POST['login'])){
}else{ }else{
session_destroy(); session_destroy();
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "Wrong password"]);
} }
}else{ }else{
session_destroy(); session_destroy();
http_response_code(400); http_response_code(401);
echo json_encode(["message" => "group was not found"]);
} }
}else{
http_response_code(400);
} }

View File

@ -1,5 +1,16 @@
<?php <?php
session_start(); session_start();
session_unset();
session_destroy();
session_destroy(); $cookieCon = array(
'expires' => -1,
'samesite' => 'Strict',
'path' => '/'
);
setcookie("groupName", null, $cookieCon);
setcookie("groupId", null, $cookieCon);
setcookie("userName", null, $cookieCon);
echo http_response_code(200);

View File

@ -18,6 +18,7 @@ if(isAdmin()){
} }
}else{ }else{
http_response_code(400); http_response_code(400);
echo json_encode(["message" => "group not found"]);
} }
}else{ }else{
@ -25,4 +26,5 @@ if(isAdmin()){
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not admin"]);
} }

View File

@ -24,8 +24,10 @@ if(isset($_POST['regGroup'])){
$group->group_amount = $_POST['groupAmount']; $group->group_amount = $_POST['groupAmount'];
if(!$group->save()){ if(!$group->save()){
return; http_response_code(500);
exit();
} }
$password = New Password(); $password = New Password();
$password->group()->associate($group); $password->group()->associate($group);
@ -38,16 +40,19 @@ if(isset($_POST['regGroup'])){
if(!$password->save()){ if(!$password->save()){
http_response_code(500); http_response_code(500);
}else{ exit();
http_response_code(201);
} }
$_SESSION['groupName'] = $groupName; $_SESSION['groupName'] = $groupName;
$_SESSION['token'] = $token; $_SESSION['token'] = $token;
$_SESSION['success'] = "You are now logged in"; $_SESSION['success'] = "You are now logged in";
makeLogin($groupName,$group->id);
http_response_code(201);
echo json_encode(["message" => "you are login"]);
}else{ }else{
http_response_code(400); http_response_code(400);
echo json_encode(["message" => "password not valid"]);
} }
}else{ }else{
http_response_code(400); http_response_code(400);

View File

@ -16,11 +16,16 @@ if(isLogin()){
http_response_code(201); http_response_code(201);
} }
} }
else{
http_response_code(400);
echo json_encode(["message" => "group not found"]);
}
}else{ }else{
http_response_code(400); http_response_code(400);
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not login"]);
} }

View File

@ -14,10 +14,15 @@ if(isLogin()){
http_response_code(201); http_response_code(201);
} }
} }
else{
http_response_code(400);
echo json_encode(["message" => "password not valid"]);
}
}else{ }else{
http_response_code(400); http_response_code(400);
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not login"]);
} }

View File

@ -20,9 +20,13 @@ if(isset($_POST['1Vote'])){
}else{ }else{
http_response_code(201); http_response_code(201);
} }
} else{
http_response_code(403);
echo json_encode(["message" => "you have already voted"]);
} }
}else{ }else{
http_response_code(400); http_response_code(400);
echo json_encode(["message" => "you have already voted"]);
} }

View File

@ -5,8 +5,9 @@ require_once "../Group/Group.php";
if(isLogin()){ if(isLogin()){
header('Content-Type: application/json;charset=UTF-8'); header('Content-Type: application/json;charset=UTF-8');
echo Vote::where('group_id',groupViaToken($_SESSION['token'])->id)->get()->toJson(JSON_PRETTY_PRINT); echo json_encode(array('data' => Vote::where('group_id',groupViaToken($_SESSION['token'])->id)->get()->jsonSerialize()));
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "not login"]);
} }

View File

@ -5,30 +5,39 @@ use Backend\Models\Group;
use Backend\Models\Vote; use Backend\Models\Vote;
use \Illuminate\Support\Collection; use \Illuminate\Support\Collection;
if(isAdmin() && isset($_GET['gameJamId'])){ if(isAdmin()){
$groups = Group::where('game_jam_id',$_GET['gameJamId'])->get(); if(isset($_GET['gameJamId'])) {
$winningGroups = new Collection(); $groups = Group::where('game_jam_id', $_GET['gameJamId'])->get();
$i = -1; if($groups) {
foreach ($groups as $group){
$x = Vote::where('group_id', $group->id)->count();
if($x>$i){
$winningGroups = new Collection(); $winningGroups = new Collection();
$winningGroups->push($group); $i = -1;
foreach ($groups as $group) {
$x = Vote::where('group_id', $group->id)->count();
if ($x > $i) {
$winningGroups = new Collection();
$winningGroups->push($group);
$i = $x; $i = $x;
} elseif ($i === $x) {
$winningGroups->push($group);
}
}
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
header('Content-Type: application/json;charset=UTF-8');
echo json_encode(array('data' => $winningGroups->jsonSerialize()));
} }
elseif ($i === $x){ else{
$winningGroups->push($group); http_response_code(400);
echo json_encode(["message" => "game jam not found"]);
} }
}else{
http_response_code(400);
} }
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
header('Content-Type: application/json;charset=UTF-8');
echo $winningGroups->toJson(JSON_PRETTY_PRINT);
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "not admin"]);
} }

View File

@ -23,10 +23,11 @@ if (!isAdmin()){
header("Access-Control-Allow-Methods: GET"); header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept"); header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
header('Content-Type: application/json;charset=UTF-8'); header('Content-Type: application/json;charset=UTF-8');
echo $find_all_keywords->pluck("key_word")->toJson(JSON_PRETTY_PRINT); echo json_encode(array('data' => $find_all_keywords->jsonSerialize()));
}else{ }else{
http_response_code(400); http_response_code(400);
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "is not admin"]);
} }

View File

@ -30,8 +30,8 @@ if (isLogin()) {
http_response_code(201); http_response_code(201);
} }
}else{ }else{
echo "limited upload reached";
http_response_code(400); http_response_code(400);
echo json_encode(["message" => "limited upload reached"]);
} }
}else{ }else{
@ -39,5 +39,6 @@ if (isLogin()) {
} }
}else{ }else{
http_response_code(401); http_response_code(401);
echo json_encode(["message" => "not login"]);
} }

111
Backend/setup.php Normal file
View File

@ -0,0 +1,111 @@
<?php
//use Illuminate\Support\Facades\DB;
use \Backend\Models\AdminUser;
use JetBrains\PhpStorm\ArrayShape;
/**
* @param string $servername
* @param string $username
* @param string $password
* @param string $DBName
* @return string[]
*/
function myDB(string $servername, string $username, string $password, string $DBName): array
{
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
http_response_code(400);
echo json_encode(["message" => $conn->connect_error]);
exit();
}
$sql = "CREATE DATABASE ".$DBName;
if ($conn->query($sql) === FALSE) {
http_response_code(400);
echo json_encode(["message" => $conn->error]);
exit();
}
$conn->close();
return array(
"driver" => "mysql",
"host" => $servername,
"database" => $DBName,
"username" => $username,
"password" => $password
);
}
/**
* @param string $DBName
* @return string[]
*/
function liteDB(string $DBName): array
{
$DBName = $DBName.".sqlite";
if(file_exists($DBName)){
http_response_code(400);
echo json_encode(["message" => "database already exits"]);
exit();
}
New SQLite3($DBName);
return array(
'driver' => 'sqlite',
'database' => realpath(dirname(__FILE__)."/".$DBName)
);
}
$conFilePath = '../config/database.json';
if(!file_exists($conFilePath)){
$confile = fopen($conFilePath, "w");
fclose($confile);
}
if (0 !== filesize($conFilePath)){
http_response_code(400);
echo json_encode(["message" => "already have database connection"]);
exit();
}
if(isset($_POST["dbSetup"])){
switch($_POST["dbType"]){
case "mysql":
$dbCon = myDB($_POST["dbServername"],$_POST["dbUsername"],$_POST["dbPassword"], $_POST["dbName"]);
break;
case "sqlite":
$dbCon = liteDB($_POST["dbName"]);
break;
default:
http_response_code(400);
echo json_encode(["message" => "database type is wrong"]);
exit();
}
file_put_contents($conFilePath, json_encode($dbCon));
require_once('../bootstrap.php');
try{
$capsule->Connection()->getPdo();
} catch (\Exception $e) {
http_response_code(400);
file_put_contents($conFilePath, NULL);
echo json_encode(["message" => "Could not connect to the database. Please check your configuration. error:" . $e]);
exit();
}
require_once ('Database/databaseMigration.php');
AdminUser::firstOrCreate([
'user_name' => $_POST["AdminUsername"], 'password' => password_hash($_POST["AdminPassword"],PASSWORD_DEFAULT)
]);
http_response_code(201);
}else{
http_response_code(400);
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}

View File

@ -1,4 +1,4 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -27,20 +27,52 @@
</head> </head>
<body> <body>
<div class="HeaderPanel">
<div class="HeaderPanel"> <div class="HeaderLeft">
<div class="HeaderLeft"> <a href="../Index.html">
<a href="../Index.html"> <i class="fas fa-arrow-left"></i>
<i class="fas fa-arrow-left"></i> </a>
</a> <h6>
<h6> Admin panel
Admin panel </h6>
</h6> </div>
</div> </div>
<!--Opret game jam-->
<br />
<br />
<h3>Administration</h3>
<h5>Opret Game Jam</h5>
<div>
<form id="createGameJam">
<label for="nameOfGameJam">Indtast navn på Game Jam:</label>
<input type="text" name="nameOfGameJam" id="nameOfGameJam">
<br />
<label for="startDate">Start dato:</label>
<input type="date" name="startDate" id="startDate">
<br />
<label for="endDate">Slut dato:</label>
<input type="date" name="endDate" id="endDate">
<br />
<label for="startTime">Start tidspunkt:</label>
<input type="time" name="startTime" id="startTime">
<br />
<label for="endDate">Slut tidspunkt:</label>
<input type="time" name="endTime" id="endTime">
<br />
<p>Indsæt en beskrivelse af Gam jammet</p>
<div class="form-floating">
<textarea class="form-control" name="description" id="description" placeholder="Leave a comment here" id="floatingTextarea2" style="height: 100px"></textarea>
<label for="floatingTextarea2">Beskrivelse</label>
</div>
<button type="button" name="indsend" id="indsend">Indsend</button>
</form>
</div> </div>
<!--Opret game jam slut-->
<!-- Body scripts --> <!-- Body scripts -->
<script src="../Javascript/minibar.min.js"></script> <script src="../Javascript/minibar.min.js"></script>
<script src="../Javascript/AddEvent.js"></script>
<!-- Body scripts end --> <!-- Body scripts end -->
</body> </body>

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -83,9 +83,12 @@
</a> </a>
</li> </li>
</ul> </ul>
<a type="button" class="nav-link LoginButton" data-bs-toggle="modal" data-bs-target="#LoginModal"> <a id="NavLogin" type="button" class="nav-link LoginButton" data-bs-toggle="modal" data-bs-target="#LoginModal" style="display: block;">
Login Login
</a> </a>
<a id="NavUser" type="button" class="nav-link LoginButton" style="display: none;">
</a>
</div> </div>
</div> </div>
</nav> </nav>
@ -618,19 +621,15 @@
<!-- Lodtrækning --> <!-- Lodtrækning -->
<section id="lod"> <section id="lod">
<h3>Lodtrækning</h3> <h3>Lodtrækning</h3>
<p></p>
<div id="chart"></div>
<div id="question"><h1></h1></div>
</section> </section>
<!-- Lodtrækning slut --> <!-- Lodtrækning slut -->
<hr class="GradientDivider" /> <hr class="GradientDivider" />
<!-- Administation -->
<section id="admin">
<h3>Administration</h3>
<p></p>
</section>
<!-- Administation slut -->
<a href="javascript:" id="return-to-top"> <a href="javascript:" id="return-to-top">
<i class="fas fa-chevron-up"></i> <i class="fas fa-chevron-up"></i>
</a> </a>
@ -651,6 +650,7 @@
<script src="Javascript/minibar.min.js"></script> <script src="Javascript/minibar.min.js"></script>
<script src="Javascript/HeaderFunctionality.js"></script> <script src="Javascript/HeaderFunctionality.js"></script>
<script src="Javascript/LoginFunctionality.js"></script> <script src="Javascript/LoginFunctionality.js"></script>
<script src="Javascript/Lodtrækning.js"></script>
<!-- Body scripts end --> <!-- Body scripts end -->
</body> </body>

View File

@ -0,0 +1,17 @@
// Admin add event
$("#indsend").click(function () {
let startDate = $("#startDate").val();
let endDate = $("#endDate").val();
let startTime = $("#startTime").val();
let endTime = $("#endTime").val();
console.log(`startDate ${startDate} \n
endDate ${endDate} \n
startTime ${startTime} \n
endTime ${endTime}`);
})
function addEvent() {
}

View File

View File

@ -12,9 +12,15 @@ $(document).ready(function () {
.then(function(res) { .then(function(res) {
let resArr = res.data; let resArr = res.data;
$.each(resArr, function(i, value) { //console.log(res.data.data);
arr.push({id: value.id, Gamejam: value.name});
}); for(let i = 0; i < res.data.data.length; i++)
{
arr.push({
id: res.data.data[i].id,
Gamejam: res.data.data[i].name
});
}
$.each(arr, function(i, data) { $.each(arr, function(i, data) {
if (i === 0) if (i === 0)
@ -34,7 +40,7 @@ $(document).ready(function () {
// Remove invalidInput if selected option has been changed // Remove invalidInput if selected option has been changed
$('#GameJamSelect').change(function() { $('#GameJamSelect').change(function() {
selectedGameJam = $('#GameJamSelect').children("option:selected").val(); selectedGameJam = $('#GameJamSelect').children("option:selected").val();
if (selectedGameJam >= 1) if (selectedGameJam >= 1)
{ {
$('#GameJamSelect').removeClass('invalidInput'); $('#GameJamSelect').removeClass('invalidInput');
@ -50,7 +56,7 @@ $(document).ready(function () {
}) })
GetGroupNames().then(function(res) { GetGroupNames().then(function(res) {
let resArr = res; let resArr = res.data;
let groupNameTaken = false; let groupNameTaken = false;
$('#RegisterBtn').click(function() { $('#RegisterBtn').click(function() {
@ -88,28 +94,33 @@ $(document).ready(function () {
{ {
$('#pass1').addClass('invalidInput'); $('#pass1').addClass('invalidInput');
e.preventDefault(); e.preventDefault();
return;
} }
if($('#pass2').val().length === 0) if($('#pass2').val().length === 0)
{ {
$('#pass2').addClass('invalidInput'); $('#pass2').addClass('invalidInput');
e.preventDefault(); e.preventDefault();
return;
} }
if($('#username').val().length === 0) if($('#username').val().length === 0)
{ {
$('#username').addClass('invalidInput'); $('#username').addClass('invalidInput');
e.preventDefault(); e.preventDefault();
return;
} }
if($('#pass1').hasClass('invalidInput')) if($('#pass1').hasClass('invalidInput'))
{ {
e.preventDefault(); e.preventDefault();
return;
} }
if($('#pass2').hasClass('invalidInput')) if($('#pass2').hasClass('invalidInput'))
{ {
e.preventDefault(); e.preventDefault();
return;
} }
if(!$.isNumeric($('#NUDDisplay').text())) if(!$.isNumeric($('#NUDDisplay').text()))
@ -127,32 +138,28 @@ $(document).ready(function () {
{ {
$('#username').addClass('invalidInput'); $('#username').addClass('invalidInput');
e.preventDefault(); e.preventDefault();
return;
} }
let URL = "/Backend/Controllers/Group/SigningUp.php"; let URL = "/Backend/Controllers/Group/SigningUp.php";
let formData = new FormData(this);
let name = $('#RegisterBtn').attr('name'); let form = $('#RegisterForm')[0];
let formData = new FormData(form);
let id = $('#RegisterBtn').attr('name');
let value = $('#RegisterBtn').val(); let value = $('#RegisterBtn').val();
formData.append(name, value); formData.append(id, value);
$.ajax({ axios.post(URL, formData, {
url: URL, header: 'multipart/form-data'
type: 'POST', }).then(res => {
data: formData, console.log(res);
mimeType:"multipart/form-data", }).catch(error => {
contentType: false, console.log(error);
cache: false,
processData:false,
success: function(data, textStatus, jqXHR)
{
console.log(data);
},
error: function(jqXHR, textStatus, errorThrown)
{
console.log(textStatus);
}
}); });
e.preventDefault();
}); });
}); });
@ -195,29 +202,28 @@ $(document).ready(function () {
// Login start // Login start
$('#LoginForm').submit(function(e) { $('#LoginForm').submit(function(e) {
let URL = "/Backend/Controllers/Group/Login.php"; let URL = "/Backend/Controllers/Group/Login.php";
let formData = new FormData(this);
let name = $('#LoginBtn').attr('name'); let form = $('#LoginForm')[0];
let formData = new FormData(form);
let id = $('#LoginBtn').attr('name');
let value = $('#LoginBtn').val(); let value = $('#LoginBtn').val();
formData.append(name, value); formData.append(id, value);
$.ajax({
url: URL, axios.post(URL, formData, {
type: 'POST', header: 'multipart/form-data'
data: formData, }).then(res => {
mimeType:"multipart/form-data", if (res.status === 200)
contentType: false,
cache: false,
processData:false,
success: function(data, textStatus, jqXHR)
{ {
console.log(data); console.log('Logged in');
}, }
error: function(jqXHR, textStatus, errorThrown) }).catch(error => {
{ console.log(error);
console.log(`XHR: ${jqXHR} \n Status: ${textStatus} \n Error: ${errorThrown}`);
}
}); });
e.preventDefault();
}) })
// Login end // Login end
}); });

View File

@ -1,19 +0,0 @@
$(window).on("load", function(){
dataFetch();
});
function dataFetch(){
$.ajax({
type: "GET",
url: "/Game-Jaming/Backend/controllers/GameJam/GetGameJam.php",
success: function(result){
console.log(result[0].name);
}
});
}
//console.log(result.name); ?gameJamId=1
//console.log(result[0].name); uden ?gameJamId=1

View File

@ -1,3 +1,6 @@
body{
text-align: center;
}
.HeaderPanel { .HeaderPanel {
position: fixed; position: fixed;
overflow: hidden; overflow: hidden;
@ -23,4 +26,74 @@
.HeaderLeft { .HeaderLeft {
float: left; float: left;
} }
/*Create game jam*/
#createGameJam{
justify-content: center;
display: grid;
}
#createGameJam input{
display: block;
position: center;
}
#startTime {
border-radius: 15px;
color: #474747;
background-color: rgba(255, 255, 255, .55);
border: double;
filter: invert(90%);
}
#endTime {
border-radius: 15px;
color: #474747;
background-color: rgba(255, 255, 255, .55);
border: double;
filter: invert(90%);
}
#startDate {
border-radius: 15px;
color: #474747;
background-color: rgba(255, 255, 255, .55);
border: double;
filter: invert(90%);
}
#endDate {
border-radius: 15px;
color: #474747;
background-color: rgba(255, 255, 255, .55);
border: double;
filter: invert(90%);
}
#nameOfGameJam {
background-color: rgb(18, 18, 18);
color: rgba(255, 255, 255, .55);
border-radius: 15px;
border: double;
}
#description {
background-color: rgb(18, 18, 18);
color: rgba(255, 255, 255, .55);
border-radius: 15px;
border: double;
width:400px;
height:250px;
}
#indsend {
border-radius: 15px;
color: rgba(255, 255, 255, .55);
background-color: rgb(18, 18, 18);
border: double;
}
/*Create Game Jam end*/

View File

@ -352,6 +352,65 @@ a:hover {
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
.box #NUDMinus {
color: rgba(255, 255, 255, .55);
background-color: transparent;
border: none;
float: left;
}
.box #NUDMinus:focus {
box-shadow: none;
}
.box #NUDMinus:focus-visible {
outline: none;
}
.box #NUDDisplay {
color: rgba(255, 255, 255, .55);
background-color: transparent;
border: none;
cursor: text;
width: 65%;
}
.box #NUDDisplay:focus {
box-shadow: none;
}
.box #NUDDisplay:focus-visible {
outline: none;
}
.box #NUDPlus {
color: rgba(255, 255, 255, .55);
background-color: transparent;
border: none;
float: right;
}
.box #NUDPlus:focus {
box-shadow: none;
}
.box #NUDPlus:focus-visible {
outline: none;
}
.box #GameJamSelect:focus {
box-shadow: none;
}
.box #GameJamSelect:hover {
color: rgba(255, 255, 255, .75);
}
.box #GameJamSelect ul {
background-color: red;
}
.box { .box {
background-color: rgb(18, 18, 18); background-color: rgb(18, 18, 18);
} }
@ -749,7 +808,7 @@ image_gruppenavn{
} }
.hasEvent { .hasEvent {
background-color: red; background-color: red;;
} }
/*Kalender slut*/ /*Kalender slut*/

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

12
bootstrap.php Normal file → Executable file
View File

@ -1,14 +1,8 @@
<?php <?php
require "vendor/autoload.php"; require_once "vendor/autoload.php";
use Illuminate\Database\Capsule\Manager as Capsule; use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule; $capsule = new Capsule;
$capsule->addConnection([ $con = json_decode(file_get_contents('config/database.json', true), true);
"driver" => "mysql", $capsule->addConnection($con);
"host" => "localhost",
"port" => "3306",
"database" => "testdb",
"username" => "root",
"password" => "V#_xWL6_"
]);
$capsule->setAsGlobal(); $capsule->setAsGlobal();
$capsule->bootEloquent(); $capsule->bootEloquent();

9
composer.json Normal file → Executable file
View File

@ -1,10 +1,15 @@
{ {
"require": { "require": {
"illuminate/database": "^8.30" "illuminate/database": "^8.30",
"ext-mysqli": "*",
"ext-sqlite3": "*",
"ext-fileinfo": "*"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [
"Backend/Models" "Backend/Models"
] ]
} },
"name": "sde_skp/game_jaming",
"description": "description"
} }

60
composer.lock generated Normal file → Executable file
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "f8dc5027639f0368374ccb33723ddcd2", "content-hash": "f7278c3dc731961ed65f3f31bf2b49f0",
"packages": [ "packages": [
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
@ -103,16 +103,16 @@
}, },
{ {
"name": "illuminate/collections", "name": "illuminate/collections",
"version": "v8.32.1", "version": "v8.34.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/collections.git", "url": "https://github.com/illuminate/collections.git",
"reference": "d7cc717a00064b40fa63a8ad522042005e1de1ed" "reference": "e18d6e4cf03dd597bc3ecd86fefc2023d0c7a5e8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/collections/zipball/d7cc717a00064b40fa63a8ad522042005e1de1ed", "url": "https://api.github.com/repos/illuminate/collections/zipball/e18d6e4cf03dd597bc3ecd86fefc2023d0c7a5e8",
"reference": "d7cc717a00064b40fa63a8ad522042005e1de1ed", "reference": "e18d6e4cf03dd597bc3ecd86fefc2023d0c7a5e8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -153,20 +153,20 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2021-03-08T17:22:22+00:00" "time": "2021-03-19T00:05:33+00:00"
}, },
{ {
"name": "illuminate/container", "name": "illuminate/container",
"version": "v8.32.1", "version": "v8.34.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/container.git", "url": "https://github.com/illuminate/container.git",
"reference": "3d6ce613f455093fdf8bd3c81b30104aef0b11e0" "reference": "0e38ee1632d470e56aece0079e6e22d13e6bea8e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/container/zipball/3d6ce613f455093fdf8bd3c81b30104aef0b11e0", "url": "https://api.github.com/repos/illuminate/container/zipball/0e38ee1632d470e56aece0079e6e22d13e6bea8e",
"reference": "3d6ce613f455093fdf8bd3c81b30104aef0b11e0", "reference": "0e38ee1632d470e56aece0079e6e22d13e6bea8e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -204,20 +204,20 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2021-02-12T21:15:27+00:00" "time": "2021-03-16T19:42:20+00:00"
}, },
{ {
"name": "illuminate/contracts", "name": "illuminate/contracts",
"version": "v8.32.1", "version": "v8.34.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/contracts.git", "url": "https://github.com/illuminate/contracts.git",
"reference": "9c7a9868d7485a82663d67109429094c8e4ed56d" "reference": "121cea1d8b8772bc7fee99c71ecf0f57c1d77b3b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/9c7a9868d7485a82663d67109429094c8e4ed56d", "url": "https://api.github.com/repos/illuminate/contracts/zipball/121cea1d8b8772bc7fee99c71ecf0f57c1d77b3b",
"reference": "9c7a9868d7485a82663d67109429094c8e4ed56d", "reference": "121cea1d8b8772bc7fee99c71ecf0f57c1d77b3b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -252,20 +252,20 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2021-02-26T13:17:03+00:00" "time": "2021-03-12T14:45:30+00:00"
}, },
{ {
"name": "illuminate/database", "name": "illuminate/database",
"version": "v8.32.1", "version": "v8.34.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/database.git", "url": "https://github.com/illuminate/database.git",
"reference": "f6a10cebd9bbd188ca66993168fb453439dbb50f" "reference": "74a165fd07b36cc0ea3558fa391b762867af87e8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/database/zipball/f6a10cebd9bbd188ca66993168fb453439dbb50f", "url": "https://api.github.com/repos/illuminate/database/zipball/74a165fd07b36cc0ea3558fa391b762867af87e8",
"reference": "f6a10cebd9bbd188ca66993168fb453439dbb50f", "reference": "74a165fd07b36cc0ea3558fa391b762867af87e8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -320,11 +320,11 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2021-03-09T14:06:15+00:00" "time": "2021-03-23T15:12:51+00:00"
}, },
{ {
"name": "illuminate/macroable", "name": "illuminate/macroable",
"version": "v8.32.1", "version": "v8.34.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/macroable.git", "url": "https://github.com/illuminate/macroable.git",
@ -370,16 +370,16 @@
}, },
{ {
"name": "illuminate/support", "name": "illuminate/support",
"version": "v8.32.1", "version": "v8.34.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/support.git", "url": "https://github.com/illuminate/support.git",
"reference": "2ef7ff288366a1ebe32f633196a1b90bd443acc3" "reference": "b7b27e758b68aad44558c62e7374328835895386"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/support/zipball/2ef7ff288366a1ebe32f633196a1b90bd443acc3", "url": "https://api.github.com/repos/illuminate/support/zipball/b7b27e758b68aad44558c62e7374328835895386",
"reference": "2ef7ff288366a1ebe32f633196a1b90bd443acc3", "reference": "b7b27e758b68aad44558c62e7374328835895386",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -434,7 +434,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2021-03-05T15:22:14+00:00" "time": "2021-03-21T13:37:37+00:00"
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
@ -1625,7 +1625,11 @@
"stability-flags": [], "stability-flags": [],
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": {
"ext-mysqli": "*",
"ext-sqlite3": "*",
"ext-fileinfo": "*"
},
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.0.0" "plugin-api-version": "2.0.0"
} }

0
config/database.json Normal file
View File