mirror of
https://hub.gitmirror.com/https://github.com/ExamAware/ExamCloudSchedule
synced 2025-04-29 13:46:35 +00:00
23 lines
537 B
PHP
23 lines
537 B
PHP
<?php
|
|
session_start();
|
|
|
|
$users_file = __DIR__.'/users.json';
|
|
|
|
function checkLogin() {
|
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
}
|
|
|
|
function verifyUser($username, $password) {
|
|
global $users_file;
|
|
$users = json_decode(file_get_contents($users_file), true);
|
|
foreach ($users as $user) {
|
|
if ($user['username'] === $username && $user['password'] === md5($password)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
?>
|