Files
HotLunches/include/verify-admin.php
T
2026-10-19 15:22:52 -07:00

35 lines
737 B
PHP

<?php
//
// Verify that a valid admin user is logged before allowing access to this page
//
// Verify that user session is active
if (SessionActive() != 1) {
$error_message = "Your Session Has Expired";
include "login.html";
exit();
}
// Check if user is logged in
if (! UserLoggedIn()) {
$error_message = "You Are Not Logged In";
include "login.html";
exit();
}
// Ensure current user is an administrator
if ($_SESSION['UserInfo']['type'] != 'admin') {
$error_message = "Only An Administrator Can Access This Page";
$action = "logout";
include "login.html";
exit();
}
// Set up local variables
$current_user_name = $_SESSION['UserInfo']['first_name'] . " " . $_SESSION['UserInfo']['last_name'];
?>