Login fix
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isAdmin(){
|
||||
function isAdmin(): bool
|
||||
{
|
||||
session_start();
|
||||
return isset($_SESSION['admin']);
|
||||
}
|
||||
|
||||
@@ -19,17 +19,17 @@ if(isset($_POST['aLogin'])){
|
||||
$_SESSION['userName'] = $userName;
|
||||
$_SESSION['admin'] = true;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
header('location: ../Frontend/index.php?login=success');
|
||||
header('location: ../../../Frontend/index.php?login=success');
|
||||
}else{
|
||||
session_destroy();
|
||||
header('location: ../Frontend/index.php?login=failed?reason=password');
|
||||
header('location: ../../../Frontend/index.php?login=failed?reason=password');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
session_destroy();
|
||||
header('location: ../Frontend/index.php?login=failed?reason=username');
|
||||
header('location: ../../../Frontend/index.php?login=failed?reason=username');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "Admin.php";
|
||||
use Backend\Models\GameJam;
|
||||
|
||||
var_dump($_POST);
|
||||
|
||||
session_start();
|
||||
|
||||
if(isAdmin()){
|
||||
if(isset($_POST['newGameJam'])){
|
||||
$gameJam = New GameJam();
|
||||
|
||||
$gameJam->name = $_POST["gameJamName"];
|
||||
$gameJam->start_time = $_POST["startDate"]."T".$_POST["startTime"];
|
||||
$gameJam->end_time = $_POST["endDate"]."T".$_POST["endTime"];
|
||||
$gameJam->description = $_POST["description"];
|
||||
|
||||
if($gameJam->save()){
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "Admin.php";
|
||||
use Backend\Models\GameJam;
|
||||
|
||||
if(isAdmin()){
|
||||
if(isset($_POST['updateGameJam'])) {
|
||||
$gameJam = GameJam::find($_POST['gameJamId']);
|
||||
if($gameJam){
|
||||
|
||||
$gameJam->name = $_POST['name'];
|
||||
|
||||
$gameJam->start_time = $_POST["startDate"]."T".$_POST["startTime"];
|
||||
|
||||
$gameJam->end_time = $_POST["endDate"]."T".$_POST["endTime"];
|
||||
|
||||
if (!empty($_POST['key_word'])) {
|
||||
$gameJam->key_word = $_POST['keyWord'];
|
||||
}
|
||||
|
||||
$gameJam->description = $_POST['description'];
|
||||
if ($gameJam->save()) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user