folder restrokteer

This commit is contained in:
2021-03-09 10:45:05 +01:00
parent 66eefe37a5
commit fbdf9e675c
11 changed files with 113 additions and 5 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
require "../../../bootstrap.php";
use Backend\Models\AdminUser;
//Start the php session
session_start();
if(isset($_POST['ALogin'])){
$userName = $_POST["userName"];
$password = $_POST["password"];
$user = AdminUser::firstWhere('user_name', $userName );
if($user){
$hashedPassword = $user->password;
if(password_verify($password, $hashedPassword )){
$_SESSION['userName'] = $userName;
$_SESSION['Admin'] = true;
$_SESSION['userId'] = $user->id;
$_SESSION['success'] = "You are now logged in";
header('location: ../Frontend/index.php?login=success');
}else{
session_destroy();
header('location: ../Frontend/index.php?login=failed?reason=password');
}
}
else{
session_destroy();
header('location: ../Frontend/index.php?login=failed?reason=username');
}
}
+21
View File
@@ -0,0 +1,21 @@
<?php
require "../../../bootstrap.php";
use Backend\Models\GameJam;
if(isset($_SESSION['Admin'])){
if(isset($_POST['NewGameJam'])){
$gameJam = New GameJam();
$gameJam->name = $_POST["gameJam_name"];
$gameJam->start_time = $_POST["start_time"];
$gameJam->end_time = $_POST["end_time"];
$gameJam->description = $_POST["description"];
if($gameJam->save()){
}
else{
}
}
}
+4 -1
View File
@@ -9,7 +9,10 @@ if(isset($_SESSION['Admin'])){
if(isset($_POST['RestPassword'])){
$group = Group::find($_POST['groupId']);
if($group){
$group->password->password = password_hash("Aa123456&", PASSWORD_DEFAULT);
$group->password->password = password_hash($_POST['NewPassword'], PASSWORD_DEFAULT);
if($group->save()){
}
}
}
}
@@ -0,0 +1,27 @@
<?php
require "../../../bootstrap.php";
use Backend\Models\GameJam;
if(isset($_SESSION['Admin'])){
if(isset($_POST['UpdateGameJam'])) {
$gameJam = GameJam::find($_POST['game_jam_id']);
if($gameJam){
$gameJam->name = $_POST['name'];
$gameJam->start_time = $_POST['start_time'];
$gameJam->end_time = $_POST['start_time'];
if (!empty($_POST['key_word'])) {
$gameJam->key_word = $_POST['key_word'];
}
$gameJam->description = $_POST['description'];
if ($gameJam->save()) {
}
}
}
}