diff --git a/BddCorrect/AjoutQuestion.php b/BddCorrect/AjoutQuestion.php
index d396fe2..6daf138 100644
--- a/BddCorrect/AjoutQuestion.php
+++ b/BddCorrect/AjoutQuestion.php
@@ -8,7 +8,7 @@ $db = new SqliteDb();
if ($_POST["type"] == 'requete')
$db->ajouterRequete($_POST['num'],$_POST['consigne'], $_POST['reponse']);
-else
+
//require_once('index.php');
header("Location: index.php");
diff --git a/BddCorrect/Correcteur.php b/BddCorrect/Correcteur.php
index 98e2d4d..4d387ec 100644
--- a/BddCorrect/Correcteur.php
+++ b/BddCorrect/Correcteur.php
@@ -1,6 +1,5 @@
-
-
prepare('DELETE FROM Correct WHERE numquestion= ?');
+ $typeQuery->bindParam(1, $numQuestion);
+ $resultType = $typeQuery->execute();
+ header("Location: index.php");
+
+ break;
+ }*/
+
$_SESSION['fi'][$numQuestion] = $textbox;
$UserQuery = oci_parse($conn, $textbox);
$reponseUser = oci_execute($UserQuery);
@@ -41,6 +51,7 @@ foreach ($_POST['textbox'] as $textbox) {
$result = $sqliteQuery->execute();
$sqliteRow = $result->fetchArray();
+
$vraiReponse = oci_parse($conn, $sqliteRow['reponse']);
$enAttente = oci_execute($vraiReponse);
@@ -68,57 +79,63 @@ foreach ($_POST['textbox'] as $textbox) {
//echo nl2br("\n ------------test : ".$err." test2 : ".$verif."\n");
//
- //
- $nv= $sqliteRow['reponse'];
- $txt = $textbox;
-
- if(strpos($sqliteRow['reponse'],"GAME")){
- $nv = str_replace('GAME', ' randomgame ', $nv);
- $txt = str_replace('GAME', 'randomgame', $txt);
+ $aleatoireQuery = $db->prepare('SELECT type FROM Type WHERE numQuestion = ?');
+ $aleatoireQuery->bindParam(1, $numQuestion);
+ $resultAleatoire = $typeQuery->execute();
+ $aleatoireRow = $resultType->fetchArray();
+ if($typeRow['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;
- break;
- }
- $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;
+ 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;
break;
}
- }
- //
- //echo nl2br("\n ------------testerr : ".$err." test2verif : ".$verif."\n");
+ $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";
@@ -187,7 +204,7 @@ foreach ($_POST['textbox'] as $textbox) {
$verif=1;
if(sizeof($reponseRow) == sizeof($vraiReponseRow)){
- for($i=0 ; $i< sizeof($vraiReponseRow) ; $i++){echo 'IIIDFFQSIDPFHJ';
+ for($i=0 ; $i< sizeof($vraiReponseRow) ; $i++){
echo nl2br('reponse : '.$reponseRow[$i].'question : '.$vraiReponseRow[$i]);
if($reponseRow[$i] != $vraiReponseRow[$i]){
$err = -1;
@@ -269,6 +286,7 @@ foreach ($_POST['textbox'] as $textbox) {
}
echo 'Résultat : ' . $cmpt . '/' . $numQuestion;
+file_put_contents('resultat.html', ob_get_contents());
?>
diff --git a/BddCorrect/ExecOracle.php b/BddCorrect/ExecOracle.php
new file mode 100644
index 0000000..3f26a51
--- /dev/null
+++ b/BddCorrect/ExecOracle.php
@@ -0,0 +1,15 @@
+conn = oci_connect('u_prems', '123456', 'localhost/orcl');
- $this->conn = oci_connect('meelaichao', 'meelaichao', 'kirov:1521/kirov');
+ $this->conn = oci_connect('u_prems', '123456', 'localhost/orcl');
+ //$this->conn = oci_connect('meelaichao', 'meelaichao', 'kirov:1521/kirov');
$this->createRandomTables();
}
diff --git a/BddCorrect/SqliteDb.php b/BddCorrect/SqliteDb.php
index ea1d02d..e824ad0 100644
--- a/BddCorrect/SqliteDb.php
+++ b/BddCorrect/SqliteDb.php
@@ -13,7 +13,7 @@ class SqliteDb extends SQLite3
function createTable(){
//Création De La Table
$this->exec('DROP TABLE Correct');
- $this->exec('CREATE TABLE Correct ( numquestion NUMBER,question STRING, reponse STRING,points NUMBER)');
+ $this->exec('CREATE TABLE Correct ( numquestion NUMBER,question STRING, reponse STRING,points NUMBER,aleatoire CHAR)');
$this->exec('DROP TABLE FunctionCorrect');
$this->exec('CREATE TABLE FunctionCorrect (numquestion NUMBER, question STRING, reponse STRING, type STRING, fonctionCorrect STRING,testUser STRING)');
@@ -35,7 +35,7 @@ class SqliteDb extends SQLite3
$type = 'query';
$points =1;
$reponse = 'SELECT count(*) FROM STATS WHERE prenomnoms=\'Kevin Durant\' ';
- $q = "INSERT INTO Correct VALUES (1,'Trouver le nombre de matchs joués par Kevin Durant', ? ,?)";
+ $q = "INSERT INTO Correct VALUES (1,'Trouver le nombre de matchs joués par Kevin Durant', ? ,?,'o')";
$stmt = $this->prepare($q);
$stmt->bindParam(1,$reponse);
$stmt->bindParam(2,$points);
@@ -45,7 +45,7 @@ class SqliteDb extends SQLite3
$type = 'query';
$points =1;
$reponse = ' SELECT prenomnoms,datematch,points,equipeadverse FROM STATS WHERE points = (SELECT max(points) FROM STATS)';
- $q = "INSERT INTO Correct VALUES (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 ', ? ,?)";
+ $q = "INSERT INTO Correct VALUES (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);
@@ -55,7 +55,7 @@ class SqliteDb extends SQLite3
$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 (3,'Lister le(s) joueur(s) ayant joué le plus de match pendant la saison', ? ,?)";
+ $q = "INSERT INTO Correct VALUES (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);
@@ -65,7 +65,7 @@ class SqliteDb extends SQLite3
$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 (4,'Déterminer pour Kevin Durant pour le match du 30-oct-17 quelle est l équipe qui joue à domicile', ?,? )";
+ $q = "INSERT INTO Correct VALUES (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);
@@ -163,7 +163,7 @@ class SqliteDb extends SQLite3
$prp=$this->prepare($qt);
$prp->bindParam(1, $num);
$prp->execute();
- $q = "INSERT INTO Correct VALUES (?,?,? ,1)";
+ $q = "INSERT INTO Correct VALUES (?,?,? ,1,'o')";
$stmt = $this->prepare($q);
$stmt->bindParam(1,$num);
$stmt->bindParam(2,$consigne);
diff --git a/BddCorrect/Suppression.php b/BddCorrect/Suppression.php
new file mode 100644
index 0000000..39d9b61
--- /dev/null
+++ b/BddCorrect/Suppression.php
@@ -0,0 +1,25 @@
+prepare('DELETE FROM Correct WHERE numquestion= ? ');
+ $sqliteQuery->bindParam(1, $i);
+ $result = $sqliteQuery->execute();
+
+ $sqliteQueryF = $db->prepare('DELETE FROM FunctionCorrect WHERE numquestion= ? ');
+ $sqliteQueryF->bindParam(1, $i);
+ $result = $sqliteQueryF->execute();
+ }
+
+}
\ No newline at end of file
diff --git a/BddCorrect/config/config.php b/BddCorrect/config/config.php
index d1f6d5f..f895598 100644
--- a/BddCorrect/config/config.php
+++ b/BddCorrect/config/config.php
@@ -7,4 +7,4 @@ $rep=__DIR__.'/../';
$vues['vuePrincipale']='vues/VuePrincipale.php';
$vues['vueLogin']='vues/vueLogin.php';
-
+$vues['vueSupression']='vues/VueSupression.php';
diff --git a/BddCorrect/controleur/Controleur.php b/BddCorrect/controleur/Controleur.php
index 5e5f2e6..b974d15 100644
--- a/BddCorrect/controleur/Controleur.php
+++ b/BddCorrect/controleur/Controleur.php
@@ -23,7 +23,7 @@ class Controleur {
break;
case 'Valider' :
//$this->verificationConnexion();
- echo 'AAAAAAAAAAAA';
+
$this->Correction();
break;
default:
@@ -49,7 +49,7 @@ class Controleur {
$model = new Modele();
$dVueQuestions = $model->afficherQuestions();
- require ($rep.$vues['vuePrincipale']);
+ require ($rep.$vues['vueSupression']);
//session_destroy();
}
diff --git a/BddCorrect/index.php b/BddCorrect/index.php
index d8257f5..9d0f22e 100644
--- a/BddCorrect/index.php
+++ b/BddCorrect/index.php
@@ -14,7 +14,30 @@ and open the template in the editor.
//phpinfo();
/*$remote_user = $_SERVER['REMOTE_USER'];
echo $remote_user;*/
- require_once(__DIR__.'/config/config.php');
+
+
+ // 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...";
+ }
+
+ }*/
+ require_once(__DIR__.'/config/config.php');
//chargement autoloader pour autochargement des classes
require_once(__DIR__.'/config/Autoload.php');
@@ -22,7 +45,7 @@ and open the template in the editor.
//$oraDb = new OracleDb;
$cont = new Controleur();
- //phpinfo();
+ //phpinfo();*/
?>
+
+
diff --git a/BddCorrect/ldap.php b/BddCorrect/ldap.php
new file mode 100644
index 0000000..1a8d8d6
--- /dev/null
+++ b/BddCorrect/ldap.php
@@ -0,0 +1,50 @@
+
+
+
+