diff --git a/BddCorrect/BDD/OracleDb.php b/BddCorrect/BDD/OracleDb.php
new file mode 100644
index 0000000..c166245
--- /dev/null
+++ b/BddCorrect/BDD/OracleDb.php
@@ -0,0 +1,273 @@
+conn = oci_connect('u_prems', '123456', 'localhost/orcl');
+ //$this->conn = oci_connect('meelaichao', 'meelaichao', 'kirov:1521/kirov');
+ //$this->createRandomTables();
+ }
+
+ function createRandomTables() {
+ $this->createRandomStats();
+ $this->createRandomJoueur();
+ $this->createRandomEquipe();
+ $this->createRandomGame();
+ }
+
+ function createRandomStats(){
+ //Creation de la table
+ $drop = oci_parse($this->conn, 'DROP TABLE randomstats');
+ oci_execute($drop);
+ $q = oci_parse($this->conn, 'CREATE TABLE randomstats AS SELECT * FROM stats WHERE 1=0');
+ oci_execute($q);
+
+ //Insertion Stats
+ $tabStats = oci_parse($this->conn, 'SELECT * FROM stats');
+ oci_execute($tabStats);
+
+ $tabDate = array();
+ $tabType = array();
+ $tabEquipeJoueur = array();
+ $tabLocation = array();
+ $tabResultat = array();
+ $tabPrenom = array();
+ $tabStatus = array();
+ $tabMinutes = array();
+ $tabNaissance = array();
+ $tabPoints = array();
+ $tabPasses = array();
+ $tabBallesPerdues = array();
+ $tabInterceptions = array();
+ $tabContres = array();
+ $tabFautes = array();
+ $tabTirsPris = array();
+ $tabTirsMarques = array();
+ $tabTirsPourcent = array();
+ $tabTirs2Pris = array();
+ $tabTirs2Marques = array();
+ $tabTirs2Pourcent = array();
+ $tabTirs3Pris = array();
+ $tabTirs3Marques = array();
+ $tabTirs3Pourcent = array();
+ $tabLfPris = array();
+ $tabLfMarques = array();
+ $tabLfPourcent = array();
+ $tabRebondDef = array();
+ $tabRebondOff = array();
+ $tabRebondTotal = array();
+ $tabEquipeAdverse = array();
+
+ while ($statsArray = oci_fetch_array($tabStats, OCI_NUM)) {
+ $tabDate[] = $statsArray[0];
+ $tabType[] = $statsArray[1];
+ $tabEquipeJoueur[] = $statsArray[2];
+ $tabLocation[] = $statsArray[3];
+ $tabResultat[] = $statsArray[4];
+ $tabPrenom[] = $statsArray[5];
+ $tabStatus[] = $statsArray[6];
+ $tabMinutes[] = $statsArray[7];
+ $tabNaissance[] = $statsArray[8];
+ $tabPoints[] = $statsArray[9];
+ $tabPasses[] = $statsArray[10];
+ $tabBallesPerdues[] = $statsArray[11];
+ $tabInterceptions[] = $statsArray[12];
+ $tabContres[] = $statsArray[13];
+ $tabFautes[] = $statsArray[14];
+ $tabTirsPris[] = $statsArray[15];
+ $tabTirsMarques[] = $statsArray[16];
+ $tabTirsPourcent[] = $statsArray[17];
+ $tabTirs2Pris[] = $statsArray[18];
+ $tabTirs2Marques[] = $statsArray[19];
+ $tabTirs2Pourcent[] = $statsArray[20];
+ $tabTirs3Pris[] = $statsArray[21];
+ $tabTirs3Marques[] = $statsArray[22];
+ $tabTirs3Pourcent[] = $statsArray[23];
+ $tabLfPris[] = $statsArray[24];
+ $tabLfMarques[] = $statsArray[25];
+ $tabLfPourcent[] = $statsArray[26];
+ $tabRebondDef[] = $statsArray[27];
+ $tabRebondOff[] = $statsArray[28];
+ $tabRebondTotal[] = $statsArray[29];
+ $tabEquipeAdverse[] = $statsArray[30];
+ }
+
+ shuffle($tabDate);
+ shuffle($tabType);
+ shuffle($tabEquipeJoueur);
+ shuffle($tabLocation);
+ shuffle($tabResultat);
+ shuffle($tabPrenom);
+ shuffle($tabStatus);
+ shuffle($tabMinutes);
+ shuffle($tabNaissance);
+ shuffle($tabPoints);
+ shuffle($tabPasses);
+ shuffle($tabBallesPerdues);
+ shuffle($tabInterceptions);
+ shuffle($tabContres);
+ shuffle($tabFautes);
+ shuffle($tabTirsPris);
+ shuffle($tabTirsMarques);
+ shuffle($tabTirsPourcent);
+ shuffle($tabTirs2Pris);
+ shuffle($tabTirs2Marques);
+ shuffle($tabTirs2Pourcent);
+ shuffle($tabTirs3Pris);
+ shuffle($tabTirs3Marques);
+ shuffle($tabTirs3Pourcent);
+ shuffle($tabLfPris);
+ shuffle($tabLfMarques);
+ shuffle($tabLfPourcent);
+ shuffle($tabRebondDef);
+ shuffle($tabRebondOff);
+ shuffle($tabRebondTotal);
+ shuffle($tabEquipeAdverse);
+
+ for ($i = 0; $i < sizeof($tabDate); $i++) {
+ $insert = oci_parse($this->conn, 'INSERT INTO randomstats VALUES(\'' . $tabDate[$i] . ' \' , \''.$tabType[$i].'\' ,\'' . $tabEquipeJoueur[$i] . '\' , \'' . $tabLocation[$i] . '\' , \'' . $tabResultat[$i] . '\' , \'' . $tabPrenom[$i] . '\' , \'' . $tabStatus[$i] . '\' ,' . $tabMinutes[$i] . ' , \'' . $tabNaissance[$i] . ' \' ,'.$tabPoints[$i] . ' ,'.$tabPasses[$i] . ' ,'.$tabBallesPerdues[$i] . ' ,'.$tabInterceptions[$i] . ' ,'.$tabContres[$i] . ' ,'.$tabFautes[$i] . ' ,'.$tabTirsPris[$i] . ' ,'.$tabTirsMarques[$i] . ' ,'.$tabTirsPourcent[$i] . ' ,'.$tabTirs2Pris[$i] . ' ,'.$tabTirs2Marques[$i] . ' ,'.$tabTirs2Pourcent[$i] . ' ,'.$tabTirs3Pris[$i] . ' ,'.$tabTirs3Marques[$i] . ' ,'.$tabTirs3Pourcent[$i] . ' ,'.$tabLfPris[$i] . ' ,'.$tabLfMarques[$i] . ' ,'.$tabLfPourcent[$i] . ' ,'.$tabRebondDef[$i] . ' ,'.$tabRebondOff[$i] . ' ,'.$tabRebondTotal[$i] . ' , \'' . $tabEquipeAdverse[$i] . '\' ) ');
+ oci_execute($insert);
+
+ }
+ }
+
+ function createRandomJoueur(){
+ //Creation de la table
+ $drop = oci_parse($this->conn, 'DROP TABLE randomjoueur');
+ oci_execute($drop);
+ $q = oci_parse($this->conn, 'CREATE TABLE randomjoueur AS SELECT * FROM joueur WHERE 1=0');
+ oci_execute($q);
+
+ //Insertion Joueur
+ $tabJoueur = oci_parse($this->conn, 'SELECT * FROM joueur');
+ oci_execute($tabJoueur);
+
+ $tabPrenomnomj = array();
+ $tabAnneedebut = array();
+ $tabAnneefin = array();
+ $tabPoste = array();
+ $tabTaille = array();
+ $tabPoids = array();
+ $tabDateNaissanceJ = array();
+
+ while ($joueurArray = oci_fetch_array($tabJoueur, OCI_NUM)) {
+ $tabPrenomnomj[] = $joueurArray[0];
+ $tabAnneedebut[] = $joueurArray[1];
+ $tabAnneefin[] = $joueurArray[2];
+ $tabPoste[] = $joueurArray[3];
+ $tabTaille[] = $joueurArray[4];
+ $tabPoids[] = $joueurArray[5];
+ $tabDateNaissanceJ[] = $joueurArray[6];
+ }
+
+ shuffle($tabPrenomnomj);
+ shuffle($tabAnneedebut);
+ shuffle($tabAnneefin);
+ shuffle($tabPoste);
+ shuffle($tabTaille);
+ shuffle($tabPoids);
+ shuffle($tabDateNaissanceJ);
+
+ for ($i = 0; $i < sizeof($tabPrenomnomj); $i++) {
+ $insert = oci_parse($this->conn, 'INSERT INTO randomJoueur VALUES(\'' . $tabPrenomnomj[$i] . ' \' ,' . $tabAnneedebut[$i] . ' ,'.$tabAnneefin[$i] . ' , \'' . $tabPoste[$i] . '\', '.$tabTaille[$i] . ','.$tabPoids[$i] . ',\'' . $tabDateNaissanceJ[$i] . '\' ) ');
+ oci_execute($insert);
+ }
+
+ }
+
+ function createRandomEquipe(){
+ //Creation de la table
+ $drop = oci_parse($this->conn, 'DROP TABLE randomequipe');
+ oci_execute($drop);
+ $q = oci_parse($this->conn, 'CREATE TABLE randomequipe AS SELECT * FROM equipe WHERE 1=0');
+ oci_execute($q);
+
+ //Insertion Joueur
+ $tabEquipe = oci_parse($this->conn, 'SELECT * FROM equipe');
+ oci_execute($tabEquipe);
+
+ $tabId = array();
+ $tabVille = array();
+ $tabNom = array();
+ $tabConference = array();
+
+ while ($equipeArray = oci_fetch_array($tabEquipe, OCI_NUM)) {
+ $tabId[] = $equipeArray[0];
+ $tabVille[] = $equipeArray[1];
+ $tabNom[] = $equipeArray[2];
+ $tabConference[] = $equipeArray[3];
+ }
+
+ shuffle($tabId);
+ shuffle($tabVille);
+ shuffle($tabNom);
+ shuffle($tabConference);
+
+ for ($i = 0; $i < sizeof($tabId); $i++) {
+ $insert = oci_parse($this->conn, 'INSERT INTO randomequipe VALUES(\'' . $tabId[$i] . '\' ,\'' . $tabVille[$i] . '\', \'' . $tabNom[$i] . '\', \'' . $tabConference[$i] . '\' ) ');
+ oci_execute($insert);
+ }
+ }
+
+ function createRandomGame(){
+ //Creation de la table
+ $drop = oci_parse($this->conn, 'DROP TABLE randomgame');
+ oci_execute($drop);
+ $q = oci_parse($this->conn, 'CREATE TABLE randomgame AS SELECT * FROM game WHERE 1=0');
+ oci_execute($q);
+
+ //Insertion Joueur
+ $tabGame = oci_parse($this->conn, 'SELECT * FROM game');
+ oci_execute($tabGame);
+
+ $tabDate = array();
+ $tabHoraire = array();
+ $tabIdDomicile = array();
+ $tabIdExterieur = array();
+ $tabResultatDomicile = array();
+ $tabResultatExterieur = array();
+ $tabScoreDomicile = array();
+ $tabScoreExterieur = array();
+
+ while ($gameArray = oci_fetch_array($tabGame, OCI_NUM)) {
+ $tabDate[] = $gameArray[0];
+ $tabHoraire[] = $gameArray[1];
+ $tabIdDomicile[] = $gameArray[2];
+ $tabResultatDomicile[] = $gameArray[3];
+ $tabScoreDomicile[] = $gameArray[4];
+ $tabIdExterieur[] = $gameArray[5];
+ $tabResultatExterieur[] = $gameArray[6];
+ $tabScoreExterieur[] = $gameArray[7];
+ }
+ shuffle($tabDate);
+ shuffle($tabHoraire);
+ shuffle($tabIdDomicile);
+ shuffle($tabResultatDomicile);
+ shuffle($tabScoreDomicile);
+ shuffle($tabIdExterieur);
+ shuffle($tabResultatExterieur);
+ shuffle($tabScoreExterieur);
+
+ for ($i = 0; $i < sizeof($tabDate); $i++) {
+ $insert = oci_parse($this->conn, 'INSERT INTO randomgame VALUES(\'' . $tabDate[$i] . '\' ,' . $tabHoraire[$i] . ', \'' . $tabIdDomicile[$i] . '\', \''.$tabResultatDomicile[$i].'\', \''.$tabScoreDomicile[$i].'\', \''.$tabIdExterieur[$i].'\', \''.$tabResultatExterieur[$i].'\',' .$tabScoreExterieur[$i].' ) ');
+ oci_execute($insert);
+ }
+ }
+
+ public function getConn(){
+ return $this->conn;
+ }
+}
diff --git a/BddCorrect/BDD/SqliteDb.php b/BddCorrect/BDD/SqliteDb.php
new file mode 100644
index 0000000..be665e0
--- /dev/null
+++ b/BddCorrect/BDD/SqliteDb.php
@@ -0,0 +1,248 @@
+conn = $odb->getConn();
+ if($o == 'n')
+ $this->open('Traitement/test.db');
+ else $this->open('test.db');
+ /*$this->createLogin();
+ $this->createTable();
+ $this->createDemonstration();
+ $this->createQCM();*/
+ }
+
+
+ function createTable(){
+ //Création De La Table
+ $this->exec('DROP TABLE Correct');
+ $this->exec('CREATE TABLE Correct ( bddConcernee STRING,numTp NUMBER, numquestion NUMBER,question STRING, reponse STRING,points NUMBER,aleatoire CHAR)');
+
+ $this->exec('DROP TABLE FunctionCorrect');
+ $this->exec('CREATE TABLE FunctionCorrect (bddConcernee STRING,numTp NUMBER, numquestion NUMBER, question STRING, reponse STRING, type STRING, fonctionCorrect STRING,testUser STRING)');
+
+ $this->exec('DROP TABLE TriggerCorrect');
+ $this->exec('CREATE TABLE TriggerCorrect ( bddConcernee STRING,numTp NUMBER, numquestion NUMBER,question STRING, reponse STRING, type STRING, fonctionCorrect STRING,testUser STRING)');
+
+ $this->exec('DROP TABLE Type');
+ $this->exec('CREATE TABLE Type ( numTp NUMBER,numQuestion NUMBER,type STRING)');
+
+ $this->exec("INSERT INTO Type VALUES(2,1,'query')");
+ $this->exec("INSERT INTO Type VALUES(2,2,'query')");
+ $this->exec("INSERT INTO Type VALUES(2,3,'query')");
+ $this->exec("INSERT INTO Type VALUES(2,4,'query')");
+ $this->exec("INSERT INTO Type VALUES(2,5,'functionCorrect')");
+
+
+ //Question 1
+ $type = 'query';
+ $points =1;
+ $reponse = 'SELECT count(*) FROM STATS WHERE prenomnoms=\'Kevin Durant\' ';
+ $q = "INSERT INTO Correct VALUES ('NBA',2,1,'Trouver le nombre de matchs joués par Kevin Durant', ? ,?,'o')";
+ $stmt = $this->prepare($q);
+ $stmt->bindParam(1,$reponse);
+ $stmt->bindParam(2,$points);
+ $stmt->execute();
+
+ //Question 2
+ $type = 'query';
+ $points =1;
+ $reponse = ' SELECT prenomnoms,datematch,points,equipeadverse FROM STATS WHERE points = (SELECT max(points) FROM STATS)';
+ $q = "INSERT INTO Correct VALUES ('NBA',2,2,'Lister le(s) joueur(s) ayant marqué le plus de points dans la saison en indiquant son nom, la date du match, le nombre de points, l équipe adverse et le nombre de points marqués ', ? ,?,'o')";
+ $stmt = $this->prepare($q);
+ $stmt->bindParam(1,$reponse);
+ $stmt->bindParam(2,$points);
+ $stmt->execute();
+
+ //Question 3
+ $type = 'query';
+ $points =1;
+ $reponse = ' SELECT prenomnoms, COUNT(*) FROM STATS GROUP BY prenomnoms HAVING count(*) = (SELECT MAX(c) FROM (SELECT COUNT(*) AS c FROM STATS GROUP BY prenomnoms))';
+ $q = "INSERT INTO Correct VALUES ('NBA',2,3,'Lister le(s) joueur(s) ayant joué le plus de match pendant la saison', ? ,?,'o')";
+ $stmt = $this->prepare($q);
+ $stmt->bindParam(1,$reponse);
+ $stmt->bindParam(2,$points);
+ $stmt->execute();
+
+ //Question 4
+ $type = 'query';
+ $points =1;
+ $reponse = 'SELECT nom FROM EQUIPE, STATS WHERE datematch = \'30-OCT-17\' AND prenomnoms = \'Kevin Durant\' AND idequipe = CASE WHEN locationjoueur = \'Away\' THEN equipeadverse WHEN locationjoueur = \'Home\' THEN equipejoueur END ';
+ $q = "INSERT INTO Correct VALUES ('NBA',2,4,'Déterminer pour Kevin Durant pour le match du 30-oct-17 quelle est l équipe qui joue à domicile', ?,?,'n' )";
+ $stmt = $this->prepare($q);
+ $stmt->bindParam(1,$reponse);
+ $stmt->bindParam(2,$points);
+
+ $stmt->execute();
+
+ //Question 5
+ $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;' ;
+ $reponse = 'SELECT fpointsmarques(\''.$dateRandom.'\', \''.$joueurRandom.'\') FROM DUAL';
+ $testU = 'SELECT pointsmarques(\''.$dateRandom.'\', \''.$joueurRandom.'\') FROM DUAL' ;
+ $q = "INSERT INTO FunctionCorrect VALUES ('NBA',2,5,'Ecrire une fonction pointsmarques qui détermine pour une date de match et un joueur donnés quelle est le nombre de points marqués par ce joueur', ?,?,?,? )";
+ $stmt = $this->prepare($q);
+ $stmt->bindParam(1,$reponse);
+ $stmt->bindParam(2,$type);
+ $stmt->bindParam(3,$fonctionCorrect);
+ $stmt->bindParam(4,$testU);
+ $stmt->execute();
+
+ /* //Question 9
+ $type = 'tablemodification';
+ $fonctionCorrect = 'IDJOUEUR';
+ $testU = null;
+ $testP = 'SELECT data_type FROM all_TAB_COLUMNS WHERE table_name = \'JOUEUR\' '; //pour vérifier l
+ $reponse = 'SELECT column_name FROM all_TAB_COLUMNS WHERE table_name = \'TEST\' ';
+ $q = "INSERT INTO Correct VALUES (6,'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);
+
+ //Question 10
+ $type = 'query';
+ $fonctionCorrect = null;
+ $testU = null;
+ $testP = null;
+ $reponse = 'SELECT id_joueur FROM STATS WHERE table_name = \'TEST\' ';
+ $q = "INSERT INTO Correct VALUES (7,'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();*/
+
+ //QUESITION 1 TP2
+ $type='trigger';
+ $fonctionCorrect = 'CREATE OR REPLACE TRIGGER supprJ BEFORE DELETE ON joueur FOR EACH ROW DECLARE duser varchar2(30); ddate date; BEGIN SELECT user,sysdate INTO duser,ddate FROM DUAL; INSERT INTO TRACE VALUES(ddate, duser,\'Suppression de \' || :old.prenomnomj); END;' ;
+ //
+
+ }
+
+ function createDemonstration(){
+ $this->exec('DROP TABLE Demonstration');
+ $this->exec('CREATE TABLE Demonstration ( bddconcernee STRING ,chapitre NUMBER, numDemo NUMBER, description STRING,reponse STRING)');
+
+ $this->exec("INSERT INTO Demonstration VALUES('NBA',1,1,'Exemple de requête pour selectionner les 2 premières lignes de la table JOUEUR','SELECT * FROM JOUEUR WHERE rownum<3')");
+ $this->exec("INSERT INTO Demonstration VALUES('NBA',1,2,'Exemple de requête pour selectionner les 2 premières lignes de la table STATS','SELECT * FROM STATS WHERE rownum<3')");
+
+ }
+
+ function createQCM(){
+ $this->exec('DROP TABLE QcmQuestion');
+ $this->exec('CREATE TABLE QcmQuestion ( numQuestion NUMBER, question STRING)');
+
+ $this->exec('DROP TABLE QcmReponse');
+ $this->exec('CREATE TABLE QcmReponse ( numReponse NUMBER, reponse STRING, numQuestion NUMBER)');
+
+ $this->exec('DROP TABLE QcmCorrection');
+ $this->exec('CREATE TABLE QcmCorrection ( numQuestion NUMBER, numReponse NUMBER)');
+
+ //Question 1
+ $this->exec("INSERT INTO QcmQuestion VALUES(1,'Ceci est la question 1')");
+
+ $this->exec("INSERT INTO QcmReponse VALUES(1,'Ceci est la reponse 1 de la question 1(fausse)',1)");
+ $this->exec("INSERT INTO QcmReponse VALUES(2,'Ceci est la reponse 2 de la question 1(Vraie)',1)");
+ $this->exec("INSERT INTO QcmReponse VALUES(3,'Ceci est la reponse 3 de la question 1(fausse)',1)");
+
+ $this->exec("INSERT INTO QcmCorrection VALUES(1,2)");
+
+ //Question 2
+ $this->exec("INSERT INTO QcmQuestion VALUES(2,'Ceci est la question 2')");
+
+ $this->exec("INSERT INTO QcmReponse VALUES(1,'Ceci est la reponse 1 de la question 2(Vraie)',2)");
+ $this->exec("INSERT INTO QcmReponse VALUES(2,'Ceci est la reponse 2 de la question 2(fausse)',2)");
+ $this->exec("INSERT INTO QcmReponse VALUES(3,'Ceci est la reponse 3 de la question 2(fausse)',2)");
+
+ $this->exec("INSERT INTO QcmCorrection VALUES(2,1)");
+
+ }
+
+ function createLogin(){
+ $mdp = password_hash('mdptest', PASSWORD_DEFAULT);
+ $username = 'test';
+ $this->exec('DROP TABLE login');
+ $this->exec('CREATE TABLE login ( username STRING, password STRING)');
+
+ $stmt = $this->prepare("INSERT INTO login VALUES(? , ?)");
+ $stmt->bindParam(1, $username);
+ $stmt->bindParam(2, $mdp);
+ $stmt->execute();
+ }
+
+ function joueurEtDateRandom(&$nomRandom, &$dateRandom){
+
+ $listeJoueurQuery = oci_parse($this->conn, 'SELECT prenomnoms,datematch FROM STATS INTERSECT SELECT prenomnoms,datematch FROM randomstats ');
+ oci_execute($listeJoueurQuery);
+ $listeJoueurRows = oci_fetch_all($listeJoueurQuery, $listeJoueurArray);
+ //print_r($listeJoueurArray);
+ $rand_keys = array_rand($listeJoueurArray['PRENOMNOMS'], 1);
+ $nomRandom = $listeJoueurArray['PRENOMNOMS'][$rand_keys];
+ $dateRandom = $listeJoueurArray['DATEMATCH'][$rand_keys];
+ }
+
+ function joueurEtDateRandom2(&$nomRandom, &$dateRandom){
+ $listeJoueurQuery = oci_parse($this->conn, 'SELECT prenomnoms,datematch FROM STATS');
+ oci_execute($listeJoueurQuery);
+ $listeJoueurRows = oci_fetch_all($listeJoueurQuery, $listeJoueurArray);
+ //print_r($listeJoueurArray);
+ $rand_keys = array_rand($listeJoueurArray['PRENOMNOMS'], 1);
+ $nomRandom = $listeJoueurArray['PRENOMNOMS'][$rand_keys];
+ $dateRandom = $listeJoueurArray['DATEMATCH'][$rand_keys];
+ }
+
+ function ajouterRequete($contexte,$tp,$num,$consigne,$requete){
+ $qt = "INSERT INTO Type VALUES(?,?,'query')";
+ $prp=$this->prepare($qt);
+ $prp->bindParam(1, $num);
+ $prp->bindParam(2, $tp);
+ $prp->execute();
+ $q = "INSERT INTO Correct VALUES (?,?,?,?,? ,1,'o')";
+ $stmt = $this->prepare($q);
+ $stmt->bindParam(1,$contexte);
+ $stmt->bindParam(2,$tp);
+ $stmt->bindParam(3,$num);
+ $stmt->bindParam(4,$consigne);
+ $stmt->bindParam(5,$requete);
+
+ $stmt->execute();
+ }
+
+ function ajouterDemonstration($contexte,$chapitre,$num,$intitule,$requete){
+ $q = "INSERT INTO Demonstration VALUES (?,?,?,?,?)";
+ $stmt = $this->prepare($q);
+ $stmt->bindParam(1,$contexte);
+ $stmt->bindParam(2,$chapitre);
+ $stmt->bindParam(3,$num);
+ $stmt->bindParam(4,$intitule);
+ $stmt->bindParam(5,$requete);
+
+ $stmt->execute();
+ }
+
+ function supprimerRequete($numQuestion,$numTp){
+ $qt = "DELETE FROM Type WHERE numTp=? AND numQuestion=? ";
+ $prp=$this->prepare($qt);
+ $prp->bindParam(1, $numTp);
+ $prp->bindParam(2, $numQuestion);
+ $prp->execute();
+
+ $qt = "DELETE FROM Correct WHERE numTp=? AND numQuestion=? ";
+ $prp=$this->prepare($qt);
+ $prp->bindParam(1, $numTp);
+ $prp->bindParam(2, $numQuestion);
+ $prp->execute();
+ }
+
+}
+
diff --git a/BddCorrect/DAL/QCMGateway.php b/BddCorrect/DAL/QCMGateway.php
index ce62f71..683dd82 100644
--- a/BddCorrect/DAL/QCMGateway.php
+++ b/BddCorrect/DAL/QCMGateway.php
@@ -12,8 +12,7 @@ class QCMGateway {
$i = 0;
$query = 'SELECT * FROM QcmQuestion';
$query = $this->db->prepare($query);
- $result = $query->execute();
- $tabReponses =array();
+ $result = $query->execute();
$tabQuestions = array();
//$resultats = $this->db->query('SELECT found_rows()');
while($q = $result->fetchArray()){
@@ -23,6 +22,7 @@ class QCMGateway {
$stmt->bindParam(1, $q['numQuestion']);
$reponseResult = $stmt->execute();
$i=0;
+ $tabReponses =array();
while ($r = $reponseResult->fetchArray()){
$i++;
diff --git a/BddCorrect/DAL/QuestionsGateway.php b/BddCorrect/DAL/QuestionsGateway.php
index 06fe7d5..c783eec 100644
--- a/BddCorrect/DAL/QuestionsGateway.php
+++ b/BddCorrect/DAL/QuestionsGateway.php
@@ -10,13 +10,13 @@ class QuestionsGateway {
public function afficherQuestions() {
$i = 0;
- $query = 'SELECT numquestion,question,reponse FROM Correct UNION SELECT numquestion,question,reponse FROM FunctionCorrect';
+ $query = 'SELECT numTp,numquestion,question,reponse FROM Correct UNION SELECT numTp,numquestion,question,reponse FROM FunctionCorrect';
$query = $this->db->prepare($query);
$result = $query->execute();
//$resultats = $this->db->query('SELECT found_rows()');
while($q = $result->fetchArray()){
$i= $i+1;
- $tabQuestions[] = new Question($q['numquestion'],$q['question'],$q['reponse']);
+ $tabQuestions[] = new Question($q['numTp'],$q['numquestion'],$q['question'],$q['reponse']);
}
return $tabQuestions;
}
@@ -29,7 +29,7 @@ class QuestionsGateway {
//$resultats = $this->db->query('SELECT found_rows()');
while($q = $result->fetchArray()){
$i= $i+1;
- $tabDemo[] = new Question($q['numDemo'],$q['description'],$q['reponse']);
+ $tabDemo[] = new Question(1,$q['numDemo'],$q['description'],$q['reponse']);
}
return $tabDemo;
}
diff --git a/BddCorrect/Traitement/AffichageDemo.php b/BddCorrect/Traitement/AffichageDemo.php
new file mode 100644
index 0000000..69224b6
--- /dev/null
+++ b/BddCorrect/Traitement/AffichageDemo.php
@@ -0,0 +1,24 @@
+getConn();
+$textbox = $_GET['textbox'];
+
+$UserQuery = oci_parse($conn, $textbox);
+$reponseUser = oci_execute($UserQuery);
+$numLigne = 0;
+while( ($oracleRow = oci_fetch_array($UserQuery, OCI_NUM))) {
+ $numLigne++;
+ echo ' Ligne '.$numLigne.' : ';
+ for($i=0 ; $i< sizeof($oracleRow) ; $i++){
+ echo $oracleRow[$i].' ; ';
+ }
+ echo '';
+}
\ No newline at end of file
diff --git a/BddCorrect/Traitement/AjoutDemonstration.php b/BddCorrect/Traitement/AjoutDemonstration.php
new file mode 100644
index 0000000..9ca6f7a
--- /dev/null
+++ b/BddCorrect/Traitement/AjoutDemonstration.php
@@ -0,0 +1,14 @@
+ajouterDemonstration($_GET['bdd'],$_GET['tp'],$_GET['num'],$_GET['consigne'], $_GET['reponse']);
+
+//require_once('index.php');
+header("Location: index.php");
+
diff --git a/BddCorrect/Traitement/AjoutQuestion.php b/BddCorrect/Traitement/AjoutQuestion.php
new file mode 100644
index 0000000..d24bed6
--- /dev/null
+++ b/BddCorrect/Traitement/AjoutQuestion.php
@@ -0,0 +1,19 @@
+supprimerRequete($_GET['num'], $_GET['tp']);
+}
+
+if ($_GET["type"] == 'requete'){
+
+ $db->ajouterRequete($_GET['bdd'],$_GET['tp'],$_GET['num'],$_GET['consigne'], $_GET['reponse']);
+}
+//require_once('index.php');
+header("Location: index.php");
+
diff --git a/BddCorrect/Traitement/Correcteur.php b/BddCorrect/Traitement/Correcteur.php
new file mode 100644
index 0000000..6de20fe
--- /dev/null
+++ b/BddCorrect/Traitement/Correcteur.php
@@ -0,0 +1,349 @@
+getConn();
+
+$_SESSION['fi'] = array();
+$cmpt = 0;
+$numQuestion = 0;
+header("Cache-Control: no cache");
+
+
+ $textbox = $_GET['textbox'];
+ /*$numQuestion++;
+ $ic = "$numQuestion";*/
+
+ $numQuestion = $_GET['numQuestion'];
+ $numTp = $_GET['numTp'];
+ $_SESSION['fi'][$numQuestion] = $textbox;
+ $UserQuery = oci_parse($conn, $textbox);
+ $reponseUser = oci_execute($UserQuery);
+
+ $typeQuery = $db->prepare('SELECT type FROM Type WHERE numQuestion = ? AND numTp= ?');
+ $typeQuery->bindParam(1, $numQuestion);
+ $typeQuery->bindParam(2, $numTp);
+ $resultType = $typeQuery->execute();
+ $typeRow = $resultType->fetchArray();
+ $err = 0;
+ $verif =0;
+
+ //si la question attend un SELECT
+
+ if($typeRow['type'] == 'query'){
+ //
+
+ $sqliteQuery = $db->prepare('SELECT reponse FROM Correct WHERE numquestion= ? AND numTp= ? ');
+ $sqliteQuery->bindParam(1, $numQuestion);
+ $sqliteQuery->bindParam(2, $numTp);
+
+ $result = $sqliteQuery->execute();
+ $sqliteRow = $result->fetchArray();
+
+
+ $vraiReponse = oci_parse($conn, $sqliteRow['reponse']);
+ $enAttente = oci_execute($vraiReponse);
+
+ if(oci_num_rows($UserQuery) != oci_num_rows($vraiReponse)){
+ $err=-3;
+ }
+ 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) ; $i++){
+ if($oracleRow[$i] != $vraiReponseRow[$i]){
+ $err = -1;
+ break;
+ }
+ }
+ }
+ else {
+ $err = -2;
+ break;
+ }
+ }
+ //echo nl2br("\n ------------test : ".$err." test2 : ".$verif."\n");
+ //
+
+ $aleatoireQuery = $db->prepare('SELECT aleatoire FROM Correct WHERE numQuestion = ? AND numTp= ?');
+ $aleatoireQuery->bindParam(1, $numQuestion);
+ $aleatoireQuery->bindParam(2, $numTp);
+ $resultAleatoire = $aleatoireQuery->execute();
+ $aleatoireRow = $resultAleatoire->fetchArray();
+ if($aleatoireRow['aleatoire'] == 'o'){
+ //
+ $nv= $sqliteRow['reponse'];
+ $txt = $textbox;
+
+ if(strpos($sqliteRow['reponse'],"GAME")){
+ $nv = str_replace('GAME', ' randomgame ', $nv);
+ $txt = str_replace('GAME', 'randomgame', $txt);
+
+ }
+ if (strpos($sqliteRow['reponse'],"EQUIPE")){
+ $nv= str_replace('EQUIP', ' randomequipe ', $nv);
+ $txt = str_replace('EQUIPE', 'randomequipe', $txt);
+ }
+ if (strpos($sqliteRow['reponse'],"STATS")){
+ $nv= str_replace('STATS' , ' randomstats ', $nv);
+ $txt = str_replace('STATS', ' randomstats ', $txt);
+ }
+ if (strpos($sqliteRow['reponse'],"JOUEUR")) {
+ $nv = str_replace('JOUEUR', 'randomjoueur', $nv);
+ $txt = str_replace('JOUEUR', 'randomjoueur', $txt);
+ }
+
+ $UserQueryRandom = oci_parse($conn, $txt);
+ $reponseUser = oci_execute($UserQueryRandom);
+
+ $vraiReponseRandom = oci_parse($conn, $nv);
+ $enAttente = oci_execute($vraiReponseRandom);
+ if(oci_num_rows($UserQueryRandom) != oci_num_rows($vraiReponseRandom)){
+ $err=-3;
+ }
+ $verif = 0;
+ while( ($oracleRowRandom = oci_fetch_array($UserQueryRandom, OCI_NUM)) && $err == 0 ){
+ $vraiReponseRowRandom = oci_fetch_array($vraiReponseRandom,OCI_NUM );
+ $verif = 1;
+
+ if(sizeof($oracleRowRandom) == sizeof($vraiReponseRowRandom)){
+ for($i=0 ; $i< sizeof($vraiReponseRowRandom) ; $i++){
+ if($oracleRowRandom[$i] != $vraiReponseRowRandom[$i]){
+ $err = -1;
+ break;
+ }
+ }
+ }
+ else {
+ $err = -2;
+ break;
+ }
+ }
+ //
+ //echo nl2br("\n ------------testerr : ".$err." test2verif : ".$verif."\n");
+ }
+ //
+ if($err == 0 && $verif==1){
+ 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 une modification
+ else if($typeRow['type'] == 'tablemodification'){
+
+ $sqliteQuery = $db->prepare('SELECT reponse FROM Correct WHERE numquestion= ? AND numTp= ? ');
+ $sqliteQuery->bindParam(1, $numQuestion);
+ $sqliteQuery->bindParam(2, $numTp);
+ $result = $sqliteQuery->execute();
+ $sqliteRow = $result->fetchArray();
+ $vraiReponse = oci_parse($conn, $sqliteRow['reponse']);
+ $enAttente = oci_execute($vraiReponse);
+
+ $sqliteQuery = $db->prepare('SELECT fonctioncorrect FROM Correct WHERE numquestion= ? AND numTp= ?');
+ $sqliteQuery->bindParam(1, $numQuestion);
+ $sqliteQuery->bindParam(2, $numTp);
+ $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 FunctionCorrect WHERE numquestion= ? AND numTp= ? ');
+ $fonctionQuery->bindParam(1, $numQuestion);
+ $fonctionQuery->bindParam(2, $numTp);
+ $result = $fonctionQuery->execute();
+ $fonctionRow = $result->fetchArray();
+
+ $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']);
+ $testf = oci_execute($testF);
+
+ if(oci_num_rows($testUser) != oci_num_rows($testF)){
+ $err=-3;
+ }
+ while( ($reponseRow = oci_fetch_array($testUser,OCI_NUM)) && $err == 0){
+
+ $vraiReponseRow = oci_fetch_array($testF,OCI_NUM );
+
+ $verif=1;
+ if(sizeof($reponseRow) == sizeof($vraiReponseRow)){
+ for($i=0 ; $i< sizeof($vraiReponseRow) ; $i++){
+ //echo nl2br('reponse : '.$reponseRow[$i].'question : '.$vraiReponseRow[$i]);
+ if($reponseRow[$i] != $vraiReponseRow[$i]){
+ $err = -1;
+ break;
+ }
+ }
+ }
+ else {
+ $err = -2;
+ break;
+ }
+ }
+
+ //
+
+ $nv = $fonctionRow['fonctionCorrect'];
+ $txt = $textbox;
+
+ if(strpos($fonctionRow['fonctionCorrect'],"GAME")){
+ $nv = str_replace('GAME', ' randomgame ', $nv);
+ $txt = str_replace('GAME', 'randomgame', $txt);
+ }
+ if (strpos($fonctionRow['fonctionCorrect'],"EQUIPE")){
+ $nv= str_replace('EQUIPE', ' randomequipe ', $nv);
+ $txt = str_replace('EQUIPE', 'randomequipe', $txt);
+ }
+ if (strpos($fonctionRow['fonctionCorrect'],"STATS")){
+ $nv= str_replace('STATS' , ' randomstats ', $nv);
+ $txt = str_replace('STATS', ' randomstats ', $txt);
+ }
+ if (strpos($fonctionRow['fonctionCorrect'],"JOUEUR")) {
+ $nv = str_replace('JOUEUR', 'randomjoueur', $nv);
+ $txt = str_replace('JOUEUR', 'randomjoueur', $txt);
+ }
+
+ $UserQueryRandom = oci_parse($conn, $txt);
+ $reponseUserRandom = oci_execute($UserQueryRandom);
+ //echo 'bbbb'.$txt;
+ $creationFonctionRandom = oci_parse($conn, $nv);
+ $creatFRandom = oci_execute($creationFonctionRandom);
+ //echo '154789'.$nv;
+
+ $testUserRandom = oci_parse($conn, $fonctionRow['testUser']);
+ $testuR = oci_execute($testUserRandom);
+ //echo 'aaa'.$fonctionRow['testUser'];
+ $testFR = oci_parse($conn, $fonctionRow['reponse']);
+ $testfR = oci_execute($testFR);
+
+
+ if(oci_num_rows($testUserRandom) != oci_num_rows($testFR)){
+ $err=-3;
+ }
+ $verif=0;
+ while( ($reponseRowRandom = oci_fetch_array($testUserRandom,OCI_NUM)) && $err == 0){
+ $vraiReponseRowRandom = oci_fetch_array($testFR,OCI_NUM );
+ $verif=1;
+ if(sizeof($reponseRowRandom) == sizeof($vraiReponseRowRandom)){
+ for($i=0 ; $i< sizeof($vraiReponseRowRandom)-1 ; $i++){
+ if($reponseRowRandom[$i] != $vraiReponseRowRandom[$i]){
+ $err = -1;
+ break;
+ }
+ }
+ }
+ else {
+ $err = -2;
+ break;
+ }
+ }
+ //echo '.....'.$verif;
+ //
+
+ if($err == 0 && $verif==1 ){
+ echo "La réponse à la question " .$numQuestion. " est JUSTE ! \n";
+ $cmpt++;
+ }
+ else echo "La réponse à la question " .$numQuestion. " est FAUSSE ! \n";
+ }
+
+
+
+// Eléments d'authentification LDAP
+ /*$ldaprdn = 'cn=web_bind,OU=DSI,dc=iut,dc=local'; // DN ou RDN LDAP
+ $ldappass = 'ldap'; // Mot de passe associé
+
+ // Connexion au serveur LDAP
+ $ldapconn = ldap_connect("ldap://192.168.105.5",389)
+ or die("Impossible de se connecter au serveur LDAP.");
+
+ if ($ldapconn) {
+
+ // Connexion au serveur LDAP
+ $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
+
+ // Vérification de l'authentification
+ if ($ldapbind) {
+ // echo "Connexion LDAP réussie...";
+ } else {
+ // echo "Connexion LDAP échouée...";
+ }
+
+ }
+
+ $dn="OU=ITC,OU=uca,OU=etudiants,OU=utilisateurs,DC=iut,
+ DC=local";
+
+ $filter = "cn=".$_SERVER['REMOTE_USER'];
+ $sr = ldap_search($ldapconn, $dn, $filter);
+
+
+ /* echo 'Le résultat de la recherche est ' . $sr . '
';
+
+ echo 'Le nombre d\'entrées retournées est ' . ldap_count_entries($ldapconn,$sr)
+ . '
';
+
+ echo 'Lecture des entrées ...
';
+
+ echo 'Données pour ' . $info["count"] . ' entrées:
';
+for ($i=0; $i<$info["count"]; $i++) {
+ echo 'dn est : ' . $info[$i]["dn"] . '
';
+ echo 'premiere entree cn : ' . $info[$i]["cn"][0] . '
';
+ echo 'premier date de naissance : ' . $info[$i]["postofficebox"][0] . '
';
+ }
+ $info = ldap_get_entries($ldapconn, $sr);
+ $_SESSION["sn"] = $info[0]["sn"][0];
+
+$txt = 'Résultat de '.$info[0]["sn"][0] .' : '. $cmpt . '/' . $numQuestion;
+echo $txt;
+
+
+
+//file_put_contents('resultat.html', ob_get_contents());
+
+$fic = fopen("result.txt", "w");
+fwrite($fic, $txt);
+fclose($fic);*/
+
+?>
+
+
+
+
diff --git a/BddCorrect/Traitement/CorrectionQCM.php b/BddCorrect/Traitement/CorrectionQCM.php
new file mode 100644
index 0000000..756f058
--- /dev/null
+++ b/BddCorrect/Traitement/CorrectionQCM.php
@@ -0,0 +1,29 @@
+getConn();
+
+
+$query = $db->prepare('SELECT numReponse FROM QcmCorrection WHERE numQuestion=?');
+$query->bindParam(1, $_GET['numQuestion']);
+$result = $query->execute();
+$numReponseRow = $result->fetchArray();
+
+$reponseQuery = $db->prepare('SELECT reponse FROM QcmReponse WHERE numReponse=? AND numQuestion=?');
+$reponseQuery->bindParam(1, $numReponseRow['numReponse']);
+$reponseQuery->bindParam(2, $_GET['numQuestion']);
+$reponseResult = $reponseQuery->execute();
+$reponseRow = $reponseResult->fetchArray();
+
+if($_GET['textbox'] == $reponseRow['reponse']){
+ echo 'Bonne réponse !';
+}
+else echo $reponseRow['reponse'].'Mauvaise Réponse.';
+
+
+
diff --git a/BddCorrect/Traitement/ExecOracle.php b/BddCorrect/Traitement/ExecOracle.php
new file mode 100644
index 0000000..d319f9d
--- /dev/null
+++ b/BddCorrect/Traitement/ExecOracle.php
@@ -0,0 +1,17 @@
+getConn();
+
+$textbox = $_GET['textbox'];
+$UserQuery = oci_parse($conn, $textbox);
+$reponseUser = oci_execute($UserQuery);
+echo 'Table créee';
diff --git a/BddCorrect/Traitement/Modification.php b/BddCorrect/Traitement/Modification.php
new file mode 100644
index 0000000..68abd41
--- /dev/null
+++ b/BddCorrect/Traitement/Modification.php
@@ -0,0 +1,56 @@
+
+
+
+
+
+
diff --git a/BddCorrect/Traitement/Ordre.php b/BddCorrect/Traitement/Ordre.php
new file mode 100644
index 0000000..5f25e30
--- /dev/null
+++ b/BddCorrect/Traitement/Ordre.php
@@ -0,0 +1,87 @@
+prepare('SELECT type FROM Type WHERE numQuestion = ? AND numTp= ?');
+ $typeQuery->bindParam(1, $numQuestion);
+ $typeQuery->bindParam(2, $numTp);
+ $resultType = $typeQuery->execute();
+ $typeRow = $resultType->fetchArray();
+
+ $typeQuery = $db->prepare('SELECT type FROM Type WHERE numQuestion = ? AND numTp= ?');
+ $typeQuery->bindParam(1, $numQuestionPrec);
+ $typeQuery->bindParam(2, $numTp);
+ $resultType = $typeQuery->execute();
+ $type2Row = $resultType->fetchArray();
+
+
+
+
+ if($typeRow['type'] == 'query'){
+ $table = 'Correct';
+ }
+ else $table = 'FunctionCorrect';
+
+
+ $sqliteQuery = $db->prepare('UPDATE '.$table.' SET numQuestion=? WHERE numQuestion=? AND numTp=?');
+
+
+ $sqliteQuery->bindParam(1, $test);
+ $sqliteQuery->bindParam(2, $numQuestion);
+ $sqliteQuery->bindParam(3, $numTp);
+ $result = $sqliteQuery->execute();
+
+ if($type2Row['type'] == 'query'){
+ $table2 = 'Correct';
+ }
+ else $table2 = 'FunctionCorrect';
+
+ $sqliteQuery = $db->prepare('UPDATE '.$table2.' SET numQuestion=? WHERE numQuestion=? AND numTp=?');
+
+ $sqliteQuery->bindParam(1, $numQuestion);
+ $sqliteQuery->bindParam(2, $numQuestionPrec);
+ $sqliteQuery->bindParam(3, $numTp);
+ $resulti = $sqliteQuery->execute();
+
+ $sqliteQuery = $db->prepare('UPDATE '.$table.' SET numQuestion=? WHERE numQuestion=? AND numTp=?');
+
+ $sqliteQuery->bindParam(1, $numQuestionPrec);
+ $sqliteQuery->bindParam(2, $test);
+ $sqliteQuery->bindParam(3, $numTp);
+ $resultp = $sqliteQuery->execute();
+ ////
+ $sqliteQuery = $db->prepare('UPDATE Type SET numQuestion=? WHERE numQuestion=? AND numTp=?');
+ $sqliteQuery->bindParam(1, $test);
+ $sqliteQuery->bindParam(2, $numQuestion);
+ $sqliteQuery->bindParam(3, $numTp);
+ $result = $sqliteQuery->execute();
+
+ $sqliteQuery = $db->prepare('UPDATE Type SET numQuestion=? WHERE numQuestion=? AND numTp=?');
+ $sqliteQuery->bindParam(1, $numQuestion);
+ $sqliteQuery->bindParam(2, $numQuestionPrec);
+ $sqliteQuery->bindParam(3, $numTp);
+ $resulti = $sqliteQuery->execute();
+
+ $sqliteQuery = $db->prepare('UPDATE Type SET numQuestion=? WHERE numQuestion=? AND numTp=?');
+ $sqliteQuery->bindParam(1, $numQuestionPrec);
+ $sqliteQuery->bindParam(2, $test);
+ $sqliteQuery->bindParam(3, $numTp);
+ $resultp = $sqliteQuery->execute();
+
+
+}
+
+//header("Location: index.php");
+
+
diff --git a/BddCorrect/Traitement/Suppression.php b/BddCorrect/Traitement/Suppression.php
new file mode 100644
index 0000000..441b7ca
--- /dev/null
+++ b/BddCorrect/Traitement/Suppression.php
@@ -0,0 +1,25 @@
+prepare('SELECT type FROM Type WHERE numQuestion=? AND numTp = ?');
+ $sqliteQuery->bindParam(1, $_GET['numQuestion']);
+ $sqliteQuery->bindParam(2, $_GET['numTp']);
+ $result = $sqliteQuery->execute();
+ $typeRow = $result->fetchArray();
+
+ if($typeRow['type'] == 'query'){
+ $sqliteQuery = $db->prepare('DELETE FROM Correct WHERE numquestion= ? AND numTp=? ');
+ $sqliteQuery->bindParam(1, $_GET['numQuestion']);
+ $sqliteQuery->bindParam(2, $_GET['numTp']);
+ $result = $sqliteQuery->execute();
+ }
+ else {
+ $sqliteQueryF = $db->prepare('DELETE FROM FunctionCorrect WHERE numquestion= ? AND numTp=?');
+ $sqliteQueryF->bindParam(1, $_GET['numQuestion']);
+ $sqliteQueryF->bindParam(2, $_GET['numTp']);
+ $result = $sqliteQueryF->execute();
+ }
\ No newline at end of file
diff --git a/BddCorrect/Traitement/test.db b/BddCorrect/Traitement/test.db
new file mode 100644
index 0000000..d3c958a
Binary files /dev/null and b/BddCorrect/Traitement/test.db differ
diff --git a/BddCorrect/config/Autoload.php b/BddCorrect/config/Autoload.php
index f3a64cc..baf0b7d 100644
--- a/BddCorrect/config/Autoload.php
+++ b/BddCorrect/config/Autoload.php
@@ -41,7 +41,7 @@ public static function getLimite(){
{
global $rep;
$filename = $class.'.php';
- $dir =array('modeles/','./','config/','controleur/','DAL/','metier/','css/');
+ $dir =array('modeles/','./','config/','controleur/','DAL/','metier/','css/','BDD/','Traitement/');
foreach ($dir as $d){
$file=$rep.$d.$filename;
//echo $file;
diff --git a/BddCorrect/controleur/Controleur.php b/BddCorrect/controleur/Controleur.php
index 43ba083..ccc6c6c 100644
--- a/BddCorrect/controleur/Controleur.php
+++ b/BddCorrect/controleur/Controleur.php
@@ -69,8 +69,8 @@ class Controleur {
$dVueQuestions = $model->afficherQuestions();
$_SESSION['array']=$dVueQuestions;
//require ($rep.$vues['vueSupression']);
- //require ($rep.$vues['vuePrincipale']);
- require ($rep.$vues['vueNbQuestions']);
+ require ($rep.$vues['vuePrincipale']);
+ //require ($rep.$vues['vueNbQuestions']);
//session_destroy();
}
diff --git a/BddCorrect/css/jquery-3.5.1.js b/BddCorrect/css/jquery-3.5.1.js
new file mode 100644
index 0000000..5093733
--- /dev/null
+++ b/BddCorrect/css/jquery-3.5.1.js
@@ -0,0 +1,10872 @@
+/*!
+ * jQuery JavaScript Library v3.5.1
+ * https://jquery.com/
+ *
+ * Includes Sizzle.js
+ * https://sizzlejs.com/
+ *
+ * Copyright JS Foundation and other contributors
+ * Released under the MIT license
+ * https://jquery.org/license
+ *
+ * Date: 2020-05-04T22:49Z
+ */
+( function( global, factory ) {
+
+ "use strict";
+
+ if ( typeof module === "object" && typeof module.exports === "object" ) {
+
+ // For CommonJS and CommonJS-like environments where a proper `window`
+ // is present, execute the factory and get jQuery.
+ // For environments that do not have a `window` with a `document`
+ // (such as Node.js), expose a factory as module.exports.
+ // This accentuates the need for the creation of a real `window`.
+ // e.g. var jQuery = require("jquery")(window);
+ // See ticket #14549 for more info.
+ module.exports = global.document ?
+ factory( global, true ) :
+ function( w ) {
+ if ( !w.document ) {
+ throw new Error( "jQuery requires a window with a document" );
+ }
+ return factory( w );
+ };
+ } else {
+ factory( global );
+ }
+
+// Pass this if window is not defined yet
+} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
+
+// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
+// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
+// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
+// enough that all such attempts are guarded in a try block.
+"use strict";
+
+var arr = [];
+
+var getProto = Object.getPrototypeOf;
+
+var slice = arr.slice;
+
+var flat = arr.flat ? function( array ) {
+ return arr.flat.call( array );
+} : function( array ) {
+ return arr.concat.apply( [], array );
+};
+
+
+var push = arr.push;
+
+var indexOf = arr.indexOf;
+
+var class2type = {};
+
+var toString = class2type.toString;
+
+var hasOwn = class2type.hasOwnProperty;
+
+var fnToString = hasOwn.toString;
+
+var ObjectFunctionString = fnToString.call( Object );
+
+var support = {};
+
+var isFunction = function isFunction( obj ) {
+
+ // Support: Chrome <=57, Firefox <=52
+ // In some browsers, typeof returns "function" for HTML