Viewing file: index.php (4.59 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<html>
<title>
Concurso de Calidad
</title>
<?php
$alea = rand(1,42);
require_once('conn/conexion.php');
$sql ="SELECT * FROM quiz where grupo=$alea order by id asc";
$result = @mysql_query($sql,$link) or die(mysql_error());
?>
<HEAD>
<style>
body { font-family:arial, verdana; font-size:12px; margin-left:40px; margin-right:40px;background-color:#f0f0f0;}
table { font-family:arial, verdana; font-size:12px;}
</style>
</HEAD>
<BODY>
<DIV ALIGN="CENTER">
<table width="100%" border="0" cellspacing="0" cellpadding="6" style="border:1px solid #ccc" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#0033CC"><font color="#FFFFFF" size="5"><strong>Cuestionario
MECI</strong></font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><b><font color="#990000">Pruebe su conocimiento!</font></b>
</td>
</tr>
<tr>
<td style="background-image: url(img/fondo.jpg); background-repeat:repeat-y; padding-left:30px">
</td>
</tr>
<tr>
<form>
<td style="background-image: url(img/fondo.jpg); background-repeat:repeat-y; padding-left:30px">
<script language="JavaScript">
var ans = new Array;
var done = new Array;
var yourAns = new Array;
var explainAnswer = new Array;
var score = 0;
</script>
<?
do{
switch ($row['num']){
case 4:{
echo "<b>{$row['id']}. {$row['preg']}</b>"."<br>";
echo '<input type=radio name="q'.$row['id'].'" value="a" onClick="Engine('.$row['id'].', this.value)">a) '.$row['a'].'<br>';
echo '<input type=radio name="q'.$row['id'].'" value="b" onClick="Engine('.$row['id'].', this.value)">b) '.$row['b'].'<br>';
echo '<input type=radio name="q'.$row['id'].'" value="c" onClick="Engine('.$row['id'].', this.value)">c) '.$row['c'].'<br>';
echo '<input type=radio name="q'.$row['id'].'" value="d" onClick="Engine('.$row['id'].', this.value)">d) '.$row['d'].'<br><bR>';
echo '<script language=javascript>';
echo "ans[{$row[id]}] = '{$row[respu]}'\n";
echo '</script>';
break;
}
case 2:{
echo "<b>{$row['id']}. {$row['preg']}</b>"."<br>";
echo '<input type=radio name="q'.$row['id'].'" value="a" onClick="Engine('.$row['id'].', this.value)">a) '.$row['a'].'<br>';
echo '<input type=radio name="q'.$row['id'].'" value="b" onClick="Engine('.$row['id'].', this.value)">b) '.$row['b'].'<br><br>';
echo '<script language=javascript>';
echo "ans[{$row[id]}] = '{$row[respu]}'\n";
echo '</script>';
break;
}
case 5:{
echo "<b>{$row['preg']}</b>"."<br>";
echo '<input type=radio name="q'.$row['id'].'" value="'.$row['id'].'" onClick="Engine('.$row['id'].', this.value)">a)'.$row['a'].'<br>';
echo '<input type=radio name="q'.$row['id'].'" value="'.$row['id'].'" onClick="Engine('.$row['id'].', this.value)">'.$row['b'].'<br>';
echo '<input type=radio name="q'.$row['id'].'" value="'.$row['id'].'" onClick="Engine('.$row['id'].', this.value)">'.$row['c'].'<br>';
echo '<input type=radio name="q'.$row['id'].'" value="'.$row['id'].'" onClick="Engine('.$row['id'].', this.value)">'.$row['c'].'<br>';
echo '<input type=radio name="q'.$row['id'].'" value="'.$row['id'].'" onClick="Engine('.$row['id'].', this.value)">'.$row['d'].'<br><bR>';
echo '<script language=javascript>';
echo "ans[{$row[id]}] = '{$row[respu]}'\n";
echo '</script>';
break;
}
}
}while($row = mysql_fetch_array($result, MYSQL_ASSOC));
?>
<script language="JavaScript">
function Engine(question, answer) {
yourAns[question]=answer;
}
function Score(){
var answerText = "Como lo hice?\n------------------------------------\n";
for(i=1;i<=5;i++)
{
answerText=answerText+"\nPregunta :"+i+"";
if(ans[i]!=yourAns[i]){
//answerText=answerText+"\nLa respuesta correcta es "+ans[i]+"\n"+explainAnswer[i]+"\n";
answerText=answerText+"\nIncorrecto\nLa respuesta correcta es "+ans[i]+"\n";
}
else{
answerText=answerText+" \nRespuesta correcta! \n";
score++;
}
}
answerText=answerText+"\n\nPuntaje total : "+score+"\n";
alert(answerText);
window.location="http://192.168.175.30/php/reqintranet.php";
}
</script>
<div align="center">
<input name="button" type=button onClick="Score()" value="Enviar respuestas" style="color:blue; padding:10px; width:180px; font-weight:bold">
<input name="button" type=reset value="Borrar respuestas" style="color:blue; padding:10px; width:180px; font-weight:bold">
<input name="button2" type=button value="Ver mas preguntas" style="color:blue; padding:10px; width:180px; font-weight:bold" onClick="window.location='index.php';">
</div></td>
</form>
</tr>
</table>
</DIV>
</body>
</html>
|