nouveau type de correction : pour vérifier que l'utilisateur a bien ajouter une colonne (Tp2-Exercice 3- Q1)

master
Mehdi 5 years ago
parent 5b115a949f
commit cad8d58ad0

@ -60,14 +60,41 @@ foreach ($_POST['textbox'] as $textbox) {
else echo "La réponse à la question " .$numQuestion. " est FAUSSE ! \n";
}
//si la question attend une modification
/*else if($typeRow['type'] == 'tablemodification'){
else if($typeRow['type'] == 'tablemodification'){
$sqliteQuery = $db->prepare('SELECT reponse FROM Correct WHERE rowid= ? ');
$sqliteQuery->bindParam(1, $numQuestion);
$result = $sqliteQuery->execute();
$sqliteRow = $result->fetchArray();
$vraiReponse = oci_parse($conn, $sqliteRow['reponse']);
$enAttente = oci_execute($vraiReponse);
}*/
$sqliteQuery = $db->prepare('SELECT fonctioncorrect FROM Correct WHERE rowid= ? ');
$sqliteQuery->bindParam(1, $numQuestion);
$result = $sqliteQuery->execute();
$sqliteRow = $result->fetchArray();
$t = oci_fetch_all($vraiReponse, $vraiReponseRow);
print_r($vraiReponseRow);
$err = 1;
foreach ($vraiReponseRow as $v){
for($i = 0 ; $i < sizeof($v, OCI_NUM) ; $i++){
if($v[$i] == $sqliteRow[0]){
$err = 0;
}
}
}
if($err == 0 ){
echo "La réponse à la question " .$numQuestion. " est JUSTE ! \n";
$cmpt++;
}
else echo "La réponse à la question " .$numQuestion. " est FAUSSE ! \n";
}
//si la question attend un CREATE FUNCTION
else{
$fonctionQuery = $db->prepare('SELECT * FROM Correct WHERE rowid= ? ');
@ -77,7 +104,7 @@ foreach ($_POST['textbox'] as $textbox) {
$creationFonction = oci_parse($conn, $fonctionRow['fonctionCorrect']);
$creatF = oci_execute($creationFonction);
$testUser = oci_parse($conn, $fonctionRow['testUser']);
$testu = oci_execute($testUser);
$testF = oci_parse($conn, $fonctionRow['reponse']);

@ -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\' ';
@ -80,21 +80,21 @@ class SqliteDb extends SQLite3
$stmt->bindParam(2,$type);
$stmt->bindParam(3,$fonctionCorrect);
$stmt->bindParam(4,$testU);
$stmt->execute();
$stmt->execute();*/
//Question 9
/* $type = 'tablemodification';
$fonctionCorrect = 'idjoueur';
$type = 'tablemodification';
$fonctionCorrect = 'IDJOUEUR';
$testU = null;
$reponse = ' SELECT column_name FROM all_tab_columns WHERE table_name = \'JOUEUR\' ';
$q = "INSERT INTO Correct VALUES ('Déterminer pour Kevin Durant pour le match du 30-oct-17 quelle est l équipe qui joue à domicile', ?,?,?,? )";
$reponse = 'SELECT column_name FROM all_TAB_COLUMNS WHERE table_name = \'TEST\' ';
$q = "INSERT INTO Correct VALUES ('Modifier la table JOUEUR pour ajouter un champ idjoueur', ?,?,?,? )";
$stmt = $this->prepare($q);
$stmt->bindParam(1,$reponse);
$stmt->bindParam(2,$type);
$stmt->bindParam(3,$fonctionCorrect);
$stmt->bindParam(4,$testU);
$stmt->execute();*/
$stmt->execute();
}
function createLogin(){

@ -5,6 +5,6 @@ $rep=__DIR__.'/../';
//Vues
$vues['vuePrincipale']='vues/vuePrincipale.php';
$vues['vuePrincipale']='vues/VuePrincipale.php';
$vues['vueLogin']='vues/vueLogin.php';

@ -20,8 +20,7 @@ class Controleur {
$this->verificationConnexion();
break;
default:
$dVueEreur[] ="Erreur d'appel php";
$dVueEreur[] ="Erreur d'appel php";
require ($rep.$vues['erreur']);
break;
}
@ -54,7 +53,6 @@ class Controleur {
$modele = new Modele();
if($modele->connection($id,$mdp)==null){
echo 'AAAAAAAAAA';
require($rep.$vues['vueLogin']);
}
else $this->afficherQuestions();

@ -3,13 +3,13 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/xampp/htdocs/BddCorrect/config/config.php</file>
<file>file:/C:/xampp/htdocs/BddCorrect/controleur/Controleur.php</file>
<file>file:/C:/xampp/htdocs/BddCorrect/DAL/UserGateway.php</file>
<file>file:/C:/xampp/htdocs/BddCorrect/SqliteDb.php</file>
<file>file:/C:/xampp/htdocs/BddCorrect/vues/VuePrincipale.php</file>
<file>file:/C:/xampp/htdocs/BddCorrect/modeles/Modele.php</file>
<file>file:/C:/xampp/htdocs/BddCorrect/vues/vueLogin.php</file>
<file>file:/C:/xampp/htdocs/BddCorrect/Correcteur.php</file>
<file>file:/C:/xampp/htdocs/BddCorrect/vues/vueLogin.php</file>
</group>
</open-files>
</project-private>

Binary file not shown.
Loading…
Cancel
Save