From 8f285a816f74af9b3b7a29e8810ba740db08a32b Mon Sep 17 00:00:00 2001 From: Mehdi Date: Tue, 23 Jun 2020 15:14:48 +0200 Subject: [PATCH] correction de bugs dans Correction.php --- BddCorrect/Correcteur.php | 9 +++++---- BddCorrect/SqliteDb.php | 14 +++++++------- BddCorrect/controleur/Controleur.php | 3 ++- BddCorrect/index.php | 1 + BddCorrect/test.db | Bin 12288 -> 12288 bytes BddCorrect/vues/VuePrincipale.php | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/BddCorrect/Correcteur.php b/BddCorrect/Correcteur.php index 5eeb845..fd34bc3 100644 --- a/BddCorrect/Correcteur.php +++ b/BddCorrect/Correcteur.php @@ -36,12 +36,13 @@ foreach ($_POST['textbox'] as $textbox) { $err=-3; break; } - while( ($oracleRow = oci_fetch_array($UserQuery, OCI_NUM)) && $err == 0 ){ - $verif = 1; + while( ($oracleRow = oci_fetch_array($UserQuery, OCI_NUM)) && $err == 0 ){ $vraiReponseRow = oci_fetch_array($vraiReponse,OCI_NUM ); + $verif = 1; if(sizeof($oracleRow) == sizeof($vraiReponseRow)){ - for($i=0 ; $i< sizeof($vraiReponseRow)-1 ; $i++){ + + for($i=0 ; $i< sizeof($vraiReponseRow) ; $i++){ if($oracleRow[$i] != $vraiReponseRow[$i]){ $err = -1; break; @@ -53,7 +54,7 @@ foreach ($_POST['textbox'] as $textbox) { break; } } - if($err == 0 ){ + if($err == 0 && $verif==1){ echo "La réponse à la question " .$numQuestion. " est JUSTE ! \n"; $cmpt++; } diff --git a/BddCorrect/SqliteDb.php b/BddCorrect/SqliteDb.php index b0aa05e..616a48e 100644 --- a/BddCorrect/SqliteDb.php +++ b/BddCorrect/SqliteDb.php @@ -16,7 +16,7 @@ class SqliteDb extends SQLite3 $this->exec('CREATE TABLE Correct ( question STRING, reponse STRING, type STRING, fonctionCorrect STRING,testUser STRING)'); //Question 1 - /* $type = 'query'; + $type = 'query'; $fonctionCorrect = null; $testU = null; $reponse = 'SELECT count(*) FROM stats WHERE prenomnoms=\'Kevin Durant\' '; @@ -28,7 +28,7 @@ class SqliteDb extends SQLite3 $stmt->bindParam(4,$testU); $stmt->execute(); - //Question 2 + //Question 2 $type = 'query'; $fonctionCorrect = null; $testU = null; @@ -54,7 +54,7 @@ class SqliteDb extends SQLite3 $stmt->bindParam(4,$testU); $stmt->execute(); - //Question 5 + /* //Question 5 $type = 'query'; $fonctionCorrect = null; $testU = null; @@ -68,7 +68,7 @@ class SqliteDb extends SQLite3 $stmt->execute(); - //Question 6 + /* //Question 6 $this->joueurEtDateRandom($joueurRandom, $dateRandom); $type = 'fonction'; $fonctionCorrect = 'CREATE OR REPLACE FUNCTION fpointsmarques(date_match IN VARCHAR2, joueur IN VARCHAR2 ) RETURN NUMBER IS nbPoints NUMBER ; BEGIN SELECT points INTO nbPoints FROM stats WHERE datematch = date_match AND prenomnoms=joueur; RETURN nbPoints; END;' ; @@ -80,10 +80,10 @@ class SqliteDb extends SQLite3 $stmt->bindParam(2,$type); $stmt->bindParam(3,$fonctionCorrect); $stmt->bindParam(4,$testU); - $stmt->execute();*/ + $stmt->execute(); //Question 9 - $type = 'tablemodification'; + /*$type = 'tablemodification'; $fonctionCorrect = 'IDJOUEUR'; $testU = null; $reponse = 'SELECT column_name FROM all_TAB_COLUMNS WHERE table_name = \'TEST\' '; @@ -94,7 +94,7 @@ class SqliteDb extends SQLite3 $stmt->bindParam(3,$fonctionCorrect); $stmt->bindParam(4,$testU); - $stmt->execute(); + $stmt->execute();*/ } function createLogin(){ diff --git a/BddCorrect/controleur/Controleur.php b/BddCorrect/controleur/Controleur.php index b29f603..e02a87f 100644 --- a/BddCorrect/controleur/Controleur.php +++ b/BddCorrect/controleur/Controleur.php @@ -13,7 +13,8 @@ class Controleur { switch($action) { case NULL: - require ($rep.$vues['vueLogin']); + //require ($rep.$vues['vueLogin']); + $this->afficherQuestions(); break; case 'login' : diff --git a/BddCorrect/index.php b/BddCorrect/index.php index 2f316ad..788a0ef 100644 --- a/BddCorrect/index.php +++ b/BddCorrect/index.php @@ -11,6 +11,7 @@ and open the template in the editor. @)p;GJ5QnWx}VT9lYq66^{#J~_WMuS7!&*=&Vy57!`9g#x*v SRG?u%RBWq`tW#Y9Y&igUGI1aP delta 389 zcmZojXh@hKCB%M|fq{V;h@pUG-9#NDkf@%C0xwXEiC=?(UxUAFv!K8ZJ|-W%$y)q= zjQX1^`GW-9EAvD0qRI^Xyz}$C1M-~R&C^pu4g7Ty%PG)lA<_B8RjCd6Y>jW^@H%c{1FtS%S3hPTU z_~xf%re&rUDdZ$7lq4qQq$+s%hq{IaDHP3luU_fFh}- zMZvB -
+