<?php
session_start();
include("../../../../phpvar.inc.php");
include("../../mysql_func.php");
include("../../my_func.php");
/*
if (!isset($_SESSION['count'])) {
	$_SESSION['quest']=0;
} else {
	$_SESSION['quest']++;
}
*/

$lk=connect();
//$sid=session_id();
$jour=date("Y-m-d");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Pragma"  content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Expires" content="Mon, 06 May 1996 04:57:00 GMT" />
<meta http-equiv="reply-to" content="mailto:mail@1info.com" />
<meta name="classification" content="Global" />
<meta name="robots" content="index, follow" />
<meta name="distribution" content="Global" />
<meta name="rating" content="General" />
<meta name="copyright" content="Copyright 1997-2001 - 1computer - http://www.1info.com/" />
<meta name="author" content="Mengis Raoul" />
<meta name="language" content="fr" />
<meta name="resource-type" content="document" />
<meta name="revisit-after" content="9 days" />
<meta name="bulletin-date" content="06/29/2000" />
<meta name="bulletin-text" content="1info, Site informatique Suisse e-commerce avec informations et forum PC Linux Apple. Hebergement site internet" />
<meta name="description" content="!1info Web site All day news and informations Francais Deutch Italiano English Sion Valais Suisse Europa" />
<meta name="keywords" content="Computer, Ordinateur, Shopping, Cours, Informatique, Photo, Shop, E-Commerce, Informatiques, Informatik, Mengis, Ecole, School, Scuola, Formation, Etudes, Sion, valais, Sitten, Suisse, Schweiz,Switzerland, Svizzera, Import, Export" />
<meta name="keywords" lang="en-us" content="Computer, Shopping, Shop, Mengis, School, Sion, valais, Sitten, Suisse, Schweiz,Switzerland, Svizzera, Import, Export, Screen, Printer" />
<meta name="keywords" lang="fr" content="Computer, Ordinateur, Shopping, Cours, Informatique, Photo, Shop, E-Commerce, Informatiques, Informatik, Mengis, Ecole, School, Scuola, Formation, Etudes, Sion, valais, Sitten, Suisse, Schweiz,Switzerland, Svizzera, Import, Export" />
<title>1info test evaluation etude ecole</title>
<link rel="shortcut icon" href="../1info.ico" />
<link rel="stylesheet" type="text/css" href="../../style.css" />
</head>
<div align="center"><center>
<?php
$fond="clouds.jpg";
//$fond="star.gif";
print ("<body  background='../images/fond/$fond'>\n");
$PageTitre="Info Panier Basket &euro;-Shop";  
$sMenu="<a href='http://www.1info.com' title='home'>|<img src='../images/mini_home.gif' alt='home' width='20' height='20' border='0' />|</a>";
$sMenu.="<a href='http://www.1info.com/svs'>Food</a>\n";
$sMenu.="|<a href='http://www.1info.com/1computer'>-1-Computer</a>\n";
$sMenu.="|<a href='http://www.1info.com/store'>Store</a>\n";
$sMenu.="|<a href='http://www.1info.com/school'>School</a>\n";
//$PageTitre=$PageTitre./euro;
require("tete.php");
if (isset($_GET['code']))
        $code=$_GET['code']; 
		else 
		$code=$_POST['code'];
if ($code=='')
	$code=11;

if (isset($_POST['tab']))
	$tab=$_POST['tab'];

if (isset($_POST['flag'])){
        $quest=$_POST['quest']+1;
        if (IsSet($_POST['var'])){
                foreach ($_POST['var'] as $val)
                        $tot+=$val;
                $mask = (1 << 6) - 1;  /// la valeur 6 correspond au nombre max. de reponses possibles - 1
                // $tot=boutton $flag=solution
                if ($tot==$_POST['flag'])
                        $pts+=2; // reponse exacte
                elseif ($tot & (~ ($_POST['flag'] & $mask)))
                        $pts-=1; // au moins une reponse fausse
                elseif ($tot > 0)
                        if ($tot & $_POST['flag'])
                                $pts+=1; // reponse partiellement correcte
                else
                        $pts+=0; //pas de reponse
        $score=$_POST['score']+$pts; }
        else {
                if ($_POST['flag']==0)
                        $pts+=2; //pas de reponse c'est juste
                else
                        $pts=0; //pas de reponse c'est faux
        $score=$_POST['score']+$pts;
        }

//pas de tableau 1
//ajout des valeurs dans tableau
if ($_POST['tab'] ==''){
        $sql ="SELECT code_quest FROM quest WHERE idx_quest='$code'";
        if ($res=send_sql($db, $sql)) {
                ;
        }
        $qte=mysql_num_rows($res);
        //srand((double) microtime() * 1000000);
        for ($i=0;$i < $qte;$i++) {
           $row = mysql_fetch_row($res);
           $tab[]=$row[0];
           //array_push($tab, $row[0]);
        }
        shuffle($tab);
        //print("$tab[0]");
        //while (list(, $valeur) = each ($tab)) print("$valeur:");
        }
        else
        		$tab=explode(",", $tab);
//print("tab:$tab[0]");
//while (list(, $valeur) = each ($tab)) print("$valeur:");
}
else {
        //if ($_POST['code']=='')
          //      $code=11;

//pas de tableau 2
//ajout des valeurs dans tableau
if ($_POST['tab']==''){
        $sql ="SELECT code_quest FROM quest WHERE idx_quest='$code'";
        if ($res=send_sql($db, $sql)) {
                ;
        }
        $qte=mysql_num_rows($res);
        //srand((double) microtime() * 1000000);
        for ($i=0;$i < $qte;$i++) {
           $row = mysql_fetch_row($res);
           $tab[]=$row[0];
           //array_push($tab, $row[0]);
        }
        shuffle($tab);
        //print("$tab[0]");
        //while (list(, $valeur) = each ($tab)) print("$valeur:");
        }

}

// ******************* selection question

//$sql ="SELECT idx_quest AS '$idx', quest_quest as '$quest', pv_art as '$prix', qte_com as '$quant', art_com as '$code' ,date_com as '$jour', code_com as '$code_cli' FROM panier as P, article as A  WHERE P.art_com=A.code_art AND P.id_com LIKE'%$sid%'";
$sql ="SELECT * FROM quest WHERE code_quest='$tab[0]'";
if ($res=send_sql($db, $sql)) {
    ;
    }
//$qte=mysql_num_rows($res);
//srand((double) microtime() * 1000000);
//$qte=rand(1, $qte);
//for ($i=0;$i < $qte;$i++)
        $row  =  mysql_fetch_row($res);
        $tab=array_slice($tab, 1); //enlever 1 er elements du tableau
        //unset($tab[0]);//enlever 1 er elements du tableau
//$test = mysql_fetch_array($res);

print ("<div align='center'>\n");
print ("<br /><table><tr><td>\n");
print ("<a href='http://www.1computer.info'>");
print ("<img src='http://www.1computer.info/images/logo/linux_advanced.gif'\n");
print ("alt='Redhat' border='0' height='120' width='160' /></a></td><td>");
open_cadre(ffdd99);
//open_bordure(ffbb00);
print ("<table><tr><td style='text-align:center'>\n");
print ("<div align='center'>\n");
open_cadre(ffbb00);
print ("$row[2]\n");
close_cadre(ffbb00); 
print ("</div>\n");
print ("<br /><table>\n");
print "<form action='$_SERVER[PHP_SELF]' method='post'>";
print ("<tr><td><input name='var[]' type='checkbox' value='1' /></td><td>\n");
open_cadre(b8c8ff);
print ("$row[3]\n");
close_cadre(b8c8ff);
print ("</td><td><input name='var[]' type='checkbox' value='2' /></td><td>\n");
open_cadre(b8c8ff);
print ("$row[4]\n");
close_cadre(b8c8ff);
print ("</tr><tr><td><input name='var[]' type='checkbox' value='4' /></td><td>\n");
open_cadre(b8c8ff);
print ("$row[5]\n");
close_cadre(b8c8ff);
print ("<td><input name='var[]' type='checkbox' value='8' /></td><td>\n");
open_cadre(b8c8ff);
print ("$row[6]\n");
close_cadre(b8c8ff);
print ("</tr><tr><td><input name='var[]' type='checkbox' value='16' /></td><td>\n");
open_cadre(b8c8ff);
print ("$row[7]\n");
close_cadre(b8c8ff);
print ("<td><input name='var[]' type='checkbox' value='32' /></td><td>\n");
open_cadre(b8c8ff);
print ("$row[8]\n");
close_cadre(b8c8ff); 
$tab = implode(",", $tab);
print ("<input type='hidden' name='code' value='$code' />\n");
print ("<input type='hidden' name='score' value='$score' />\n");
print ("<input type='hidden' name='quest' value='$quest' />\n");
print ("<input type='hidden' name='flag' value='$row[10]' />\n");
print ("<input type='hidden' name='tab' value='$tab' />\n");
print ("<tr><td></td><td><input type='submit' name='submit' value='Next' /></td>\n");
print ("    <td></td><td><input type='reset' name='Annuler' value='Cancel' /></td></tr>\n");
print ("</form>\n</table>\n</td></tr><tr><td style='text-align:center'>\n");
open_cadre(ffdd99);
//print ("<tr><td>row:{$_POST['flag']} post_tab:{$_POST['tab']} tab:$tab code:$code</td></tr>\n");
close_cadre(ffdd99);           
if (!$quest==0)
        $val=round($score/$quest*50 ,1);
print ("<div align='center'>\n");
print ("<table border='3'><tr><td>");
print ("<table border='border'><tr>");
print ("<td style='font-size:10pt'>");
print ("Points</td><td>Total</td><td>Questions</td><td>Score</td></tr>\n");
print ("<tr><td style='font-size:18pt; text-align:center; background-color:cyan'>");
print ("$pts</td><td style='font-size:16pt; text-align:center'>$score</td><td style='font-size:16pt; text-align:center'>$quest</td><td  style='font-size:16pt; text-align:center'>$val%</td>\n");
print ("</tr>");
print ("</table>");
print ("</td></tr>");
print ("</table></div>");
//close_cadre(ffbb00);
//print ("Points:".$pts." Total:".$score." Questions:".$quest." Taux %:".($quest/$score*50)."\n");
print("</td></tr></table>\n");
//find de la bordure general
//close_bordure(ffbb00);
close_cadre(ffdd99);
print ("</td></tr></table>");
print ("</div>\n");
print ("<div align='center'><center><table><tr>\n");
print ("<th><a href='http://www.1info.com/1computer'> <img src='http://www.1info.com/1computer/images/baner/bandeauchat5.gif' alt='Vente Shoping computer' border='0' /></a></th>\n");
//print ("<th><p align='right'><a href='#' OnClick='javascript:window.print()'><img src='../../images/print.gif' border='0' /></a></p></th>\n");
print ("</tr></table></div></center>\n");
require("pied.php");
?>
