diff --git a/Dockerfile b/Dockerfile
index 0f39774..bc48a5c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,6 +2,9 @@ FROM php:8.2-apache
LABEL authors="matthieulmr"
COPY . /var/www/html
+
+RUN chown -R www-data:www-data /var/www/html
+
WORKDIR /var/www/html
RUN docker-php-ext-install pdo pdo_mysql
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..ce858f6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,14 @@
+Pour accéder au site :
+Lancez les conteneurs depuis la racine du projet avec la commande suivante (Dans un terminal qui accepte le bash par exemple GIT bash) :
+
+./launch-dockers.sh
+
+Une fois les conteneurs démarrés, le site sera accessible dans votre navigateur à l'adresse :
+
+http://localhost:8080/
+
+
+Acces au compte admin :
+
+Utilisateur : Admin
+Mdp : Ciccina28
diff --git a/admin/add.php b/admin/add.php
index 2c1088b..0dca1c7 100644
--- a/admin/add.php
+++ b/admin/add.php
@@ -1,7 +1,6 @@
+
-
-
- Ajouter un article
-
-
-
-
Ajouter un article
-
-
= htmlspecialchars($e) ?>
-
-
-
+
+
+ Ajouter un article
+
+
+
+
Ajouter un article
+
+
= htmlspecialchars($e) ?>
+
+
+
\ No newline at end of file
diff --git a/admin/board.php b/admin/board.php
index 50d0e30..be539e1 100644
--- a/admin/board.php
+++ b/admin/board.php
@@ -1,29 +1,29 @@
query('SELECT * FROM articles ORDER BY date_creation DESC');
$articles = $stmt->fetchAll();
?>
+
Admin - Tableau de bord
-
-
+
\ No newline at end of file
diff --git a/admin/delete.php b/admin/delete.php
index 1e5f327..fd72632 100644
--- a/admin/delete.php
+++ b/admin/delete.php
@@ -1,7 +1,6 @@
+
-
-
- Supprimer l'article
-
-
-
-
Supprimer l'article
-
Êtes-vous sûr de vouloir supprimer : = htmlspecialchars($article['titre']) ?> ?
-
-
+
+
+ Supprimer l'article
+
+
+
+
Supprimer l'article
+
Êtes-vous sûr de vouloir supprimer : = htmlspecialchars($article['titre']) ?> ?
+
+
\ No newline at end of file
diff --git a/admin/login.php b/admin/login.php
index 6b5352b..7210b6e 100644
--- a/admin/login.php
+++ b/admin/login.php
@@ -1,7 +1,6 @@
+
Connexion
-
-
Connexion
-
-
= $error ?>
-
+
+
Connexion
+
+
= $error ?>
+
\ No newline at end of file
diff --git a/article.php b/article.php
index b0222fb..77f6ff7 100644
--- a/article.php
+++ b/article.php
@@ -1,5 +1,4 @@
prepare('SELECT * FROM articles WHERE id = ?');
@@ -7,6 +6,7 @@ $stmt->execute([$id]);
$article = $stmt->fetch();
if (!$article) { http_response_code(404); die('
404 - Article introuvable
'); }
?>
+
= htmlspecialchars($article['titre']) ?>
diff --git a/assets/style.css b/assets/style.css
index 62a5203..12af6d4 100644
--- a/assets/style.css
+++ b/assets/style.css
@@ -4,11 +4,11 @@ body {
margin: 0;
padding: 20px;
background-color: #f4f4f4;
- color: #333;
+ color: #ffffff;
}
header {
- background: #333;
+ background: #ffffff;
color: #fff;
padding: 10px 0;
text-align: center;
@@ -16,7 +16,7 @@ header {
}
h1 {
- color: #444;
+ color: #ffffff;
border-bottom: 2px solid #ccc;
padding-bottom: 10px;
margin-top: 0;
@@ -28,7 +28,7 @@ article {
margin-bottom: 15px;
border: 1px solid #ddd;
border-radius: 5px;
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
+ box-shadow: 0 2px 4px rgba(253, 249, 249, 0.05);
}
article h2 a {
@@ -40,7 +40,6 @@ article h2 a:hover {
text-decoration: underline;
}
-/* Style spécifique pour l'Admin */
table {
width: 100%;
border-collapse: collapse;
@@ -57,7 +56,6 @@ table th {
background-color: #e2e2e2;
}
-/* Style pour les messages d'erreur */
.error {
color: red;
font-weight: bold;
diff --git a/bdd/init.sql b/bdd/init.sql
index 9bacfb3..db6475b 100644
--- a/bdd/init.sql
+++ b/bdd/init.sql
@@ -17,4 +17,4 @@ date_creation DATETIME DEFAULT CURRENT_TIMESTAMP
);
-INSERT INTO utilisateur (login, password) VALUES ('admin', '$2y$10$OVqu798zF7FF36HER0nZ9uOJ5tuuTR.kwPK2GTiqlPPYzR2szGzB6');
\ No newline at end of file
+INSERT INTO utilisateur (login, password) VALUES ('Admin', '$2y$12$Rtdu4PVCMi0hvY43vxAIN.1K7TmNxYwaE/idie5B3C1K45TKdobzq');
\ No newline at end of file
diff --git a/include/auth.php b/include/auth.php
new file mode 100644
index 0000000..63dfddf
--- /dev/null
+++ b/include/auth.php
@@ -0,0 +1,32 @@
+prepare('SELECT * FROM utilisateur WHERE login = ?');
+$stmt->execute([$login]);
+$user = $stmt->fetch();
+
+
+if ($user && password_verify($password, $user['password'])) {
+$_SESSION['user'] = $user['login'];
+return true;
+}
+return false;
+}
+
+
+function requireLogin() {
+if (!isLogged()) {
+header('Location: login.php');
+exit;
+}
+}
+?>
\ No newline at end of file
diff --git a/include/db.php b/include/db.php
index b8f285c..c395c8c 100644
--- a/include/db.php
+++ b/include/db.php
@@ -10,4 +10,5 @@ try {
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die('Erreur de connexion : ' . $e->getMessage());
-}
\ No newline at end of file
+}
+?>
\ No newline at end of file
diff --git a/index.php b/index.php
index dfdc0bb..4d927ac 100644
--- a/index.php
+++ b/index.php
@@ -1,9 +1,9 @@
query('SELECT * FROM articles ORDER BY date_creation DESC LIMIT 10');
$articles = $stmt->fetchAll();
?>
+
diff --git a/launch-dockers.sh b/launch-dockers.sh
old mode 100644
new mode 100755