-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21edc2c
commit 5dec27f
Showing
5 changed files
with
105 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace PeopleHive\Processes\User; | ||
|
||
use Starlight\Session\Session; | ||
|
||
class IsAuthenticated { | ||
public function check(): bool | ||
{ | ||
if (!isset($_SESSION['uuid']) || !isset($_SESSION['starlight_token'])) { | ||
return false; | ||
} | ||
|
||
$session = new Session(); | ||
return $session->Verify($_SESSION['uuid'].'$'.date('Y-m-d')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace PeopleHive\Processes\User; | ||
|
||
use Starlight\Database\SQL; | ||
|
||
class UserInfo { | ||
private SQL $sql; | ||
|
||
public function __construct() { | ||
$this->sql = new SQL(DB_HOST, DB_USER, DB_PASS, DB_NAME); | ||
} | ||
|
||
public function getRole(): int|bool | ||
{ | ||
$Auth = new IsAuthenticated(); | ||
|
||
if ($Auth->Check()) { | ||
$query = $this->sql->Query("SELECT `role` FROM `users` WHERE `uuid` = '" . $this->sql->Escape($_SESSION['uuid']) . "'"); | ||
if ($query->num_rows != 0) { | ||
return $query->fetch_assoc()['role']; | ||
} else { | ||
return false; | ||
} | ||
} else { | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,55 @@ | ||
<?php | ||
|
||
var_dump($_SESSION); | ||
use PeopleHive\Processes\User\UserInfo; | ||
|
||
$UserInfo = new UserInfo(); | ||
$role = $UserInfo->getRole(); | ||
|
||
?><!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title><?= WEBSITE_NAME; ?></title> | ||
<link rel="stylesheet" href="/Assets/CSS/Font.css" type="text/css"> | ||
<link rel="stylesheet" href="/Assets/CSS/Dist.css" type="text/css"> | ||
</head> | ||
<body> | ||
<?php require_once __DIR__ . "/Include/Nav.php"; ?> | ||
|
||
<header> | ||
<h1>Dashboard</h1> | ||
</header> | ||
|
||
<main> | ||
<p class="text-center"> | ||
Welcome to <?= WEBSITE_NAME; ?>'s HR Portal. Please select an option below to get started. | ||
</p> | ||
|
||
<br><br> | ||
|
||
<div class="cards"> | ||
<a class="card-yellow" href="/profile">My Account</a> | ||
<?php if ($role >= 1) { ?> | ||
<a class="card-yellow" href="/dashboard/workplace">My Job</a> | ||
<a class="card-yellow" href="/dashboard/documents">My Documents</a> | ||
<a class="card-yellow" href="/dashboard/holidays">Holidays</a> | ||
<?php } ?> | ||
<a class="card-yellow" href="/jobs">Vacancies</a> | ||
<?php if ($role >= 2) { ?> | ||
<a class="card-yellow" href="/dashboard/jobs">Manage Vacancies</a> | ||
<?php } if ($role >= 3) { ?> | ||
<a class="card-yellow" href="/dashboard/company">My Company</a> | ||
<?php } ?> | ||
</div> | ||
|
||
<br><br><hr><br><br> | ||
|
||
<h2 class="text-center">About <?= WEBSITE_NAME; ?></h2> | ||
<br> | ||
<p> | ||
<?= file_get_contents(__DIR__ . '/../Content/Text/ABOUT.txt'); ?> | ||
</p> | ||
</main> | ||
|
||
<?php require_once __DIR__ . "/Include/Footer.php"; ?> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters