|
|
|
@ -7,23 +7,34 @@ require_once('SqliteDb.php');
|
|
|
|
|
header('Content-type: text/plain');
|
|
|
|
|
|
|
|
|
|
$db = new SqliteDb();
|
|
|
|
|
$conn = oci_connect('u_prems', '123456','localhost/orcl');
|
|
|
|
|
/*if(!$conn){
|
|
|
|
|
echo 'conn ERRROROR';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo 'conn SUCCCESSSS';
|
|
|
|
|
}*/
|
|
|
|
|
$cmpt = 0;
|
|
|
|
|
$i = 0;
|
|
|
|
|
foreach ($_POST['textbox'] as $textbox) {
|
|
|
|
|
$i++;
|
|
|
|
|
//$reponseUser = $_POST[''];
|
|
|
|
|
$query = $db->prepare('SELECT reponse FROM Correct WHERE rowid= ? ');
|
|
|
|
|
$query->bindParam(1, $i);
|
|
|
|
|
$result = $query->execute();
|
|
|
|
|
while($row = $result->fetchArray()){
|
|
|
|
|
if ($row['reponse'] == $textbox) {
|
|
|
|
|
echo "La réponse à la question n° ".$i." est JUSTE\n";
|
|
|
|
|
$cmpt++;
|
|
|
|
|
$i++;
|
|
|
|
|
$oracleQuery = oci_parse($conn, $textbox);
|
|
|
|
|
$reponseUser = oci_execute($oracleQuery);
|
|
|
|
|
|
|
|
|
|
$sqliteQuery = $db->prepare('SELECT reponse FROM Correct WHERE rowid= ? ');
|
|
|
|
|
$sqliteQuery->bindParam(1, $i);
|
|
|
|
|
$result = $sqliteQuery->execute();
|
|
|
|
|
|
|
|
|
|
while(($oracleRow = oci_fetch_array($oracleQuery, OCI_BOTH)) && ($sqliteRow = $result->fetchArray())){
|
|
|
|
|
echo 'oracle = ' . $oracleRow[0] . ' sqliet = ' . $sqliteRow[0] . '\n';
|
|
|
|
|
if ($sqliteRow['reponse'] == $oracleRow[0]) {
|
|
|
|
|
echo "La réponse à la question n° " . $i . " est JUSTE\n";
|
|
|
|
|
$cmpt++;
|
|
|
|
|
} else {
|
|
|
|
|
echo 'La réponse à la question n° ' . $i . " est FAUSSE\n\n";
|
|
|
|
|
}
|
|
|
|
|
else echo 'La réponse à la question n° '.$i." est FAUSSE\n\n";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
echo 'Résultat ' . $cmpt . '/' . $i;
|
|
|
|
|
|
|
|
|
|