after role back

This commit is contained in:
2021-03-26 11:00:45 +01:00
parent 0131511be1
commit bcb6bf0bf4
4 changed files with 38 additions and 27 deletions
+9
View File
@@ -8,3 +8,12 @@ function isAdmin(): bool
return isset($_SESSION['admin']);
}
function makeAdminLogin(string $userName)
{
setcookie("userName", $userName, [
'expires' => 0,
'samesite' => 'Strict',
'path' => '/'
]);
}
+1
View File
@@ -20,6 +20,7 @@ if(isset($_POST['aLogin'])){
$_SESSION['admin'] = true;
$_SESSION['success'] = "You are now logged in";
http_response_code(200);
makeAdminLogin($userName);
}else{
session_destroy();
http_response_code(401);
+2 -1
View File
@@ -1,7 +1,7 @@
<?php
session_start();
session_unset();
session_destroy();
$cookieCon = array(
@@ -11,5 +11,6 @@ $cookieCon = array(
);
setcookie("groupName", null, $cookieCon);
setcookie("groupId", null, $cookieCon);
setcookie("userName", null, $cookieCon);
echo http_response_code(200);