Keyword now gets its data from session, made a error pages display

This commit is contained in:
neerholt 2021-03-08 10:29:11 +01:00
parent 5d0e60cd9d
commit 913fdae646
3 changed files with 26 additions and 27 deletions

View File

@ -3,11 +3,12 @@ require "../bootstrap.php";
use Backend\Models\Group;
use Backend\Models\KeyWord;
session_start();
if(isset($_POST['submitKeyWord'])){
if (session_status() === PHP_SESSION_ACTIVE) {
if(isset($_POST['submitKeyWord'])){
//Find the group id
$group = Group::find($_POST['group_id']);
$group = Group::find($_SESSION['groupId']);
//if statement to find out if the group have use all their keyWords
if(KeyWord::where('group_id', $group->id)->count()<$group->groupAmount){
@ -30,7 +31,8 @@ if(isset($_POST['submitKeyWord'])){
}
//TODO make toast feedback
}
}else{
header("location: ../Frontend/index.php?login=notLoggein");
}

View File

@ -1,8 +1,3 @@
<?php
/*
require "../bootstrap.php";
*/
?>
<!DOCTYPE html>
<html lang="en">
@ -15,7 +10,6 @@ require "../bootstrap.php";
<form action="../Backend/keyWordsRemaining.php" method="POST">
<input type="text" name="key_word" placeholder="key word">
<input type="number" name="group_id" placeholder="group id">
<input type="submit" name="submitKeyWord" value="Submit">
</form>

3
Frontend/index.php Normal file
View File

@ -0,0 +1,3 @@
<?php
print_r($_GET);