Téléverser les fichiers vers "src/includes"

fichiers php de includes
This commit is contained in:
2025-11-02 22:20:14 +00:00
parent 82bd95a0fc
commit c38e1acea9
4 changed files with 43 additions and 0 deletions

14
src/includes/config.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
define('DB_HOST', 'db'); // Nom du service dans docker-compose.yml
define('DB_NAME', 'cms'); // Nom de la base
define('DB_USER', 'user'); // Utilisateur MySQL
define('DB_PASS', 'password'); // Mot de passe MySQL
try {
$pdo = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER, DB_PASS);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connexion à la base de données réussie !";
} catch (PDOException $e) {
die("Erreur de connexion : " . $e->getMessage());
}
?>

4
src/includes/footer.php Normal file
View File

@@ -0,0 +1,4 @@
<footer style="text-align: center; margin-top: 20px; padding: 10px; background: #333; color: white;">
<p>&copy; 2025 - Mon CMS</p>
<p><a href="admin/login.php" style="color: white;">Espace Administration</a></p>
    </footer>

10
src/includes/function.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
function isLoggedIn() {
return isset($_SESSION['user_id']);
}
function redirect($url) {
header("Location: $url");
    exit;
}
?>

15
src/includes/header.php Normal file
View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mon CMS</title>
<link rel="stylesheet" href="/assets/css/style.css">
</head>
<body>
<header>
<h1>Mon CMS Simplifié</h1>
<nav>
<a href="admin/login.php">Connexion Admin</a>
</nav>
    </header>