Initial commit

This commit is contained in:
Porawit Dongwang
2026-09-16 23:20:08 +07:00
commit 0041668dbb
32577 changed files with 3687927 additions and 0 deletions
@@ -0,0 +1,30 @@
<?php
function isLoggedIn() {
return isset($_SESSION['user_id']);
}
function requireLogin() {
if (!isLoggedIn()) {
header("Location: index.php");
exit;
}
}
function requireAdmin() {
if (!isLoggedIn() || $_SESSION['role'] !== 'admin') {
echo "<script>
document.addEventListener('DOMContentLoaded', function() {
Swal.fire({
icon: 'error',
title: 'ไม่มีสิทธิ์เข้าถึงหน้านี้',
confirmButtonColor: '#4f46e5',
confirmButtonText: 'ตกลง'
}).then(() => {
window.location.href = 'dashboard.php';
});
});
</script>";
exit;
}
}
?>