Brendan Abolivier 9 years ago
parent
commit
15d5d966f3

web/index.php → web/api/index.php View File


web/model/class.categorie.php → web/api/model/class.categorie.php View File

45
 		$bdd = new Connector();
45
 		$bdd = new Connector();
46
 		$arrayCat = $bdd->Select("*", "categorie");
46
 		$arrayCat = $bdd->Select("*", "categorie");
47
 		$return = array();
47
 		$return = array();
48
+		$catIndex = -1;
49
+		$previousIndex = -1;
48
 		for($i = 0; $i < 2; $i++) {
50
 		for($i = 0; $i < 2; $i++) {
49
-			$catIndex = rand(0, sizeof($arrayCat)-1);
51
+			do {
52
+				$previousIndex = $catIndex;
53
+				$catIndex = rand(0, sizeof($arrayCat)-1);
54
+			} while($catIndex == $previousIndex);
50
 			array_push($return, new Categorie($arrayCat[$catIndex]['nom_cat']));
55
 			array_push($return, new Categorie($arrayCat[$catIndex]['nom_cat']));
51
 		}
56
 		}
52
 		return $return;
57
 		return $return;

web/model/class.connector.php → web/api/model/class.connector.php View File


web/model/class.question.php → web/api/model/class.question.php View File


web/model/class.questset.php → web/api/model/class.questset.php View File


web/model/class.score.php → web/api/model/class.score.php View File


web/model/classes.php → web/api/model/classes.php View File


web/tests.php → web/api/tests.php View File


web/view/palmares.php → web/api/view/palmares.php View File


web/view/questions.php → web/api/view/questions.php View File