frontend data cookie and optional key word for NewGameJam.php
This commit is contained in:
parent
2293fc669e
commit
99fd4e425a
|
@ -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()){
|
||||||
|
|
|
@ -43,3 +43,9 @@ function passwordValidate(string $password1): bool
|
||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeLogin(string $groupName, int $groupId)
|
||||||
|
{
|
||||||
|
setcookie("groupName", $groupName, 0, "/");
|
||||||
|
setcookie("groupId", $groupId, 0, "/");
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue