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
		
			
				
	
	
		
			118 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			118 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
| <?php
 | |
| 
 | |
| if ($validato == 0)	header ("location: login.php");
 | |
| 
 | |
| ?>
 | |
| 
 | |
| <html>
 | |
| <head>
 | |
| 	<title>Test</title>
 | |
| 	<LINK rel="stylesheet" type="text/css" href="stile.css">
 | |
| 	<META HTTP-EQUIV="Expires" CONTENT="3"> 
 | |
| </head>
 | |
| 
 | |
| <body>
 | |
| 
 | |
| <?php
 | |
| 
 | |
| include("required.php");
 | |
| include("funzioni.php");
 | |
| 
 | |
| $db = mysql_connect($ip, $user, $password);
 | |
| mysql_select_db($dataname,$db);
 | |
| 
 | |
| //if (isset($test)) echo getvar($tbl_test, "posizione", "id = ".$test);
 | |
| if (isset($test))
 | |
| {
 | |
| 	//echo $iniziale;
 | |
| 	if ((isset ($iniziale)) && ($iniziale == 1))
 | |
| 		EseguiTest($test);
 | |
| 		//echo "esegui";
 | |
| 	else
 | |
| 	{
 | |
| 		if (test_effettuato($test, $validato))
 | |
| 			echo "<br><br><p class=error>Il test è già stato svolto!</p><br><br>";
 | |
| 		else
 | |
| 		{
 | |
| 			if (getvar($tbl_moduli_righe, "posizione", "idtest = ".$test) == $s_prima)
 | |
| 			{
 | |
| 				echo "<br><br><p class=error>Test Prima della lezione non abilitato!</p><br><br>";
 | |
| 			}
 | |
| 			if (getvar($tbl_moduli_righe, "posizione", "idtest = ".$test) == $s_dopo)
 | |
| 			{
 | |
| 				if (test_dopo($test, $validato))
 | |
| 					EseguiTest($test);
 | |
| 					//echo "Puoi eseguire il test adesso!";
 | |
| 				else
 | |
| 					echo "<br><br><p class=error>Prima di effettuare il test occorre scaricare la lezione!</p><br><br>";
 | |
| 			}
 | |
| 		}
 | |
| 	}
 | |
| }
 | |
| 
 | |
| //EseguiTest($test);
 | |
| 
 | |
| function EseguiTest($test)
 | |
| {
 | |
| 	include("required.php");
 | |
| 	//include("funzioni.php");
 | |
| 	$db = mysql_connect($ip, $user, $password);
 | |
| 	mysql_select_db($dataname,$db);
 | |
| 	
 | |
| 	$criteri = "SELECT $tbl_test.id as test, $tbl_test.nome, $tbl_domande.id, $tbl_domande.domanda ";
 | |
| 	$criteri .= "FROM $tbl_test LEFT JOIN $tbl_domande ON $tbl_test.id = $tbl_domande.idtest ";
 | |
| 	$criteri .= "WHERE $tbl_test.id = $test";
 | |
| 	//echo $criteri;
 | |
| 	$result = mysql_query($criteri, $db);
 | |
| 	if ($myrow = mysql_fetch_array($result))
 | |
| 	{
 | |
| 		//$num_test = $myrow[id];
 | |
| 		echo "<form name=form1 action=verifica.php method=post>";
 | |
| 		echo "<table align=center border=1 width=90% cellpadding=2 cellspacing=0>";
 | |
| 		echo "<tr><td class=titolo align=center>".$myrow["nome"]."</td></tr><tr><td><br></td></tr>";
 | |
| 		$n = 1;
 | |
| 		do 
 | |
| 		{
 | |
| 			echo "<tr class=rosso><td height=25><font color=white>$n) $myrow[domanda]</font></td></tr>";
 | |
| 			$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) AND (visibile = $s_vero) ";
 | |
| 			//echo $criteri1;
 | |
| 			$result1 = mysql_query($criteri1, $db);
 | |
| 			if ($myrow1 = mysql_fetch_array($result1))
 | |
| 			{
 | |
| 				do
 | |
| 				{
 | |
| 					if ($riga == true)
 | |
| 					{
 | |
| 						echo "<tr class=scuro><td><input type=checkbox name='scelte[]' value=$myrow1[id]> $myrow1[risposta]<br></td></tr>";
 | |
| 						$riga = false;
 | |
| 					}
 | |
| 					else
 | |
| 					{
 | |
| 						echo "<tr class=chiaro><td><input type=checkbox name='scelte[]' value=$myrow1[id]> $myrow1[risposta]<br></td></tr>";
 | |
| 						$riga = true;
 | |
| 					}
 | |
| 				}while ($myrow1= mysql_fetch_array($result1));
 | |
| 			}
 | |
| 			$n++;
 | |
| 		}while ($myrow = mysql_fetch_array($result));
 | |
| 		echo "<tr><td><input type=hidden name=test value=$test><input type=hidden name=verifica></td></tr>";
 | |
| 		echo "<tr><td align=center><input type=Checkbox name=bianco>Consegna in bianco</td></tr>";
 | |
| 		echo "<tr><td align=center><input type=Reset value=Azzera class=bottoni> <input type=submit value=Correggi class=bottoni></td></tr></table></form>";		
 | |
| 	}
 | |
| 	else
 | |
| 	{
 | |
| 		echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
 | |
| 	}
 | |
| }
 | |
| 
 | |
| 
 | |
| echo "<p><a href=corsi.php>Torna ai corsi</a></p>";
 | |
| 
 | |
| //echo "<p><a href=# onclick=history.back()>Torna</a></p>";
 | |
| 
 | |
| ?>
 | |
| 
 | |
| 
 | |
| </body>
 | |
| </html>
 |