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
+37
View File
@@ -0,0 +1,37 @@
<?php
require "../../../bootstrap.php";
use Backend\Models\Group;
use Backend\Models\Password;
//Start the php session
session_start();
if(isset($_POST['login'])){
$groupName = $_POST["groupName"];
$password = $_POST["password"];
$group = Group::firstWhere('group_name', $groupName );
if($group){
$hashedPassword = $group->password->password;
if(password_verify($password, $hashedPassword )){
$_SESSION['groupName'] = $groupName;
$_SESSION['groupId'] = $group->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=group');
}
}