27 lines
612 B
PHP
27 lines
612 B
PHP
<?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('groupName', $groupName );
|
|
if($group){
|
|
$hashedPassword = $group->password->password;
|
|
if(password_verify($password, $hashedPassword )){
|
|
$_SESSION['groupName'] = $groupName;
|
|
$_SESSION['success'] = "You are now logged in";
|
|
header('location: ../Frontend/group.php?login=success');
|
|
}
|
|
}
|
|
|
|
|
|
} |