diff --git a/_conf/db.php b/_conf/db.php
index f215f29..ef40ac8 100644
--- a/_conf/db.php
+++ b/_conf/db.php
@@ -1,19 +1,30 @@
$env['DB_HOST'] ?? 'localhost',
+ 'name' => $env['DB_NAME'] ?? 'my_webapp',
+ 'user' => $env['DB_USER'] ?? 'my_webapp',
+ 'pass' => $env['DB_PASSWORD'] ?? '',
+ 'port' => $env['DB_PORT'] ?? '3306',
+];
-if (!$db['host'] || !$db['name'] || !$db['user'] || !$db['pass'] || !$db['port']) {
+if (!$db['host'] || !$db['name'] || !$db['user']) {
die("DB configuration error: missing parameters. Please check your environment variables.");
}
+$db['dsn'] = 'mysql:host=' . $db['host'] . ';'
+ . 'port=' . $db['port'] . ';'
+ . 'dbname=' . $db['name'] . ';charset=utf8mb4';
-$db['dsn'] = 'mysql:host=' . $db['host'] . ';port='. $db['port'] .';dbname=' . $db['name'] . ';charset=utf8mb4';
+try {
+ $pdo = new PDO($db['dsn'], $db['user'], $db['pass']);
+ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+} catch (PDOException $e) {
+ die("Database connection error: " . $e->getMessage());
+}
-?>
\ No newline at end of file
+?>
diff --git a/_conf/env.php b/_conf/env.php
index af3ca11..52b5e61 100644
--- a/_conf/env.php
+++ b/_conf/env.php
@@ -1,24 +1,31 @@
\ No newline at end of file
diff --git a/_conf/global.php b/_conf/global.php
index cd012f8..0b8eb3f 100644
--- a/_conf/global.php
+++ b/_conf/global.php
@@ -1,5 +1,6 @@
\ No newline at end of file
diff --git a/_conf/protect.php b/_conf/protect.php
new file mode 100644
index 0000000..54d0801
--- /dev/null
+++ b/_conf/protect.php
@@ -0,0 +1,15 @@
+
\ No newline at end of file
diff --git a/admin/--edit-pwd b/admin/--edit-pwd
deleted file mode 100644
index 5c61159..0000000
--- a/admin/--edit-pwd
+++ /dev/null
@@ -1,153 +0,0 @@
-Le mot de passe ne peut pas être vide!';
- } else {
- // Générer le hash avec bcrypt
- $hash = password_hash($new_password, PASSWORD_BCRYPT);
-
- try {
- // Connexion à la base de données
- $pdo = new PDO("mysql:host=$db_host;dbname=$db_name;charset=utf8mb4", $db_user, $db_pass);
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-
- // Vérifier si la table admin existe
- $tables = $pdo->query("SHOW TABLES LIKE 'admin'")->fetchAll();
-
- if (count($tables) === 0) {
- // Créer la table admin si elle n'existe pas
- $pdo->exec("CREATE TABLE IF NOT EXISTS `admin` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `password_hash` varchar(255) NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
-
- // Insérer le nouveau mot de passe
- $stmt = $pdo->prepare("INSERT INTO admin (password_hash) VALUES (?)");
- $stmt->execute([$hash]);
- } else {
- // Vérifier si un enregistrement existe déjà
- $count = $pdo->query("SELECT COUNT(*) FROM admin")->fetchColumn();
-
- if ($count > 0) {
- // Mettre à jour le mot de passe existant
- $stmt = $pdo->prepare("UPDATE admin SET password_hash = ? WHERE id = 1");
- $stmt->execute([$hash]);
- } else {
- // Insérer un nouveau mot de passe
- $stmt = $pdo->prepare("INSERT INTO admin (password_hash) VALUES (?)");
- $stmt->execute([$hash]);
- }
- }
-
- $message = '
-
Mot de passe mis à jour avec succès!
-
Votre nouveau mot de passe: ' . htmlspecialchars($new_password) . '
-
Hash généré: ' . $hash . '
-
IMPORTANT: Supprimez ce fichier immédiatement après utilisation!
-
';
-
- } catch (PDOException $e) {
- $message = 'Erreur: ' . $e->getMessage() . '
';
- }
- }
-}
-?>
-
-
-
-
-
- Mise à jour du mot de passe admin
-
-
-
- Mise à jour du mot de passe admin
-
-
- ATTENTION: Ce fichier est destiné à un usage unique. Supprimez-le immédiatement après avoir mis à jour votre mot de passe!
-
-
-
-
-
-
-
- RAPPEL: N'oubliez pas de supprimer ce fichier après utilisation!
-
-
-
\ No newline at end of file
diff --git a/admin/assets/css/index.php b/admin/assets/css/index.php
new file mode 100644
index 0000000..04b9ba7
--- /dev/null
+++ b/admin/assets/css/index.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/admin/assets/index.php b/admin/assets/index.php
new file mode 100644
index 0000000..04b9ba7
--- /dev/null
+++ b/admin/assets/index.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/admin/assets/js/index.php b/admin/assets/js/index.php
new file mode 100644
index 0000000..04b9ba7
--- /dev/null
+++ b/admin/assets/js/index.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/admin/edit/index.php b/admin/edit/index.php
new file mode 100644
index 0000000..04b9ba7
--- /dev/null
+++ b/admin/edit/index.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/admin/edit-services.php b/admin/edit/services.php
similarity index 98%
rename from admin/edit-services.php
rename to admin/edit/services.php
index a3cc081..11e49f9 100644
--- a/admin/edit-services.php
+++ b/admin/edit/services.php
@@ -3,14 +3,6 @@ session_start();
include_once("../_conf/global.php");
include_once("../_conf/db.php");
-// Connecting to the database
-try {
- $pdo = new PDO($db['dsn'], $db['user'], $db['pass']);
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-} catch (PDOException $e) {
- die("Database connection error: " . $e->getMessage());
-}v
-
// Error and success messages
$error = '';
$success = '';
diff --git a/assets/css/index.php b/assets/css/index.php
new file mode 100644
index 0000000..04b9ba7
--- /dev/null
+++ b/assets/css/index.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/assets/index.php b/assets/index.php
new file mode 100644
index 0000000..04b9ba7
--- /dev/null
+++ b/assets/index.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/error/401.html b/error/401.html
new file mode 100644
index 0000000..6b4ce6f
--- /dev/null
+++ b/error/401.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 401 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 401
+
+ Access denied.
+
+ You need to log in to view this page.
+
+
+
+
diff --git a/error/403.html b/error/403.html
new file mode 100644
index 0000000..535af6e
--- /dev/null
+++ b/error/403.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ ! Error 403 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 403
+
+ Sorry, you don’t have permission to access this page.
+
+
+
+
diff --git a/error/404.html b/error/404.html
new file mode 100644
index 0000000..5aa2e73
--- /dev/null
+++ b/error/404.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 404 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 404
+
+ Oops! The page you’re looking for doesn’t exist or has been moved.
+
+ Let’s get you back on track.
+
+
+
+
diff --git a/error/405.html b/error/405.html
new file mode 100644
index 0000000..d14caff
--- /dev/null
+++ b/error/405.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 405 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 405
+
+ The method used is not allowed for this resource.
+
+ Please check and try another method.
+
+
+
+
diff --git a/error/408.html b/error/408.html
new file mode 100644
index 0000000..031f560
--- /dev/null
+++ b/error/408.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 408 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 408
+
+ Your request took too long to complete.
+
+ Please try again.
+
+
+
+
diff --git a/error/413.html b/error/413.html
new file mode 100644
index 0000000..5646f3f
--- /dev/null
+++ b/error/413.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 413 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 413
+
+ The data you sent is too big.
+
+ Try reducing the size and retrying.
+
+
+
+
diff --git a/error/414.html b/error/414.html
new file mode 100644
index 0000000..5cda010
--- /dev/null
+++ b/error/414.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 414 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 414
+
+ The URL is too long to be processed.
+
+ Please shorten the link or try a different one.
+
+
+
+
diff --git a/error/415.html b/error/415.html
new file mode 100644
index 0000000..f41f593
--- /dev/null
+++ b/error/415.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ ! Error 415 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 415
+
+ The media type you sent is not supported by this server.
+
+
+
+
diff --git a/error/429.html b/error/429.html
new file mode 100644
index 0000000..c15dc3d
--- /dev/null
+++ b/error/429.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 429 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 429
+
+ Slow down! You’ve sent too many requests.
+
+ Please wait and try again later.
+
+
+
+
diff --git a/error/500.html b/error/500.html
new file mode 100644
index 0000000..1484a49
--- /dev/null
+++ b/error/500.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 500 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 500
+
+ Whoops! Something went wrong on our side.
+
+ We’re on it, try again soon.
+
+
+
+
diff --git a/error/501.html b/error/501.html
new file mode 100644
index 0000000..14ceb28
--- /dev/null
+++ b/error/501.html
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+ ! Error 501 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 501
+
This feature is not supported by the server yet.
+
+
+
diff --git a/error/502.html b/error/502.html
new file mode 100644
index 0000000..aca1300
--- /dev/null
+++ b/error/502.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 502 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 502
+
+ Bad response from an upstream server.
+
+ Please try again later.
+
+
+
+
diff --git a/error/503.html b/error/503.html
new file mode 100644
index 0000000..0fb403c
--- /dev/null
+++ b/error/503.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 503 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 503
+
+ The server is temporarily unavailable.
+
+ Please try again shortly.
+
+
+
+
diff --git a/error/504.html b/error/504.html
new file mode 100644
index 0000000..6f7d6cc
--- /dev/null
+++ b/error/504.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ ! Error 504 ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error 504
+
+ The server took too long to respond.
+
+ Please try again later.
+
+
+
+
diff --git a/services.php b/services.php
index 950437c..e346db3 100644
--- a/services.php
+++ b/services.php
@@ -2,14 +2,6 @@
include_once("./_conf/global.php");
include_once("./_conf/db.php");
-// Connecting to the database
-try {
- $pdo = new PDO($db['dsn'], $db['user'], $db['pass']);
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-} catch (PDOException $e) {
- die("Database connection error: " . $e->getMessage());
-}
-
// Retrieving services from the database
try {
$stmt = $pdo->query("SELECT * FROM services ORDER BY order_num ASC");
@@ -29,7 +21,7 @@ $edit_mode = isset($_GET['edit']);
// If you are in edit mode, redirect to edit-services
if ($edit_mode) {
- header('Location: admin/edit-services');
+ header('Location: admin/edit/services');
exit;
}