1
0
mirror of synced 2025-12-28 00:23:25 +00:00

fix(public) better structure

This commit is contained in:
Valentin
2024-06-14 10:48:27 +02:00
parent f9d50f5b2b
commit d7cdb94316
45 changed files with 252 additions and 36 deletions

View File

@@ -0,0 +1,34 @@
<?php
session_start();
include __DIR__ . '/../../config.php';
$page = basename($_SERVER['PHP_SELF']);
if (!isset($_SESSION['user_id']) && $page !== 'login.php' && $page !== 'register.php') {
header("Location: login.php");
exit();
} else if (isset($_SESSION['user_id']) && ($page === 'login.php' || $page === 'register.php')) {
header("Location: index.php");
exit();
}
include 'header.php';
include 'navbar.php';
include __DIR__ . '/../../services/db.php';
?>
<main class="container mt-4">
<?php include $content; ?>
</main>
<?php include 'footer.php'; ?>
<script>
window.addEventListener('load', function() {
document.body.style.display = 'block';
});
</script>
</body>
</html>