tirage questions aléatoire

master
Mehdi 5 years ago
parent a670a4a6e1
commit 1e3f3a7ce0

@ -79,11 +79,11 @@ foreach ($_POST['textbox'] as $textbox) {
//echo nl2br("\n ------------test : ".$err." test2 : ".$verif."\n");
// </editor-fold>
$aleatoireQuery = $db->prepare('SELECT type FROM Type WHERE numQuestion = ?');
$aleatoireQuery = $db->prepare('SELECT aleatoire FROM Correct WHERE numQuestion = ?');
$aleatoireQuery->bindParam(1, $numQuestion);
$resultAleatoire = $typeQuery->execute();
$aleatoireRow = $resultType->fetchArray();
if($typeRow['aleatoire'] == 'o'){
$resultAleatoire = $aleatoireQuery->execute();
$aleatoireRow = $resultAleatoire->fetchArray();
if($aleatoireRow['aleatoire'] == 'o'){
// <editor-fold desc="vérification avec bdd aléatoire">
$nv= $sqliteRow['reponse'];
$txt = $textbox;
@ -285,8 +285,13 @@ foreach ($_POST['textbox'] as $textbox) {
}
echo 'Résultat : ' . $cmpt . '/' . $numQuestion;
$txt = 'Résultat : ' . $cmpt . '/' . $numQuestion;
echo $txt;
file_put_contents('resultat.html', ob_get_contents());
$fic = fopen("result.txt", "w");
fwrite($fic, $txt);
fclose($fic);
?>

@ -7,7 +7,7 @@ class SqliteDb extends SQLite3
{
$this->open('test.db');
$this->createLogin();
//$this->createTable();
$this->createTable();
}
function createTable(){

@ -8,3 +8,4 @@ $rep=__DIR__.'/../';
$vues['vuePrincipale']='vues/VuePrincipale.php';
$vues['vueLogin']='vues/vueLogin.php';
$vues['vueSupression']='vues/VueSupression.php';
$vues['vueNbQuestions']='vues/VueNbQuestions.php';

@ -49,7 +49,10 @@ class Controleur {
$model = new Modele();
$dVueQuestions = $model->afficherQuestions();
require ($rep.$vues['vueSupression']);
$_SESSION['array']=$dVueQuestions;
//require ($rep.$vues['vueSupression']);
//require ($rep.$vues['vuePrincipale']);
require ($rep.$vues['vueNbQuestions']);
//session_destroy();
}

@ -0,0 +1 @@
Résultat : 1/5

@ -0,0 +1,18 @@
La réponse à la question 1 est JUSTE !
La réponse à la question 2 est FAUSSE !
<br />
<b>Warning</b>: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in <b>C:\xampp\htdocs\BddCorrect\Correcteur.php</b> on line <b>62</b><br />
<br />
<b>Warning</b>: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in <b>C:\xampp\htdocs\BddCorrect\Correcteur.php</b> on line <b>119</b><br />
La réponse à la question 3 est FAUSSE !
<br />
<b>Warning</b>: oci_execute(): ORA-00900: invalid SQL statement in <b>C:\xampp\htdocs\BddCorrect\Correcteur.php</b> on line <b>35</b><br />
<br />
<b>Warning</b>: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in <b>C:\xampp\htdocs\BddCorrect\Correcteur.php</b> on line <b>62</b><br />
La réponse à la question 4 est FAUSSE !
<br />
<b>Warning</b>: oci_execute(): ORA-00900: invalid SQL statement in <b>C:\xampp\htdocs\BddCorrect\Correcteur.php</b> on line <b>35</b><br />
qdsdqdsqdqsreponse : 7question : 23<br />
<b>Warning</b>: oci_execute(): ORA-00900: invalid SQL statement in <b>C:\xampp\htdocs\BddCorrect\Correcteur.php</b> on line <b>244</b><br />
La réponse à la question 5 est FAUSSE !
Résultat : 1/5

Binary file not shown.

@ -48,6 +48,7 @@
<h2>TP 2</h2>
<form method="post" action="Correcteur.php" name="Exam">
<?php $i=0;
foreach ($dVueQuestions as $q) { ?>
<p><?php $i++; echo $q->getNumQuestion() .'.'.$q->getQuestion(); $_SESSION['num']=array(); $_SESSION['num'][$i] =$q->getNumQuestion(); ?> <br/>
<textarea rows="5" cols="70" name="textbox[]" >

@ -0,0 +1,14 @@
<form method="post" class="frmnmbre" >
<input type="text" name="nmbre" id="nmbre" /><br/>
<p><input type="submit" ></p>
</form>
<?php
if(array_key_exists('nmbre',$_POST)){
$test =2;
$_SESSION['nbQuestions']=$_POST['nmbre'];
require ($rep.$vues['vuePrincipale']);
}

@ -46,9 +46,13 @@
<div class="row">
<div class="col-lg-8 mx-auto">
<h2>TP 2</h2>
<form method="post" action="Correcteur.php" name="Exam">
<?php $i=0;
foreach ($dVueQuestions as $q) { ?>
<?php $i=0; //shuffle($dVueQuestions);
$nbQ=1;
foreach ($dVueQuestions as $q) {
if($nbQ > $_SESSION['nbQuestions'])
break; ?>
<p><?php $i++; echo $q->getNumQuestion() .'.'.$q->getQuestion(); $_SESSION['num']=array(); $_SESSION['num'][$i] =$q->getNumQuestion(); ?> <br/>
<textarea rows="5" cols="70" name="textbox[]" >
<?php echo (isset($_SESSION['fi'][$i]) ? $_SESSION['fi'][$i] : '') ?>
@ -58,7 +62,7 @@
<input type="submit" name="act" value="supprimer">
<input type="submit" name="act" value="supprimer définitivement">
<?php } //fin foreach ?>
<?php $i++; $nbQ++; } //fin foreach ?>
<p><input type="submit" ></p>

@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="../css/bootstrap.min.css">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top" id="mainNav">
@ -46,8 +46,10 @@
<div class="col-lg-8 mx-auto">
<h2>TP 2</h2>
<form method="post" action="Suppression.php" name="Exam">
<?php $i=0;
foreach ($dVueQuestions as $q) { ?>
<?php include '../metier/Question.php';
$i=0;
session_start();
foreach ($_SESSION['array'] as $q) { ?>
<p><?php $i++; echo $q->getNumQuestion() .'.'.$q->getQuestion(); $_SESSION['num']=array(); $_SESSION['num'][$i] =$q->getNumQuestion(); ?> <br/>
<label>
<input type="radio" name="<?php echo $q->getNumQuestion(); ?>" value="supprimer" style="margin-bottom:15px"> supprimer

Loading…
Cancel
Save