correction de bugs dans Correction.php

master
Mehdi 5 years ago
parent cad8d58ad0
commit 8f285a816f

@ -36,12 +36,13 @@ foreach ($_POST['textbox'] as $textbox) {
$err=-3; $err=-3;
break; break;
} }
while( ($oracleRow = oci_fetch_array($UserQuery, OCI_NUM)) && $err == 0 ){ while( ($oracleRow = oci_fetch_array($UserQuery, OCI_NUM)) && $err == 0 ){
$verif = 1;
$vraiReponseRow = oci_fetch_array($vraiReponse,OCI_NUM ); $vraiReponseRow = oci_fetch_array($vraiReponse,OCI_NUM );
$verif = 1;
if(sizeof($oracleRow) == sizeof($vraiReponseRow)){ 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]){ if($oracleRow[$i] != $vraiReponseRow[$i]){
$err = -1; $err = -1;
break; break;
@ -53,7 +54,7 @@ foreach ($_POST['textbox'] as $textbox) {
break; break;
} }
} }
if($err == 0 ){ if($err == 0 && $verif==1){
echo "La réponse à la question " .$numQuestion. " est JUSTE ! \n"; echo "La réponse à la question " .$numQuestion. " est JUSTE ! \n";
$cmpt++; $cmpt++;
} }

@ -16,7 +16,7 @@ class SqliteDb extends SQLite3
$this->exec('CREATE TABLE Correct ( question STRING, reponse STRING, type STRING, fonctionCorrect STRING,testUser STRING)'); $this->exec('CREATE TABLE Correct ( question STRING, reponse STRING, type STRING, fonctionCorrect STRING,testUser STRING)');
//Question 1 //Question 1
/* $type = 'query'; $type = 'query';
$fonctionCorrect = null; $fonctionCorrect = null;
$testU = null; $testU = null;
$reponse = 'SELECT count(*) FROM stats WHERE prenomnoms=\'Kevin Durant\' '; $reponse = 'SELECT count(*) FROM stats WHERE prenomnoms=\'Kevin Durant\' ';
@ -28,7 +28,7 @@ class SqliteDb extends SQLite3
$stmt->bindParam(4,$testU); $stmt->bindParam(4,$testU);
$stmt->execute(); $stmt->execute();
//Question 2 //Question 2
$type = 'query'; $type = 'query';
$fonctionCorrect = null; $fonctionCorrect = null;
$testU = null; $testU = null;
@ -54,7 +54,7 @@ class SqliteDb extends SQLite3
$stmt->bindParam(4,$testU); $stmt->bindParam(4,$testU);
$stmt->execute(); $stmt->execute();
//Question 5 /* //Question 5
$type = 'query'; $type = 'query';
$fonctionCorrect = null; $fonctionCorrect = null;
$testU = null; $testU = null;
@ -68,7 +68,7 @@ class SqliteDb extends SQLite3
$stmt->execute(); $stmt->execute();
//Question 6 /* //Question 6
$this->joueurEtDateRandom($joueurRandom, $dateRandom); $this->joueurEtDateRandom($joueurRandom, $dateRandom);
$type = 'fonction'; $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;' ; $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(2,$type);
$stmt->bindParam(3,$fonctionCorrect); $stmt->bindParam(3,$fonctionCorrect);
$stmt->bindParam(4,$testU); $stmt->bindParam(4,$testU);
$stmt->execute();*/ $stmt->execute();
//Question 9 //Question 9
$type = 'tablemodification'; /*$type = 'tablemodification';
$fonctionCorrect = 'IDJOUEUR'; $fonctionCorrect = 'IDJOUEUR';
$testU = null; $testU = null;
$reponse = 'SELECT column_name FROM all_TAB_COLUMNS WHERE table_name = \'TEST\' '; $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(3,$fonctionCorrect);
$stmt->bindParam(4,$testU); $stmt->bindParam(4,$testU);
$stmt->execute(); $stmt->execute();*/
} }
function createLogin(){ function createLogin(){

@ -13,7 +13,8 @@ class Controleur {
switch($action) { switch($action) {
case NULL: case NULL:
require ($rep.$vues['vueLogin']); //require ($rep.$vues['vueLogin']);
$this->afficherQuestions();
break; break;
case 'login' : case 'login' :

@ -11,6 +11,7 @@ and open the template in the editor.
</head> </head>
<body> <body>
<?php //chargement config <?php //chargement config
//phpinfo();
require_once(__DIR__.'/config/config.php'); require_once(__DIR__.'/config/config.php');
//chargement autoloader pour autochargement des classes //chargement autoloader pour autochargement des classes

Binary file not shown.

@ -54,7 +54,7 @@
</div> </div>
</section> </section>
<section id="TP3" class="bg-light"> <!-- <section id="TP3" class="bg-light">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 mx-auto"> <div class="col-lg-8 mx-auto">
@ -97,7 +97,7 @@
</div> </div>
</div> </div>
</div> </div>
</section> </section>-->
<!-- Footer --> <!-- Footer -->
<footer class="py-5 bg-dark"> <footer class="py-5 bg-dark">
<div class="container"> <div class="container">

Loading…
Cancel
Save