1
0
forked from piqah/DevWeb

[forum] source code

This commit is contained in:
root
2026-01-10 00:36:22 +00:00
commit 0c9996065a
9 changed files with 302 additions and 0 deletions

7
includes/auth.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
function require_admin() {
if (!isset($_SESSION['admin'])) {
http_response_code(403);
die("Accès interdit");
}
}

16
includes/config.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
session_start();
define('ADMIN_USER', 'fredemonetise');
define('ADMIN_PASS', 'k2AhX[?5KX0z9J*BtP[!!2sa53Y');
if (ADMIN_PASS === false || ADMIN_PASS === '') {
error_log('[DEVWEB] ADMIN_PASS manquant');
die('Configuration serveur invalide');
}
define('FLAG', '{CTFM1:0=126XBVQnuhi0O°o-x.bM][ZB1GP=&GRYc5Q}');
$db = new PDO('sqlite:' . __DIR__ . '/../db/forum.sqlite');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

2
includes/footer.php Normal file
View File

@@ -0,0 +1,2 @@
</body>
</html>

18
includes/header.php Normal file
View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mini Forum YEAH!</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav>
<a href="index.php">Forum</a> |
<?php if (!isset($_SESSION['admin'])): ?>
<a href="login.php">Login</a> |
<?php else: ?>
<a href="flag.php">Flag</a> |
<a href="logout.php">Logout</a>
<?php endif; ?>
</nav>
<hr>