From 751c100b7371e7038828a5b4f0c2e32f082dfb88 Mon Sep 17 00:00:00 2001 From: Natouille Date: Wed, 9 Oct 2024 16:29:22 +0200 Subject: [PATCH] ajout de l'enregistrement de site --- .idea/.name | 1 + .idea/vcs.xml | 1 - assets/css/style.css | 82 ++++++++++++++++++++++++++++++++++++-- assets/data/data.json | 3 ++ index.php | 91 +++++++++++++++++++++++++++++++++---------- 5 files changed, 153 insertions(+), 25 deletions(-) create mode 100644 .idea/.name create mode 100644 assets/data/data.json diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..e8055db --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +404.php \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 15a96c8..94a25f7 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,6 +2,5 @@ - \ No newline at end of file diff --git a/assets/css/style.css b/assets/css/style.css index a6a84c4..b01aaeb 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -25,6 +25,10 @@ h1, img { margin: 0; } +h2 { + text-align: center; +} + #titre { display: flex; @@ -38,10 +42,11 @@ main { width: 100%; display: flex; - justify-content: center; + flex-direction: column; + align-items: center; } -.projects-list { +.projects-list, .registered-sites { width: 95%; height: 100%; @@ -49,11 +54,11 @@ main { display: flex; flex-wrap: wrap; - justify-content: space-between; + justify-content: center; } .project { - width: 20%; + width: 15%; height: 20vh; min-width: 150px; @@ -85,4 +90,73 @@ main { .button { background-color: ; +} + +hr { + width: 80%; +} + +.site { + width: 15%; + height: 13vh; + + min-width: 150px; + min-height: 100px; + + display: flex; + flex-direction: column; + justify-content: center; + + margin: 25px; + + background-color: #3b3b3b; + + text-align: center; + + border: solid 2px white; + border-radius: 15px; +} + +.site h2 { + margin: 20px; +} + +.form-hr { + width: 40%; +} + +form { + width: 100%; + + display: flex; + flex-direction: column; + align-items: center; +} + +form input { + width: 30%; + height: 5vh; + + margin: 5px 0px; +} + +form input[type="text"] { + color: white; + background-color: #1f1f1f; + + outline : none; + + border: none; + border-bottom: solid white 1px; +} + +form input[type=submit] { + width: 15%; + + font-size: 1em; + + border: none; + border-radius: 5px; + + margin: 25px 0px 10px 0px; } \ No newline at end of file diff --git a/assets/data/data.json b/assets/data/data.json new file mode 100644 index 0000000..c44dc44 --- /dev/null +++ b/assets/data/data.json @@ -0,0 +1,3 @@ +[ + +] \ No newline at end of file diff --git a/index.php b/index.php index 0452beb..945d687 100644 --- a/index.php +++ b/index.php @@ -5,40 +5,91 @@ - - Project.PHP -
-

Projects.

logo php" ?> +
+

Projects.

logo php" ?> +

Bienvenue sur Projects.php

+ Mes Projet PHP +
-

Bienvenue sur Projects.php

+
- Mes Projet PHP +
+ "; + echo "

$fichier

"; + echo ""; + echo "
"; + } + } + ?> + -
+
-
-
+

Sites enregistrés

- "; - echo "

$fichier

"; - echo ""; +
+ "; + echo "

" . htmlspecialchars($site['name']) . "

"; + echo "" . htmlspecialchars($site['url']) . ""; echo "
"; } + } else { + echo "

Aucun site enregistré.

"; } - ?> + } else { + echo "

Le fichier de données n'existe pas.

"; + } + ?> +
+ +
+ +
+

Ajouté un site

+ + + +
+ +
- -
+ + $name, + 'url' => $url + ); + if (file_exists($jsonFile)) { + $jsonData = file_get_contents($jsonFile); + $data = json_decode($jsonData, true); + } else { + $data = array(); + } + $data[] = $formData; + $newJsonData = json_encode($data, JSON_PRETTY_PRINT); + file_put_contents($jsonFile, $newJsonData); +} +?> - \ No newline at end of file +