From 6f67a7def345b990057bc657bd35233f3eff4047 Mon Sep 17 00:00:00 2001 From: romaing Date: Thu, 21 Aug 2025 12:14:39 +0200 Subject: [PATCH 1/2] cleaned ReadMe --- ReadMe.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index f4255bb..5fec79e 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,18 +1,17 @@ # QuestionsPourUnChampignon -## Auteur : Lucas Hureaux -### Ce projet est un quiz. Le but : répondre à toutes les questions. Plus de détails dans les instructions du quiz situés dans le menu principal. +**Auteur :** [Lucas Hureaux](https://github.com/LucBlocker01) -## Instructions : +Ce projet est un quiz. Le but : répondre à toutes les questions. Plus de détails dans les instructions du quiz situés dans le menu principal. -### 1. Si ce n'est pas déjà fait, télécharger PHP 8.1 au minimum (je ne sais pas si les versions antérieurs vont fonctionner pour ce projet). Des tutos sur Internet vous aiderons là-dessus. +## Instructions : -### 2. Ouvrir le répertoire principal du projet (le dossier dans laquelle se trouve ce fichier readme) et ouvrir la boîte de commande Powershell en faisant clic droit + shift et sélectionner "Ouvrir la fenêtre Powershell ici". +1. Si ce n'est pas déjà fait, télécharger PHP 8.1 au minimum (je ne sais pas si les versions antérieurs vont fonctionner pour ce projet). Des tutos sur Internet vous aiderons là-dessus. -### 3. Taper la commande suivante : +2. Ouvrir le répertoire principal du projet (le dossier dans laquelle se trouve ce fichier readme) et ouvrir la boîte de commande Powershell en faisant clic droit + shift et sélectionner "Ouvrir la fenêtre Powershell ici". -```php -S localhost:8000``` +3. Taper la commande suivante : `php -S localhost:8000` -### 4. Ouvrir un navigateur web et taper dans la boîte URL "[localhost:8000/public/index.html](http://localhost:8000/public/index.html)" +4. Ouvrir un navigateur web et taper dans la boîte URL : [localhost:8000/public/index.html](http://localhost:8000/public/index.html) -### 5. Suivez les instructions en cliquant sur "Instructions" dans le menu principal \ No newline at end of file +5. Suivez les instructions en cliquant sur "Instructions" dans le menu principal From d3c50bc21fa0bbcc9d5fb2dd20186e8f23f176cd Mon Sep 17 00:00:00 2001 From: romaing Date: Thu, 21 Aug 2025 12:23:06 +0200 Subject: [PATCH 2/2] moved quizCreator.php in public and updated ReadMe to expose only public --- ReadMe.md | 2 +- public/js/utils.js | 2 +- public/quizCreator.php | 7 +++++++ src/classes/Question.php | 2 +- src/classes/Quiz.php | 4 ++-- src/questionGenerator.php | 4 ++-- src/quizCreator.php | 7 ------- 7 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 public/quizCreator.php delete mode 100644 src/quizCreator.php diff --git a/ReadMe.md b/ReadMe.md index 5fec79e..9d34445 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -10,7 +10,7 @@ Ce projet est un quiz. Le but : répondre à toutes les questions. Plus de déta 2. Ouvrir le répertoire principal du projet (le dossier dans laquelle se trouve ce fichier readme) et ouvrir la boîte de commande Powershell en faisant clic droit + shift et sélectionner "Ouvrir la fenêtre Powershell ici". -3. Taper la commande suivante : `php -S localhost:8000` +3. Taper la commande suivante : `php -S localhost:8000 -t public` 4. Ouvrir un navigateur web et taper dans la boîte URL : [localhost:8000/public/index.html](http://localhost:8000/public/index.html) diff --git a/public/js/utils.js b/public/js/utils.js index 9c504fd..f770f27 100644 --- a/public/js/utils.js +++ b/public/js/utils.js @@ -15,7 +15,7 @@ async function quizFetcher() { break; } localStorage.setItem("totalLives", lives) - response = await fetch("http://localhost:8000/src/quizCreator.php", { + response = await fetch("/quizCreator.php", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" diff --git a/public/quizCreator.php b/public/quizCreator.php new file mode 100644 index 0000000..2d11116 --- /dev/null +++ b/public/quizCreator.php @@ -0,0 +1,7 @@ + $this->correctAnswer ]; } -} \ No newline at end of file +} diff --git a/src/classes/Quiz.php b/src/classes/Quiz.php index 98d5162..0f18964 100644 --- a/src/classes/Quiz.php +++ b/src/classes/Quiz.php @@ -1,6 +1,6 @@ $this->difficulty ]; } -} \ No newline at end of file +} diff --git a/src/questionGenerator.php b/src/questionGenerator.php index c57e942..b0b73a3 100644 --- a/src/questionGenerator.php +++ b/src/questionGenerator.php @@ -4,7 +4,7 @@ header("Access-Control-Allow-Headers: Content-Type, Authorization"); header("Content-Type: application/json; charset=UTF-8"); -require "classes/Question.php"; +require __DIR__ . "/classes/Question.php"; function generateQuestions($difficulty) { switch ($difficulty) { @@ -296,4 +296,4 @@ function generateQuestions($difficulty) { return $questions; -} \ No newline at end of file +} diff --git a/src/quizCreator.php b/src/quizCreator.php deleted file mode 100644 index b18c3b6..0000000 --- a/src/quizCreator.php +++ /dev/null @@ -1,7 +0,0 @@ -