diff --git a/ReadMe.md b/ReadMe.md index f4255bb..9d34445 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 -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)" +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 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 @@ -