Files correlati : Ricompilazione Demo : [ ] Commento : Versione FAD del 11/10/2001 git-svn-id: svn://10.65.10.50/trunk@9917 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			122 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			122 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
| 
 | |
| <html>
 | |
| <head>
 | |
| 	<title>Corsi</title>
 | |
| 	<LINK rel="stylesheet" type="text/css" href="stile.css">
 | |
| 	<META HTTP-EQUIV="Expires" CONTENT="3"> 
 | |
| </head>
 | |
| 
 | |
| <body>
 | |
| 
 | |
| <?php
 | |
| 
 | |
| include("required.php");
 | |
| $db = mysql_connect($ip, $user, $password);
 | |
| mysql_select_db($dataname,$db);
 | |
| 
 | |
| $criteri = "SELECT * FROM $tbl_domande WHERE (idtest = $test)";
 | |
| //echo $criteri;
 | |
| $result = mysql_query($criteri, $db);
 | |
| if ($myrow = mysql_fetch_array($result))
 | |
| {
 | |
| 	echo "<form name=form1>";
 | |
| 	echo "<table align=center border=1 width=80% cellpadding=2 cellspacing=0>";
 | |
| 	echo "<tr><td class=titolo align=center colspan=2><font color=#1058BA>Risultato del test</font></td></tr><tr><td colspan=2><br></td></tr>";
 | |
| 	$totale = 0;
 | |
| 	$punteggio = 0;
 | |
| 	$n = 1;
 | |
| 	do 
 | |
| 	{
 | |
| 		$vere = 0;
 | |
| 		$false = 0;
 | |
| 		$indovinate = 0;
 | |
| 		$sbagliate = 0;
 | |
| 		echo "<tr class=blu><td width=5% bgcolor=#D3DCED><br></td><td height=25><font color=white>$n) $myrow[domanda]</font></td></tr>";
 | |
| 		//$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) AND (visibile = 'true') ";
 | |
| 		$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) ";
 | |
| 		//echo $criteri1;
 | |
| 		$result1 = mysql_query($criteri1, $db);
 | |
| 		if ($myrow1 = mysql_fetch_array($result1))
 | |
| 		{
 | |
| 			do
 | |
| 			{
 | |
| 				if ($myrow1[valida] == "$s_vero") 
 | |
| 				{
 | |
| 					$valore = "checked";
 | |
| 					$vere++;
 | |
| 				}
 | |
| 				else
 | |
| 				{
 | |
| 					$valore ="";
 | |
| 					$false++;
 | |
| 				}
 | |
| 				$vera = "";
 | |
| 				if (isset ($scelte)) if (in_array($myrow1["id"], $scelte)) $vera = "checked";
 | |
| 				$font = "";
 | |
| 				
 | |
| 				// Risposta errata ma segnata
 | |
| 				if (($vera != $valore) && ($valore != "checked")) 
 | |
| 				{
 | |
| 					$font = "<font color=red>";
 | |
| 					$sbagliate++;
 | |
| 				}
 | |
| 				// Risposta giusta non segnata
 | |
| 				if (($vera != $valore) && ($valore == "checked")) 
 | |
| 					$font = "<font color=green>";
 | |
| 				// Risposta giusta e segnata
 | |
| 				if (($vera == $valore) && ($valore == "checked")) 
 | |
| 					$indovinate++;
 | |
| 				if ($riga == true)
 | |
| 				{
 | |
| 					echo "<tr bgcolor=#BBBBBB><td><input type=checkbox $valore></td><td><input type=checkbox $vera>$font$myrow1[risposta]</font><br></td></tr>";
 | |
| 					//echo "<tr><td><input type=checkbox $valore></td><td><input type=checkbox $vera>$font$myrow1[risposta]</font><br></td></tr>";
 | |
| 					$riga = false;
 | |
| 				}
 | |
| 				else
 | |
| 				{
 | |
| 					echo "<tr bgcolor=#DDDDDD><td><input type=checkbox $valore></td><td><input type=checkbox $vera>$font$myrow1[risposta]</font><br></td></tr>";
 | |
| 					$riga = true;
 | |
| 				}
 | |
| 			}while ($myrow1= mysql_fetch_array($result1));
 | |
| 			//echo "false =".$false;
 | |
| 			//echo "vere = ".$vere;
 | |
| 			//echo "indovinate = ".$indovinate;
 | |
| 			//echo "sbagliate = ".$sbagliate;
 | |
| 			$punteggio = $punteggio + (1/$vere)*$indovinate - (1/$false)*$sbagliate;
 | |
| 			//echo "punteggio =".$punteggio;
 | |
| 		}
 | |
| 		else
 | |
| 		{
 | |
| 			echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
 | |
| 		}
 | |
| 		$n++;
 | |
| 	}while ($myrow = mysql_fetch_array($result));
 | |
| 	//if ($punteggio != 0) $ris = ($punteggio/$totale) * 100;
 | |
| 	$n_test = $n -1;
 | |
| 	//echo "test =".$n_test;
 | |
| 	$ris = ((100 * ($punteggio + $n_test)) / $n_test)/2;
 | |
| 	//echo "ris =".$ris;
 | |
| 	if ($ris != 100)
 | |
| 	{
 | |
| 		if (substr($ris, 3,1) > 5)
 | |
| 			$ris = (substr($ris, 0,2) + 1);	// Approssima per eccesso
 | |
| 		else
 | |
| 			$ris = substr($ris, 0,2);	// Approssima per difetto
 | |
| 	}
 | |
| 	echo "<tr><td colspan=2><br></td></tr><tr><td colspan=2 align=center>Risultato del test: $ris/100</td></tr>";
 | |
| 	echo "</table></form>";
 | |
| }	
 | |
| else
 | |
| {
 | |
| 	echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
 | |
| }
 | |
| 
 | |
| echo "<p><a href=tuttitest.php target=destra>Torna</a></p>";
 | |
| 
 | |
| 
 | |
| ?>
 | |
| 
 | |
| 
 | |
| </body>
 | |
| </html>
 |