# version 1.july232005
# session version not work at thaiall.com but work on omni in tot
#
if (isset($_GET["show"])) { show($_GET["show"],$_GET["i"]); exit;}
if (!isset($_POST["no"])) home();
if (!isset($_POST["seed"])) $_POST["seed"] = time();
if (isset($_POST["no"])) $_SESSION["no"] = $_POST["no"];
if (!isset($_SESSION["no"])) $_SESSION["no"] = 1;
if (isset($_POST["reload"]) || isset($_POST["home"])) $_SESSION["no"] = 1;
if (isset($_POST["next"])) $_SESSION["no"]++;
### === for first
if ($_SESSION["no"] == 1) {
srand($_POST["seed"]);
for($a = "a"; $a <= "i"; $a++) $_SESSION["a".$a] = "";
$q = file("qjava10txt.zip");
$qo = $q;
for($a = "a"; $a <= "i"; $a++) {
$c = 0;
foreach ($q as $v) if (substr($v,1,1) == $a) $c++;
$s = (rand() % $c) + 1;
$i = 1;
foreach ($q as $v) {
if (substr($v,1,1) == $a) {
if ($i == $s) {
$ar = split("\t",$v);
$_SESSION["q".$a] = $v;
}
$i++;
}
}
}
} else
### === for not first (keep answer)
if (isset($_POST[$_POST["q"]]))
$_SESSION["a".$_POST["q"]] = $_POST[$_POST["q"]];
else {
for($i = 1; $i <= 9; $i++)
if (isset($_POST[$_POST["q"].$i])) {
if (strlen($_SESSION["a".$_POST["q"]]) > 0) $_SESSION["a".$_POST["q"]].=",";
$_SESSION["a".$_POST["q"]] = $_SESSION["a".$_POST["q"]] . $_POST[$_POST["q"].$i];
}
}
### === for last
if ($_SESSION["no"] == 10) {
$sess{'a'} = "Declarations and Access Control";
$sess{'b'} = "Flow Control, Assertions and Exception Handling";
$sess{'c'} = "Gargage Collection";
$sess{'d'} = "Language Fundamentals";
$sess{'e'} = "Operators and Assignments";
$sess{'f'} = "Overloading, Overriding, Runtime Type and Object Orientation";
$sess{'g'} = "Threads";
$sess{'h'} = "Fundamental Classes in the java.lang package";
$sess{'i'} = "The Collections Framework";
$i = 1;
$correct = 0;
echo "
";
echo "No. | Session | Correct Answer | Your Answer | Score | ";
for($a = "a"; $a <= "i"; $a++) {
$ar1 = split("\n",$_SESSION["q".$a]);
$arn = split("\r",$ar1[0]);
$ar = split("\t",$arn[0]);
echo "$i | ". $sess{$a} ." | ". $ar[2] ." | ".$_SESSION["a".$a]." | ";
if ($ar[2] == $_SESSION["a".$a]) {
echo "100%";
$correct++;
} else echo "0%";
echo " | ";
$i++;
}
echo "Total Score | ". $correct * 10 ."% | ";
echo " ";
echo " I have a new version for some problem solving. Click for Post version";
} else {
### === for next
for($i=1,$a="a"; $a <= "i"; $a++,$i++) {
if ($i == $_SESSION["no"]) show($a,$i);
} // for $a
} // if 11
?>
|
footer(); ?>
|