Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- include 'dbc.php';
- page_protect();
- $db_host="localhost";
- $db_name="quiz";
- $db_user="";
- $db_pass="";
- $r=session_id();
- ?>
- <input type="hidden" name="session_i1d" value="<? echo $r; ?>">
- <?
- $conn=mysql_connect($db_host,$db_user,$db_pass) or die("Impossibile connettersi al server MySQL.");
- mysql_select_db($db_name) or die("Selezione del database non riuscita");
- $get_question_log = ("SELECT question_id from log where session = '$r'");
- $result_get_question_log = mysql_query($get_question_log);
- $row_get_question_log = mysql_fetch_array($result_get_question_log);
- $question_id_log = $row_get_question['question_id'];
- $que = "$question_id_log";
- $quee = $row_get_question['question_id_log'];
- echo "$que";
- $get_question = ("SELECT * from questions where question_id ='1' order by rand() limit 1");
- //<> '$quee'
- $result_get_question = mysql_query($get_question);
- $row_get_question = mysql_fetch_array($result_get_question);
- $question_id = $row_get_question['question_id'];
- $question = $row_get_question['question'];
- $a1 = $row_get_question['a1'];
- $a2 = $row_get_question['a2'];
- $a3 = $row_get_question['a3'];
- $a4 = $row_get_question['a4'];
- $input = array("$a1", "$a2", "$a3", "$a4");
- shuffle($input);
- $materia = $row_get_question['materia'];
- $contenuto = $row_get_question['contenuto'];
- $livello = $row_get_question['livello'];
- $sub_contenuto = $row_get_question['sub_contenuto'];
- $pratico = $row_get_question['pratico'];
- $correct = $row_get_question['correct'];
- // $query_insert = mysql_query("insert into log (question_id, session,user) values ('$question_id','$r','$user_name')");
- ?>
- <dd><em>Benvenuto <strong> <?php echo $_SESSION['user_name'];?> </strong><br><br>
- <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
- <script>
- $(document).ready(function() {
- $('.checkbox').change(function(){
- if ($(this).is(':checked')) {
- $(this).next().show();
- } else {$(this).next().hide();}
- });
- });//FINE DOM
- </script>
- <style>
- .box-esatto{ padding:20px; background:#acd384; border:1px dashed #6d9842; display:none;}
- .box-errato{ padding:20px; background:#FF0000; border:1px dashed #6d9842; display:none;}
- </style>
- <style type="text/css">
- .blood {
- font-weight: bold;
- }
- </style>
- <style type="text/css">
- .blood {
- font-weight: bold;
- }
- </style>
- <table width="1241" height="591" border="0" align="center">
- <tr>
- <td width="1231"><table width="1240" height="36" border="0">
- <tr>
- <td width="98" class="blood">Livello</td>
- <td width="322"><? echo $livello ?></td>
- <td width="106" class="blood">Pratico</td>
- <td width="686"><? echo $pratico ?></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td height="23"> </td>
- </tr>
- <tr>
- <td height="191"><table width="1241" height="153" border="0">
- <tr>
- <td width="103" class="blood">Materia</td>
- <td width="1122"><? echo $materia ?></td>
- </tr>
- <tr>
- <td class="blood">Contenuto</td>
- <td><? echo $contenuto ?></td>
- </tr>
- <tr>
- <td colspan="2"> </td>
- </tr>
- <tr>
- <td class="blood">Domanda</td>
- <td><? echo $question ?></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td><table width="1242" height="168" border="0">
- <tr>
- <td width="58"><input type="radio" name="click" class="checkbox" value="<? echo $a1 ?>" />
- <? if ($correct=='a1') {
- // if ($a1 == $correct) {
- ?>
- <div class="box-esatto">
- Risposta Esatta!
- </div>
- <? } else { ?>
- <div class="box-errato">
- Risposta Errata!
- </div>
- <? } ?></td>
- <td width="1168"><? echo $a1?> </td>
- </tr>
- <tr>
- <td><input type="radio" name="click" class="checkbox" value="<? echo $a2?>">
- <? if ( $correct=='a2') {
- ?>
- <div class="box-esatto"> Risposta Esatta! </div>
- <? } else { ?>
- <div class="box-errato"> Risposta Errata! </div>
- <? } ?></td>
- <td><? echo $a2 ?></td>
- </tr>
- <tr>
- <td id="a3"><input type="radio" name="click" class="checkbox" value="<? echo $a3?>">
- <? if ( $correct=='a3') {
- ?>
- <div class="box-esatto"> Risposta Esatta! </div>
- <? } else { ?>
- <div class="box-errato"> Risposta Errata! </div>
- <? } ?></td>
- <td id="a3"><? echo $a3 ?></td>
- </tr>
- <tr>
- <td><input type="radio" name="click" class="checkbox" value="<? echo $a4?>">
- <? if ( $correct=='a4') {
- ?>
- <div class="box-esatto"> Risposta Esatta! </div>
- <? } else { ?>
- <div class="box-errato"> Risposta Errata! </div>
- <? } ?></td>
- <td><?echo $a4 ?></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td><table width="1231" height="54" border="0">
- <tr>
- <td width="135" class="blood">Sub contenuto</td>
- <td width="1080"><? echo $sub_contenuto ?></td>
- </tr>
- <tr>
- <td>Numero</td>
- <td><? echo $question_id ?></td>
- </tr>
- </table></td>
- </tr>
- </table>
- <br><br>
- <?
- $get_ans = ("SELECT * from answare where id ='1' ");
- //<> '$quee'
- $result_ans = mysql_query($get_ans);
- $row = mysql_fetch_array($result_ans);
- $correct = $row['correct'];
- ?>
- Risposta corretta : <?
- if ($correct =='1') {
- echo "$correct ";
- }
- ?>
- <br>
- <br>
- <input type="button" value="Prossima Domanda" onClick="window.location.reload()">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement