This commit is contained in:
2021-03-04 11:27:54 +01:00
parent f33fdf95a3
commit c3479e8e7b
6 changed files with 49 additions and 7 deletions
+41
View File
@@ -1 +1,42 @@
<?php
use Backend\Models\Group;
use Backend\Models\Password;
use Backend\Models\GameJam;
session_start();
$groupName = "";
$errors = array();
if(isset($_POST['reg_group'])){
$password = New Password;
$password->password = password_hash($_POST['password'] ,PASSWORD_DEFAULT);
if(!$password->save()){
return;
}
$group = new Group();
$group->password()->associate($password);
$group->gameJam()->associate(GameJam::find($_POST['gameJamId']));
$group->groupName = $groupName = $_POST['groupName'];
$group->groupAmount = $_POST['groupAmount'];
$group->votes = 0;
if(!$group->save()){
return;
}
$_SESSION['groupName'] = $groupName;
$_SESSION['success'] = "You are now logged in";
header('location: index.php');
}