From b994a8cfb9cf146df01e437147e8719222725da4 Mon Sep 17 00:00:00 2001
From: Esteban
Date: Fri, 29 May 2026 13:56:52 +0200
Subject: [PATCH] Sauvegarde de l'ajout de projet
---
database/scriptDatabase.sql | 11 +++
functions/addProject.php | 52 ++++++++++
functions/checkLogin.php | 2 +-
.../databaseConnection.php | 0
pages/contact.php | 7 ++
pages/projects.php | 41 +++++++-
styles/primary_css.css | 98 +++++++++++++++++++
7 files changed, 209 insertions(+), 2 deletions(-)
create mode 100644 functions/addProject.php
rename {database => functions}/databaseConnection.php (100%)
create mode 100644 pages/contact.php
diff --git a/database/scriptDatabase.sql b/database/scriptDatabase.sql
index 86d6c89..3e82769 100644
--- a/database/scriptDatabase.sql
+++ b/database/scriptDatabase.sql
@@ -23,6 +23,17 @@ CREATE TABLE IF NOT EXISTS users (
UNIQUE INDEX idx_username (username)
);
+-- Création de la table projects : (Généré par Beekeeper Studio)
+CREATE TABLE IF NOT EXISTS projects (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ title VARCHAR(100) NOT NULL,
+ tags VARCHAR(255) NULL,
+ description TEXT NOT NULL,
+ image_url VARCHAR(255) NOT NULL, -- Stockage de l'image par URL (exemple : par CDN)
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (id)
+);
+
-- Compte de test
INSERT INTO users (username, password, role)
VALUES ('admin', 'admin', 'admin');
\ No newline at end of file
diff --git a/functions/addProject.php b/functions/addProject.php
new file mode 100644
index 0000000..1cff360
--- /dev/null
+++ b/functions/addProject.php
@@ -0,0 +1,52 @@
+prepare('INSERT INTO projects (title, tags, description, image_url) VALUES (:title, :tags, :description, :image_url)');
+
+ // On execute la requete préparée
+ $stmt->execute([
+ ':title' => $title,
+ ':tags' => $tags,
+ ':description' => $description,
+ ':image_url' => $image_url
+ ]);
+
+ // Redirection vers projects.php ds que la requete est executée
+ header('Location: projects.php');
+ exit;
+
+ } catch (PDOException $e) {
+ // En cas d'erreur :
+ echo "Erreur pendant l'ajout du projet: " . $e->getMessage();
+ exit;
+ }
+ } else {
+ echo "Veuillez remplir tous les champs obligatoires.";
+ exit;
+ }
+} else {
+ // Si on y accède de façon peu légitime sans requête POST on refuse
+ header('Location: projects.php');
+ exit;
+}
+?>
diff --git a/functions/checkLogin.php b/functions/checkLogin.php
index dd62256..0ec5bfa 100644
--- a/functions/checkLogin.php
+++ b/functions/checkLogin.php
@@ -6,7 +6,7 @@
session_start();
// Ajout de connexion a la bdd
-require_once('./../database/databaseConnection.php');
+require_once('./databaseConnection.php');
// La requête doit être un POST sinon on l'a refuse
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
diff --git a/database/databaseConnection.php b/functions/databaseConnection.php
similarity index 100%
rename from database/databaseConnection.php
rename to functions/databaseConnection.php
diff --git a/pages/contact.php b/pages/contact.php
new file mode 100644
index 0000000..2d2656a
--- /dev/null
+++ b/pages/contact.php
@@ -0,0 +1,7 @@
+
+
+
+ $message
"; } ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/styles/primary_css.css b/styles/primary_css.css
index e4182f1..25c0543 100644
--- a/styles/primary_css.css
+++ b/styles/primary_css.css
@@ -111,4 +111,102 @@ nav a {
.login-card input[type="submit"]:hover {
background-color: #5a52e0;
+}
+
+/* ---- PAGE AJOUT PROJET ---- */
+.project-container {
+ display: flex;
+ justify-content: center;
+ padding: 40px 20px;
+}
+
+.project-card {
+ background-color: #111116; /* Fond très sombre comme sur l'image */
+ border: 1px dashed #3a3a5e; /* Bordure pointillée */
+ border-radius: 12px;
+ padding: 30px;
+ width: 800px;
+}
+
+.project-header h2 {
+ margin-top: 0;
+ font-size: 20px;
+ display: flex;
+ align-items: center;
+}
+
+.badge-admin {
+ color: #6c63ff; /* Ton violet */
+ font-size: 14px;
+ margin-left: 10px;
+ font-weight: normal;
+}
+
+.form-row {
+ display: flex;
+ gap: 20px;
+ margin-bottom: 20px;
+}
+
+.half-width {
+ flex: 1;
+}
+
+.form-group {
+ margin-bottom: 20px;
+}
+
+.form-group label {
+ display: block;
+ color: #aaaaaa;
+ margin-bottom: 8px;
+ font-size: 14px;
+}
+
+/* Inputs reprenant ton style login */
+.project-card input[type="text"],
+.project-card input[type="url"],
+.project-card textarea {
+ width: 100%;
+ background-color: #1a1a24;
+ border: 1px solid #2a2a3e;
+ border-radius: 6px;
+ color: white;
+ padding: 12px;
+ box-sizing: border-box;
+}
+
+.project-card textarea {
+ min-height: 100px;
+ resize: vertical;
+}
+
+/* Zone pour l'URL (qui remplace l'upload de fichier) */
+.url-input-zone {
+ border: 1px dashed #3a3a5e;
+ border-radius: 6px;
+ padding: 40px 20px;
+ text-align: center;
+ background-color: #15151c;
+}
+
+.url-input-zone input {
+ width: 80%;
+ margin-top: 15px;
+}
+
+/* Bouton violet */
+.btn-submit {
+ background-color: #6c63ff;
+ color: white;
+ border: none;
+ border-radius: 8px;
+ padding: 12px 24px;
+ font-size: 15px;
+ font-weight: bold;
+ cursor: pointer;
+}
+
+.btn-submit:hover {
+ background-color: #5a52e0;
}
\ No newline at end of file