Advertisement
Arawan

Untitled

Jul 18th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. <?
  2. include 'dbc.php';
  3.  
  4. page_protect();
  5.  
  6. $db_host="localhost";
  7. $db_name="quiz";
  8. $db_user="";
  9. $db_pass="";
  10. $r=session_id();
  11. ?>
  12. <input type="hidden" name="session_i1d" value="<? echo $r; ?>">
  13. <?
  14.  
  15. $conn=mysql_connect($db_host,$db_user,$db_pass) or die("Impossibile connettersi al server MySQL.");
  16. mysql_select_db($db_name) or die("Selezione del database non riuscita");
  17.  
  18. $get_question_log = ("SELECT question_id from log where session = '$r'");
  19.  
  20. $result_get_question_log = mysql_query($get_question_log);
  21.  
  22. $row_get_question_log = mysql_fetch_array($result_get_question_log);
  23.  
  24. $question_id_log = $row_get_question['question_id'];
  25.  
  26. $que = "$question_id_log";
  27.  
  28. $quee = $row_get_question['question_id_log'];
  29.  
  30. echo "$que";
  31.  
  32. $get_question = ("SELECT * from questions where question_id ='1' order by rand() limit 1");
  33. //<> '$quee'
  34.  
  35. $result_get_question = mysql_query($get_question);
  36.  
  37. $row_get_question = mysql_fetch_array($result_get_question);
  38.  
  39. $question_id = $row_get_question['question_id'];
  40.  
  41. $question = $row_get_question['question'];
  42.  
  43. $a1 = $row_get_question['a1'];
  44.  
  45. $a2 = $row_get_question['a2'];
  46.  
  47. $a3 = $row_get_question['a3'];
  48.  
  49. $a4 = $row_get_question['a4'];
  50.  
  51. $input = array("$a1", "$a2", "$a3", "$a4");
  52.  
  53. shuffle($input);
  54.  
  55.  
  56.  
  57.  
  58. $materia = $row_get_question['materia'];
  59. $contenuto = $row_get_question['contenuto'];
  60. $livello = $row_get_question['livello'];
  61. $sub_contenuto = $row_get_question['sub_contenuto'];
  62. $pratico = $row_get_question['pratico'];
  63.  
  64. $correct = $row_get_question['correct'];
  65.  
  66. // $query_insert = mysql_query("insert into log (question_id, session,user) values ('$question_id','$r','$user_name')");
  67.  
  68. ?>
  69.  
  70. <dd><em>Benvenuto <strong> <?php echo $_SESSION['user_name'];?> </strong><br><br>
  71.  
  72. <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
  73. <script>
  74.  
  75. $(document).ready(function() {
  76.  
  77. $('.checkbox').change(function(){
  78.  
  79. if ($(this).is(':checked')) {
  80.  
  81. $(this).next().show();
  82.  
  83. } else {$(this).next().hide();}
  84.  
  85. });
  86.  
  87. });//FINE DOM
  88. </script>
  89.  
  90. <style>
  91. .box-esatto{ padding:20px; background:#acd384; border:1px dashed #6d9842; display:none;}
  92. .box-errato{ padding:20px; background:#FF0000; border:1px dashed #6d9842; display:none;}
  93. </style>
  94.  
  95.  
  96.  
  97.  
  98.  
  99. <style type="text/css">
  100. .blood {
  101. font-weight: bold;
  102. }
  103. </style>
  104. <style type="text/css">
  105. .blood {
  106. font-weight: bold;
  107. }
  108. </style>
  109.  
  110.  
  111.  
  112.  
  113. <table width="1241" height="591" border="0" align="center">
  114. <tr>
  115. <td width="1231"><table width="1240" height="36" border="0">
  116. <tr>
  117. <td width="98" class="blood">Livello</td>
  118. <td width="322"><? echo $livello ?></td>
  119. <td width="106" class="blood">Pratico</td>
  120. <td width="686"><? echo $pratico ?></td>
  121. </tr>
  122. </table></td>
  123. </tr>
  124. <tr>
  125. <td height="23">&nbsp;</td>
  126. </tr>
  127. <tr>
  128. <td height="191"><table width="1241" height="153" border="0">
  129. <tr>
  130. <td width="103" class="blood">Materia</td>
  131. <td width="1122"><? echo $materia ?></td>
  132. </tr>
  133. <tr>
  134. <td class="blood">Contenuto</td>
  135. <td><? echo $contenuto ?></td>
  136. </tr>
  137. <tr>
  138. <td colspan="2">&nbsp;</td>
  139. </tr>
  140. <tr>
  141. <td class="blood">Domanda</td>
  142. <td><? echo $question ?></td>
  143. </tr>
  144. </table></td>
  145. </tr>
  146. <tr>
  147. <td><table width="1242" height="168" border="0">
  148. <tr>
  149.  
  150. <td width="58"><input type="radio" name="click" class="checkbox" value="<? echo $a1 ?>" />
  151. <? if ($correct=='a1') {
  152. // if ($a1 == $correct) {
  153. ?>
  154. <div class="box-esatto">
  155. Risposta Esatta!
  156. </div>
  157. <? } else { ?>
  158. <div class="box-errato">
  159. Risposta Errata!
  160. </div>
  161. <? } ?></td>
  162. <td width="1168"><? echo $a1?> </td>
  163. </tr>
  164.  
  165.  
  166. <tr>
  167. <td><input type="radio" name="click" class="checkbox" value="<? echo $a2?>">
  168. <? if ( $correct=='a2') {
  169. ?>
  170. <div class="box-esatto"> Risposta Esatta! </div>
  171. <? } else { ?>
  172. <div class="box-errato"> Risposta Errata! </div>
  173. <? } ?></td>
  174. <td><? echo $a2 ?></td>
  175. </tr>
  176.  
  177.  
  178.  
  179.  
  180. <tr>
  181. <td id="a3"><input type="radio" name="click" class="checkbox" value="<? echo $a3?>">
  182. <? if ( $correct=='a3') {
  183. ?>
  184. <div class="box-esatto"> Risposta Esatta! </div>
  185. <? } else { ?>
  186. <div class="box-errato"> Risposta Errata! </div>
  187. <? } ?></td>
  188. <td id="a3"><? echo $a3 ?></td>
  189. </tr>
  190. <tr>
  191. <td><input type="radio" name="click" class="checkbox" value="<? echo $a4?>">
  192. <? if ( $correct=='a4') {
  193. ?>
  194. <div class="box-esatto"> Risposta Esatta! </div>
  195. <? } else { ?>
  196. <div class="box-errato"> Risposta Errata! </div>
  197. <? } ?></td>
  198. <td><?echo $a4 ?></td>
  199. </tr>
  200. </table></td>
  201. </tr>
  202. <tr>
  203. <td><table width="1231" height="54" border="0">
  204. <tr>
  205. <td width="135" class="blood">Sub contenuto</td>
  206. <td width="1080"><? echo $sub_contenuto ?></td>
  207. </tr>
  208. <tr>
  209. <td>Numero</td>
  210. <td><? echo $question_id ?></td>
  211. </tr>
  212. </table></td>
  213. </tr>
  214. </table>
  215.  
  216.  
  217.  
  218. <br><br>
  219. <?
  220. $get_ans = ("SELECT * from answare where id ='1' ");
  221. //<> '$quee'
  222.  
  223. $result_ans = mysql_query($get_ans);
  224.  
  225. $row = mysql_fetch_array($result_ans);
  226.  
  227. $correct = $row['correct'];
  228. ?>
  229. Risposta corretta : <?
  230. if ($correct =='1') {
  231. echo "$correct ";
  232. }
  233.  
  234. ?>
  235. <br>
  236. <br>
  237. <input type="button" value="Prossima Domanda" onClick="window.location.reload()">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement