diff --git a/admin.php b/admin.php
new file mode 100644
index 0000000..d68cefe
--- /dev/null
+++ b/admin.php
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
+ prepare('SELECT id, password_hash FROM admins WHERE username = :username');
+ $stmt->bindValue(':username', $username, SQLITE3_TEXT);
+ $result = $stmt->execute();
+
+ if ($user = $result->fetchArray()) {
+ if (password_verify($password, $user['password_hash'])) {
+ $_SESSION['admin_id'] = $user['id'];
+ header('Location: admin.php');
+ exit;
+ }
+ }
+
+ showLoginForm('Identifiants incorrects');
+ return;
+ }
+
+ showLoginForm();
+}
+
+// Gérer le changement de mot de passe
+function handlePasswordChange() {
+ checkAuth();
+
+ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
+ header('Location: admin.php');
+ return;
+ }
+
+ $currentPassword = $_POST['current_password'] ?? '';
+ $newPassword = $_POST['new_password'] ?? '';
+ $confirmPassword = $_POST['confirm_password'] ?? '';
+
+ // Vérifier que les nouveaux mots de passe correspondent
+ if ($newPassword !== $confirmPassword) {
+ $_SESSION['error_message'] = "Les nouveaux mots de passe ne correspondent pas.";
+ header('Location: admin.php?action=show_change_password');
+ return;
+ }
+
+ // Vérifier que le nouveau mot de passe est assez long
+ if (strlen($newPassword) < 8) {
+ $_SESSION['error_message'] = "Le nouveau mot de passe doit faire au moins 8 caractères.";
+ header('Location: admin.php?action=show_change_password');
+ return;
+ }
+
+ $db = getDB();
+
+ // Vérifier l'ancien mot de passe
+ $stmt = $db->prepare('SELECT password_hash FROM admins WHERE id = :id');
+ $stmt->bindValue(':id', $_SESSION['admin_id'], SQLITE3_INTEGER);
+ $result = $stmt->execute();
+ $user = $result->fetchArray();
+
+ if (!password_verify($currentPassword, $user['password_hash'])) {
+ $_SESSION['error_message'] = "Le mot de passe actuel est incorrect.";
+ header('Location: admin.php?action=show_change_password');
+ return;
+ }
+
+ // Mettre à jour le mot de passe
+ $newHash = password_hash($newPassword, PASSWORD_DEFAULT);
+ $stmt = $db->prepare('UPDATE admins SET password_hash = :hash WHERE id = :id');
+ $stmt->bindValue(':hash', $newHash, SQLITE3_TEXT);
+ $stmt->bindValue(':id', $_SESSION['admin_id'], SQLITE3_INTEGER);
+
+ if ($stmt->execute()) {
+ $_SESSION['success_message'] = "Mot de passe changé avec succès.";
+ header('Location: admin.php');
+ } else {
+ $_SESSION['error_message'] = "Une erreur est survenue lors du changement de mot de passe.";
+ header('Location: admin.php?action=show_change_password');
+ }
+ return;
+}
+
+// Gérer la déconnexion
+function handleLogout() {
+ session_destroy();
+ header('Location: admin.php');
+ exit;
+}
+
+// Router principal
+$action = $_GET['action'] ?? 'home';
+
+switch ($action) {
+ case 'login':
+ handleLogin();
+ break;
+
+ case 'logout':
+ handleLogout();
+ break;
+
+ case 'show_change_password':
+ showChangePasswordForm();
+ break;
+
+ case 'change_password':
+ handlePasswordChange();
+ break;
+
+ default:
+ showAdminInterface();
+ break;
+}
+?>
\ No newline at end of file
diff --git a/arbre-img.php b/arbre-img.php
new file mode 100644
index 0000000..aa0bf28
--- /dev/null
+++ b/arbre-img.php
@@ -0,0 +1,247 @@
+ 0) {
+ $_SESSION['success_message'] = "$successCount image(s) téléversée(s) avec succès.";
+ }
+ if (!empty($errors)) {
+ $_SESSION['error_message'] = implode("\n", $errors);
+ }
+ break;
+
+ case 'delete':
+ $images = $_POST['images'] ?? [];
+ $deleteCount = 0;
+
+ foreach ($images as $image) {
+ $imagePath = $currentPath . '/' . basename($image);
+ if (isSecurePath($imagePath) && file_exists($imagePath)) {
+ if (unlink($imagePath)) {
+ $deleteCount++;
+ }
+ }
+ }
+
+ if ($deleteCount > 0) {
+ $_SESSION['success_message'] = "$deleteCount image(s) supprimée(s).";
+ }
+ break;
+ }
+ }
+ header('Location: arbre-img.php?path=' . urlencode($currentPath));
+ exit;
+}
+
+// Récupérer les images du dossier courant
+$images = [];
+$tempImages = [];
+foreach (new DirectoryIterator($currentPath) as $file) {
+ if ($file->isDot()) continue;
+ if ($file->isFile()) {
+ $extension = strtolower($file->getExtension());
+ if (in_array($extension, ALLOWED_EXTENSIONS)) {
+ $tempImages[] = [
+ 'name' => $file->getFilename(),
+ 'time' => $file->getCTime()
+ ];
+ }
+ }
+}
+
+// Trier par date de création décroissante
+usort($tempImages, function($a, $b) {
+ return $b['time'] - $a['time'];
+});
+
+// Extraire uniquement les noms de fichiers
+$images = array_map(function($img) {
+ return $img['name'];
+}, $tempImages);
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Glissez-déposez vos images ici ou cliquez sur "Ajouter des images"
+
+
+
+
+
+
+
+
+
diff --git a/arbre.php b/arbre.php
new file mode 100644
index 0000000..6414ef1
--- /dev/null
+++ b/arbre.php
@@ -0,0 +1,242 @@
+';
+ foreach (new DirectoryIterator($path) as $item) {
+ if ($item->isDot()) continue;
+ if ($item->isDir()) {
+ $fullPath = $item->getPathname();
+ $info = getAlbumInfo($fullPath);
+ $isCurrentPath = realpath($fullPath) === $currentPath;
+ $hasSubfolders = hasSubfolders($fullPath);
+
+ $output .= '