Téléverser les fichiers vers "article-index-css"
This commit is contained in:
14
article-index-css/Instructions.txt
Normal file
14
article-index-css/Instructions.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
INSTRUCTIONS POUR LANCER LE PROJET CMS SIMPLIFIE
|
||||||
|
|
||||||
|
1. Installer XAMPP sur le PC (Apache + MySQL).
|
||||||
|
2. Démarrer Apache et MySQL dans XAMPP.
|
||||||
|
3. Copier le dossier "cms_simplifie" dans : C:\xampp\htdocs\
|
||||||
|
4. Ouvrir un navigateur et aller sur : http://localhost/phpmyadmin
|
||||||
|
5. Créer une base de données : cms_simplifie
|
||||||
|
6. Dans phpMyAdmin, importer le fichier "database.sql" fourni.
|
||||||
|
7. Lancer le site :
|
||||||
|
Page publique : http://localhost/cms_simplifie/
|
||||||
|
Page administrateur : http://localhost/cms_simplifie/admin/connexion.php
|
||||||
|
8. Identifiants administrateur :
|
||||||
|
Login : admin
|
||||||
|
Mot de passe : admin123
|
||||||
22
article-index-css/article.php
Normal file
22
article-index-css/article.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
require 'includes/db.php';
|
||||||
|
include 'includes/header.php';
|
||||||
|
|
||||||
|
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
|
||||||
|
die("<h2>Erreur 404 - Article introuvable</h2>");
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = (int) $_GET['id'];
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM articles WHERE id = ?");
|
||||||
|
$stmt->execute([$id]);
|
||||||
|
$article = $stmt->fetch();
|
||||||
|
|
||||||
|
if (!$article) {
|
||||||
|
echo "<h2>Erreur 404 - Article introuvable</h2>";
|
||||||
|
} else {
|
||||||
|
echo "<h2>" . htmlspecialchars($article['titre']) . "</h2>";
|
||||||
|
echo "<p>" . nl2br(htmlspecialchars($article['contenu'])) . "</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
include 'includes/footer.php';
|
||||||
|
?>
|
||||||
18
article-index-css/database.sql
Normal file
18
article-index-css/database.sql
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
CREATE DATABASE IF NOT EXISTS cms_simplifie;
|
||||||
|
USE cms_simplifie;
|
||||||
|
|
||||||
|
CREATE TABLE utilisateur (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
login VARCHAR(50),
|
||||||
|
password VARCHAR(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE articles (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
titre VARCHAR(255),
|
||||||
|
contenu TEXT,
|
||||||
|
date_creation DATETIME
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO utilisateur (login, password)
|
||||||
|
VALUES ('admin', '$2y$10$Z2Wxdqeh98H8qDdsK4QvGeZZPaAulxGZ2gUxO4ePgQ1Qsh9TY6Z.C');
|
||||||
22
article-index-css/index.php
Normal file
22
article-index-css/index.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
require 'includes/db.php';
|
||||||
|
include 'includes/header.php';
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM articles ORDER BY date_creation DESC LIMIT 10";
|
||||||
|
$stmt = $pdo->query($sql);
|
||||||
|
$articles = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h2>Derniers articles</h2>
|
||||||
|
|
||||||
|
<?php if (empty($articles)): ?>
|
||||||
|
<p>Aucun article pour le moment.</p>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($articles as $a): ?>
|
||||||
|
<h3><a href="article.php?id=<?= $a['id'] ?>"><?= htmlspecialchars($a['titre']) ?></a></h3>
|
||||||
|
<p><?= substr(htmlspecialchars($a['contenu']), 0, 150) ?>...</p>
|
||||||
|
<hr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php include 'includes/footer.php'; ?>
|
||||||
90
article-index-css/style.css
Normal file
90
article-index-css/style.css
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/* === STYLE GLOBAL === */
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #1111b9;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === HEADER & TITRES === */
|
||||||
|
h1, h2, h3 {
|
||||||
|
text-align: center;
|
||||||
|
color: #2c3e50;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === FORMULAIRES === */
|
||||||
|
form {
|
||||||
|
max-width: 400px;
|
||||||
|
margin: 20px auto;
|
||||||
|
padding: 70px;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="text"], input[type="password"], textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
margin-top: 5px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: #a7c2d3;
|
||||||
|
color: rgb(214, 89, 89);
|
||||||
|
border: none;
|
||||||
|
padding: 10px 15px;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background-color: #a11d1d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === TABLEAUX === */
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 90%;
|
||||||
|
margin: 20px auto;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #792020;
|
||||||
|
color: rgb(163, 31, 31);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === LIENS === */
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #bd1212;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === MESSAGES === */
|
||||||
|
p {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
p[style*="color:green"] {
|
||||||
|
color: #27ae60 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
p[style*="color:red"] {
|
||||||
|
color: #e74c3c !important;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user