Your IP : 216.73.217.87


Current Path : /hdd/hdd11/www/sick/testme/
Upload File :
Current File : /hdd/hdd11/www/sick/testme/indexw.php

<?php
	header("Cache-Control: no-cache, must-revalidate");
	header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
	$sp=$_POST["sp"];
	$sn=$_POST["sn"];
	$kl=$_POST["kl"];
	$tn=$_POST["tn"];
	$ast=$_POST["ast"];
	$tstid=$_POST["tstid"];
?><!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="shortcut icon" href="./test_icon.ico" />
		<title>
			Тестове на СОУ &quot;Васил Левски&quot; - Троян
		</title>
		<!--[if lt IE 9]>
			<script type="text/javascript" language="JavaScript">
				window.open("./update.html","_self");
			</script>
		<![endif]-->
		<style type="text/css">
			<!--
			html
				{
					padding-left:			0px;
					padding-right:			0px;
					padding-top:			0px;
					padding-bottom:			0px;
					margin-left:			0px;
					margin-right:			0px;
					margin-top:			0px;
					margin-bottom:			0px;
				}
			body
				{
					padding-left:			0px;
					padding-right:			0px;
					padding-top:			0px;
					padding-bottom:			0px;
					margin-left:			0px;
					margin-right:			0px;
					margin-top:			0px;
					margin-bottom:			0px;
					-webkit-touch-callout:		none;
					-webkit-user-select:		none;
					-khtml-user-select:		none;
					-moz-user-select:		none;
					-ms-user-select:		none;
					user-select:			none;
				}
			div, input, label
				{
					font-family:			Verdana, Arial, sans_serif;
					font-size:			15px;
					cursor:				default;
				}
			label div
				{
					cursor:				pointer;
					height:				20px;
				}
			img.bg
				{
					min-height:			100%;
					min-width:			2048px;
					width:				100%;
					height:				auto;
					position:			fixed;
					top:				0px;
					left:				0px;
				}
			@media screen and (max-width: 2048px)
				{
					img.bg
						{
							left:			50%;
							margin-left:	-1024px;
						}
				}

			-->
		</style>
		<?php
			if ($sp==2)
				{
		?>
		<script language="JavaScript" type="text/javascript">
			<!--
				cht=0;
				function cheater()
					{
						if (cht==0)
							{
								alert('ПРЕДУПРЕЖДЕНИЕ!\nИзлизате от теста и се опитвате да използвате непозволени приоми за подсказване.\nПри повторен опит Вашият тест ще се изпрати с отговорите, които сте написали до момента.\nРешавайте без измама!');
								cht=1;
							}
						else
							{
								timeisup();
							}
					}
			// -->
		</script>
		<script language="JavaScript" type="text/javascript">
			<!--
				function clock()
					{
						i=0;
						sttm--;
						nt=Math.floor(sttm/20);
						m=0;
						s=0;
						while (nt>=60)
							{
								m++;
								nt=nt-60;
							}
						s=nt;
						if (m<10 && s<10)
							{
								document.getElementById("pr").innerHTML="0"+m+":0"+s+"";
							}
						else if (m<10 && s>=10)
							{
								document.getElementById("pr").innerHTML="0"+m+":"+s+"";
							}
						else if (m>=10 && s<10)
							{
								document.getElementById("pr").innerHTML=""+m+":0"+s+"";
							}
						else
							{
								document.getElementById("pr").innerHTML=""+m+":"+s+"";
							}
						if (m<=2)
							{
								document.getElementById("pr").style.color="#FF0000";
							}
						if (m<=0 && s<=0)
							{
								timeisup();
								i=9;
							}
						if (i!=9)
							{
								setTimeout('clock()',50);
							}
					}
				function timeisup()
					{
						qst="";
						<?php
							$i=1;
							while ($i<=16)
								{
									print("qst=qst+\"q\"; cnt=0;if (document.getElementById(\"q".$i."a\").checked) { cnt=1; qst=qst+\"1\"; } if (document.getElementById(\"q".$i."b\").checked) { cnt=2; qst=qst+\"2\"; } if (document.getElementById(\"q".$i."c\").checked) { cnt=3; qst=qst+\"3\"; } if (document.getElementById(\"q".$i."d\").checked) { cnt=4; qst=qst+\"4\"; } if (cnt==0) { cnt=0; qst=qst+\"0\"; } ");
									$i++;
								}
						?>
						document.getElementById("ast").value=qst;
						document.getElementById('frm').submit();
					}
			// -->
		</script>
		<?php
			}
		?>
	</head>
		<?php
			if ($sp==2)
				{
		?>
	<body onblur="cheater(); return true;">
		<?php
				}
			else
				{
		?>
	<body>
		<?php
				}
		?>
		<div>
		<?php
			if ($sp==2)
				{
		?>
		<script language="JavaScript" type="text/javascript" src="./js/shwmsg.js"></script>
		<?php
				}
		?>
		<form action="./" name="frm" id="frm" method="post">
		<div style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px; z-index: 0;">
			<img src="./images/bg.jpg" class="bg" alt="" />
		</div>
		<div id="main_site" style="position: relative; margin: 0 auto; width: 1000px; min-height: 800px; z-index: 1;">
			<div style="position: fixed; margin: 0 auto; width: 1000px; max-height: 100%; height: 100%; min-height: 100%; background: #AA8866; z-index: 2;">
			</div>
			<div style="position: fixed; margin: 0 auto; width: 1000px; max-height: 249px; height: 249px; min-height: 249px; background: #AA8866 url('./images/header.png'); z-index: 5;">
				<div style="position: absolute; font-size: 26px; top: 212px; left: 905px; width: 90px; max-height: 30px; height: 30px; min-height: 30px; background-color: transparent; color: #000000; z-index: 6; text-align: right; overflow: hidden;" id="pr">
				</div>
				<div style="position: absolute; top: 225px; font-size: 13px; left: 275px; width: 625px; max-height: 16px; height: 16px; min-height: 16px; background-color: transparent; color: #000000; z-index: 6; text-align: left; overflow: hidden;" id="stf">
				</div>
			</div>
			<div style="position: relative; top: 249px; z-index: 3; text-align: justify;">
				<?php
					if ($sp==2)
						{
					include("./conn.php");
					mysql_select_db("exams");
					$i=1;
					$isrnd=0;
					$res=mysql_query("SELECT r FROM `tests` WHERE `nd`='".$tn."' LIMIT 1", $db);
					while ($rows=mysql_fetch_row($res))
						{
							$isrnd="".$rows[0]."";
						}
					if ($isrnd==0)
						{
							$res=mysql_query("SELECT * FROM `".$tn."` ORDER BY RAND() LIMIT 16", $db);
						}
					else
						{
							$res=mysql_query("SELECT * FROM `".$tn."` ORDER BY i ASC LIMIT 16", $db);
						}
					while ($rows=mysql_fetch_row($res))
						{
							$qa[$i]="".$rows[0]."";
							$qarr[$i]="".$rows[1]."";
							$aarr[$i]="".$rows[2]."";
							$barr[$i]="".$rows[3]."";
							$carr[$i]="".$rows[4]."";
							$darr[$i]="".$rows[5]."";
							$rabarr[$i]="".$rows[6]."";
							$tarr[$i]="".$rows[7]."";
							$i++;
						}
					$qqo="q".$qa[1]."q".$qa[2]."q".$qa[3]."q".$qa[4]."q".$qa[5]."q".$qa[6]."q".$qa[7]."q".$qa[8]."q".$qa[9]."q".$qa[10]."q".$qa[11]."q".$qa[12]."q".$qa[13]."q".$qa[14]."q".$qa[15]."q".$qa[16]."";
					$i=1;
					$qro="";
					$tss="";
					while ($i<=16)
						{
							$q="".$qarr[$i]."";
							$a="".$aarr[$i]."";
							$b="".$barr[$i]."";
							$c="".$carr[$i]."";
							$d="".$darr[$i]."";
							$rab="".$rabarr[$i]."";
							$t="".$tarr[$i]."";
							if ($t==1)
								{
									$qr=rand(1, 24);
									if ($qr==1)
										{
											$qt=$q;
											$at=$a;
											$bt=$b;
											$ct=$c;
											$dt=$d;
											$ra=1;
										}
									else if ($qr==2)
										{
											$qt=$q;
											$at=$a;
											$bt=$b;
											$ct=$d;
											$dt=$c;
											$ra=1;
										}
									else if ($qr==3)
										{
											$qt=$q;
											$at=$a;
											$bt=$c;
											$ct=$b;
											$dt=$d;
											$ra=1;
										}
									else if ($qr==4)
										{
											$qt=$q;
											$at=$a;
											$bt=$c;
											$ct=$d;
											$dt=$b;
											$ra=1;
										}
									else if ($qr==5)
										{
											$qt=$q;
											$at=$a;
											$bt=$d;
											$ct=$b;
											$dt=$c;
											$ra=1;
										}
									else if ($qr==6)
										{
											$qt=$q;
											$at=$a;
											$bt=$d;
											$ct=$c;
											$dt=$b;
											$ra=1;
										}
									else if ($qr==7)
										{
											$qt=$q;
											$at=$b;
											$bt=$a;
											$ct=$c;
											$dt=$d;
											$ra=2;
										}
									else if ($qr==8)
										{
											$qt=$q;
											$at=$b;
											$bt=$a;
											$ct=$d;
											$dt=$c;
											$ra=2;
										}
									else if ($qr==9)
										{
											$qt=$q;
											$at=$b;
											$bt=$c;
											$ct=$a;
											$dt=$d;
											$ra=3;
										}
									else if ($qr==10)
										{
											$qt=$q;
											$at=$b;
											$bt=$c;
											$ct=$d;
											$dt=$a;
											$ra=4;
										}
									else if ($qr==11)
										{
											$qt=$q;
											$at=$b;
											$bt=$d;
											$ct=$a;
											$dt=$c;
											$ra=3;
										}
									else if ($qr==12)
										{
											$qt=$q;
											$at=$b;
											$bt=$d;
											$ct=$c;
											$dt=$a;
											$ra=4;
										}
									else if ($qr==13)
										{
											$qt=$q;
											$at=$c;
											$bt=$a;
											$ct=$b;
											$dt=$d;
											$ra=2;
										}
									else if ($qr==14)
										{
											$qt=$q;
											$at=$c;
											$bt=$a;
											$ct=$d;
											$dt=$b;
											$ra=2;
										}
									else if ($qr==15)
										{
											$qt=$q;
											$at=$c;
											$bt=$b;
											$ct=$a;
											$dt=$d;
											$ra=3;
										}
									else if ($qr==16)
										{
											$qt=$q;
											$at=$c;
											$bt=$b;
											$ct=$d;
											$dt=$a;
											$ra=4;
										}
									else if ($qr==17)
										{
											$qt=$q;
											$at=$c;
											$bt=$d;
											$ct=$a;
											$dt=$b;
											$ra=3;
										}
									else if ($qr==18)
										{
											$qt=$q;
											$at=$c;
											$bt=$d;
											$ct=$b;
											$dt=$a;
											$ra=4;
										}
									else if ($qr==19)
										{
											$qt=$q;
											$at=$d;
											$bt=$a;
											$ct=$b;
											$dt=$c;
											$ra=2;
										}
									else if ($qr==20)
										{
											$qt=$q;
											$at=$d;
											$bt=$a;
											$ct=$c;
											$dt=$b;
											$ra=2;
										}
									else if ($qr==21)
										{
											$qt=$q;
											$at=$d;
											$bt=$b;
											$ct=$a;
											$dt=$c;
											$ra=3;
										}
									else if ($qr==22)
										{
											$qt=$q;
											$at=$d;
											$bt=$b;
											$ct=$c;
											$dt=$a;
											$ra=4;
										}
									else if ($qr==23)
										{
											$qt=$q;
											$at=$d;
											$bt=$c;
											$ct=$a;
											$dt=$b;
											$ra=3;
										}
									else
										{
											$qt=$q;
											$at=$d;
											$bt=$c;
											$ct=$b;
											$dt=$a;
											$ra=4;
										}
									print("<div id=\"q".$i."q\" style=\"z-index: 2; width: 1000px;\"><b>".$i.". ".$qt."</b></div><label for=\"q".$i."a\"><div id=\"a".$i."\" style=\"z-index: 2; width: 1000px; background-color: #AA8866; color: #000000;\" onmouseover=\"this.style.backgroundColor='#666633'; this.style.color='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='#AA8866'; this.style.color='#000000';\" onclick=\"document.getElementById('im".$i."a').src='./images/rbon.png'; document.getElementById('im".$i."b').src='./images/rboff.png'; document.getElementById('im".$i."c').src='./images/rboff.png'; document.getElementById('im".$i."d').src='./images/rboff.png'; return true;\"><img src=\"./images/rboff.png\" width=\"18\" height=\"18\" border=\"0\" alt=\"\" id=\"im".$i."a\" align=\"left\" /><input type=\"radio\" name=\"q".$i."\" id=\"q".$i."a\" style=\"display: none;\">&nbsp;&nbsp;A&nbsp;)&nbsp;".$at."</div></label><label for=\"q".$i."b\"><div id=\"b".$i."\" style=\"z-index: 2; width: 1000px; background-color: #AA8866; color: #000000;\" onmouseover=\"this.style.backgroundColor='#666633'; this.style.color='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='#AA8866'; this.style.color='#000000';\" onclick=\"document.getElementById('im".$i."a').src='./images/rboff.png'; document.getElementById('im".$i."b').src='./images/rbon.png'; document.getElementById('im".$i."c').src='./images/rboff.png'; document.getElementById('im".$i."d').src='./images/rboff.png'; return true;\"><img src=\"./images/rboff.png\" width=\"18\" height=\"18\" border=\"0\" alt=\"\" id=\"im".$i."b\" align=\"left\" /><input type=\"radio\" name=\"q".$i."\" id=\"q".$i."b\" style=\"display: none;\">&nbsp;&nbsp;B&nbsp;)&nbsp;".$bt."</div></label><label for=\"q".$i."c\"><div id=\"c".$i."\" style=\"z-index: 2; width: 1000px; background-color: #AA8866; color: #000000;\" onmouseover=\"this.style.backgroundColor='#666633'; this.style.color='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='#AA8866'; this.style.color='#000000';\" onclick=\"document.getElementById('im".$i."a').src='./images/rboff.png'; document.getElementById('im".$i."b').src='./images/rboff.png'; document.getElementById('im".$i."c').src='./images/rbon.png'; document.getElementById('im".$i."d').src='./images/rboff.png'; return true;\"><img src=\"./images/rboff.png\" width=\"18\" height=\"18\" border=\"0\" alt=\"\" id=\"im".$i."c\" align=\"left\" /><input type=\"radio\" name=\"q".$i."\" id=\"q".$i."c\" style=\"display: none;\">&nbsp;&nbsp;C&nbsp;)&nbsp;".$ct."</div></label><label for=\"q".$i."d\"><div id=\"d".$i."\" style=\"z-index: 2; width: 1000px; background-color: #AA8866; color: #000000;\" onmouseover=\"this.style.backgroundColor='#666633'; this.style.color='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='#AA8866'; this.style.color='#000000';\" onclick=\"document.getElementById('im".$i."a').src='./images/rboff.png'; document.getElementById('im".$i."b').src='./images/rboff.png'; document.getElementById('im".$i."c').src='./images/rboff.png'; document.getElementById('im".$i."d').src='./images/rbon.png'; return true;\"><img src=\"./images/rboff.png\" width=\"18\" height=\"18\" border=\"0\" alt=\"\" id=\"im".$i."d\" align=\"left\" /><input type=\"radio\" name=\"q".$i."\" id=\"q".$i."d\" style=\"display: none;\">&nbsp;&nbsp;D&nbsp;)&nbsp;".$dt."</div></label><hr />");
								}
							else
								{
									$qr=rand(1, 24);
									if ($qr==1)
										{
											$qt=$q;
											$at=$a;
											$bt=$b;
											$ct=$c;
											$dt=$d;
											if ($rab==12)
												{
													$ra=12;
												}
											else if ($rab==123)
												{
													$ra=123;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==2)
										{
											$qt=$q;
											$at=$a;
											$bt=$b;
											$ct=$d;
											$dt=$c;
											if ($rab==12)
												{
													$ra=12;
												}
											else if ($rab==123)
												{
													$ra=124;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==3)
										{
											$qt=$q;
											$at=$a;
											$bt=$c;
											$ct=$b;
											$dt=$d;
											if ($rab==12)
												{
													$ra=13;
												}
											else if ($rab==123)
												{
													$ra=123;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==4)
										{
											$qt=$q;
											$at=$a;
											$bt=$c;
											$ct=$d;
											$dt=$b;
											if ($rab==12)
												{
													$ra=14;
												}
											else if ($rab==123)
												{
													$ra=124;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==5)
										{
											$qt=$q;
											$at=$a;
											$bt=$d;
											$ct=$b;
											$dt=$c;
											if ($rab==12)
												{
													$ra=13;
												}
											else if ($rab==123)
												{
													$ra=134;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==6)
										{
											$qt=$q;
											$at=$a;
											$bt=$d;
											$ct=$c;
											$dt=$b;
											if ($rab==12)
												{
													$ra=14;
												}
											else if ($rab==123)
												{
													$ra=134;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==7)
										{
											$qt=$q;
											$at=$b;
											$bt=$a;
											$ct=$c;
											$dt=$d;
											if ($rab==12)
												{
													$ra=12;
												}
											else if ($rab==123)
												{
													$ra=123;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==8)
										{
											$qt=$q;
											$at=$b;
											$bt=$a;
											$ct=$d;
											$dt=$c;
											if ($rab==12)
												{
													$ra=12;
												}
											else if ($rab==123)
												{
													$ra=124;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==9)
										{
											$qt=$q;
											$at=$b;
											$bt=$c;
											$ct=$a;
											$dt=$d;
											if ($rab==12)
												{
													$ra=13;
												}
											else if ($rab==123)
												{
													$ra=123;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==10)
										{
											$qt=$q;
											$at=$b;
											$bt=$c;
											$ct=$d;
											$dt=$a;
											if ($rab==12)
												{
													$ra=14;
												}
											else if ($rab==123)
												{
													$ra=124;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==11)
										{
											$qt=$q;
											$at=$b;
											$bt=$d;
											$ct=$a;
											$dt=$c;
											if ($rab==12)
												{
													$ra=13;
												}
											else if ($rab==123)
												{
													$ra=134;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==12)
										{
											$qt=$q;
											$at=$b;
											$bt=$d;
											$ct=$c;
											$dt=$a;
											if ($rab==12)
												{
													$ra=14;
												}
											else if ($rab==123)
												{
													$ra=134;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==13)
										{
											$qt=$q;
											$at=$c;
											$bt=$a;
											$ct=$b;
											$dt=$d;
											if ($rab==12)
												{
													$ra=23;
												}
											else if ($rab==123)
												{
													$ra=123;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==14)
										{
											$qt=$q;
											$at=$c;
											$bt=$a;
											$ct=$d;
											$dt=$b;
											if ($rab==12)
												{
													$ra=24;
												}
											else if ($rab==123)
												{
													$ra=124;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==15)
										{
											$qt=$q;
											$at=$c;
											$bt=$b;
											$ct=$a;
											$dt=$d;
											if ($rab==12)
												{
													$ra=23;
												}
											else if ($rab==123)
												{
													$ra=123;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==16)
										{
											$qt=$q;
											$at=$c;
											$bt=$b;
											$ct=$d;
											$dt=$a;
											if ($rab==12)
												{
													$ra=24;
												}
											else if ($rab==123)
												{
													$ra=124;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==17)
										{
											$qt=$q;
											$at=$c;
											$bt=$d;
											$ct=$a;
											$dt=$b;
											if ($rab==12)
												{
													$ra=34;
												}
											else if ($rab==123)
												{
													$ra=134;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==18)
										{
											$qt=$q;
											$at=$c;
											$bt=$d;
											$ct=$b;
											$dt=$a;
											if ($rab==12)
												{
													$ra=34;
												}
											else if ($rab==123)
												{
													$ra=134;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==19)
										{
											$qt=$q;
											$at=$d;
											$bt=$a;
											$ct=$b;
											$dt=$c;
											if ($rab==12)
												{
													$ra=23;
												}
											else if ($rab==123)
												{
													$ra=234;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==20)
										{
											$qt=$q;
											$at=$d;
											$bt=$a;
											$ct=$c;
											$dt=$b;
											if ($rab==12)
												{
													$ra=24;
												}
											else if ($rab==123)
												{
													$ra=234;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==21)
										{
											$qt=$q;
											$at=$d;
											$bt=$b;
											$ct=$a;
											$dt=$c;
											if ($rab==12)
												{
													$ra=23;
												}
											else if ($rab==123)
												{
													$ra=234;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==22)
										{
											$qt=$q;
											$at=$d;
											$bt=$b;
											$ct=$c;
											$dt=$a;
											if ($rab==12)
												{
													$ra=24;
												}
											else if ($rab==123)
												{
													$ra=234;
												}
											else
												{
													$ra=1234;
												}
										}
									else if ($qr==23)
										{
											$qt=$q;
											$at=$d;
											$bt=$c;
											$ct=$a;
											$dt=$b;
											if ($rab==12)
												{
													$ra=34;
												}
											else if ($rab==123)
												{
													$ra=234;
												}
											else
												{
													$ra=1234;
												}
										}
									else
										{
											$qt=$q;
											$at=$d;
											$bt=$c;
											$ct=$b;
											$dt=$a;
											if ($rab==12)
												{
													$ra=34;
												}
											else if ($rab==123)
												{
													$ra=234;
												}
											else
												{
													$ra=1234;
												}
										}
									print("<div id=\"q".$i."q\" style=\"z-index: 2; width: 1000px;\"><b>".$i.". ".$qt." <font style=\"color: #990000;\">(посочете всички верни отговори)</font></b></div><label for=\"q".$i."a\"><div id=\"a".$i."\" style=\"z-index: 2; width: 1000px; background-color: #AA8866; color: #000000;\" onmouseover=\"this.style.backgroundColor='#666633'; this.style.color='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='#AA8866'; this.style.color='#000000';\" onclick=\"if (document.getElementById('q".$i."a').checked) { document.getElementById('im".$i."a').src='./images/cbon.png'; } else { document.getElementById('im".$i."a').src='./images/cboff.png'; } return true;\"><img src=\"./images/cboff.png\" width=\"18\" height=\"18\" border=\"0\" alt=\"\" id=\"im".$i."a\" align=\"left\" /><input type=\"checkbox\" name=\"q".$i."\" id=\"q".$i."a\" style=\"display: none;\">&nbsp;&nbsp;A&nbsp;)&nbsp;".$at."</div></label><label for=\"q".$i."b\"><div id=\"b".$i."\" style=\"z-index: 2; width: 1000px; background-color: #AA8866; color: #000000;\" onmouseover=\"this.style.backgroundColor='#666633'; this.style.color='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='#AA8866'; this.style.color='#000000';\"  onclick=\"if (document.getElementById('q".$i."b').checked) { document.getElementById('im".$i."b').src='./images/cbon.png'; } else { document.getElementById('im".$i."b').src='./images/cboff.png'; } return true;\"><img src=\"./images/cboff.png\" width=\"18\" height=\"18\" border=\"0\" alt=\"\" id=\"im".$i."b\" align=\"left\" /><input type=\"checkbox\" name=\"q".$i."\" id=\"q".$i."b\" style=\"display: none;\">&nbsp;&nbsp;B&nbsp;)&nbsp;".$bt."</div></label><label for=\"q".$i."c\"><div id=\"c".$i."\" style=\"z-index: 2; width: 1000px; background-color: #AA8866; color: #000000;\" onmouseover=\"this.style.backgroundColor='#666633'; this.style.color='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='#AA8866'; this.style.color='#000000';\"  onclick=\"if (document.getElementById('q".$i."c').checked) { document.getElementById('im".$i."c').src='./images/cbon.png'; } else { document.getElementById('im".$i."c').src='./images/cboff.png'; } return true;\"><img src=\"./images/cboff.png\" width=\"18\" height=\"18\" border=\"0\" alt=\"\" id=\"im".$i."c\" align=\"left\" /><input type=\"checkbox\" name=\"q".$i."\" id=\"q".$i."c\" style=\"display: none;\">&nbsp;&nbsp;C&nbsp;)&nbsp;".$ct."</div></label><label for=\"q".$i."d\"><div id=\"d".$i."\" style=\"z-index: 2; width: 1000px; background-color: #AA8866; color: #000000;\" onmouseover=\"this.style.backgroundColor='#666633'; this.style.color='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='#AA8866'; this.style.color='#000000';\" onclick=\"if (document.getElementById('q".$i."d').checked) { document.getElementById('im".$i."d').src='./images/cbon.png'; } else { document.getElementById('im".$i."d').src='./images/cboff.png'; } return true;\"><img src=\"./images/cboff.png\" width=\"18\" height=\"18\" border=\"0\" alt=\"\" id=\"im".$i."d\" align=\"left\" /><input type=\"checkbox\" name=\"q".$i."\" id=\"q".$i."d\" style=\"display: none;\">&nbsp;&nbsp;D&nbsp;)&nbsp;".$dt."</div></label><hr />");
								}
							$qro=$qro."q".$ra; // The Right Answers
							$tss=$tss."q".$qr; // Shuffle Answers
							$i++;
						}
				?>
				<br />
				<input type="hidden" name="sp" value="3" />
				<input type="hidden" id="ast" name="ast" value="" />
				<input type="hidden" id="tstid" name="tstid" value="" />
				<input type="button" value="Изпратете теста" name="stb" id="stb" style="position: relative; left: 350px; width: 300px; height: 50px;" onclick="msg('Сигурни ли сте, че сте отговорили<br />на всички въпроси?',1); return true;" />
				<br />
				<br />
				<br />
			</div>
		</div>
		<?php
						}
					else if ($sp==3)
						{
							include("./conn.php");
							mysql_select_db("exams");
							$res=mysql_query("SELECT ra FROM students WHERE i='".$tstid."' LIMIT 1", $db);
							while ($rows=mysql_fetch_row($res))
								{
									$qra="".$rows[0]."";
								}
							$qt=explode("q", $qra);
							$qy=explode("q", $ast);
							$i=1;
							$pnts=0;
							while ($i<=16)
								{
									$j=$qt[$i];
									$k=$qy[$i];
									if ($j==$k)
										{
											$pnts++;
										}
									$i++;
								}
							$res=mysql_query("UPDATE students SET ga='".$ast."', pnts='".$pnts."' WHERE i='".$tstid."' LIMIT 1", $db);
		?>
				<br />
				<br /><center><b>Вашите отговори бяха успешно получени!</b></center>
				<br />
		<?php
			if ($pnts==0)
				{
					print("<br /><center><b>Нямате нито един верен отговор!</b></center>");
					print("<br /><center><b>ОЦЕНКА</b>: <i>Слаб 2</i></center>");
				}
			else if ($pnts==1)
				{
					print("<br /><center><b>Имате само 1 верен отговор от общо 16!</b></center>");
					print("<br /><center><b>ОЦЕНКА</b>: <i>Слаб 2</i></center>");
				}
			else if (($pnts==2) || ($pnts==3))
				{
					print("<br /><center><b>Имате само ".$pnts." верни отговора от общо 16!</b></center>");
					print("<br /><center><b>ОЦЕНКА</b>: <i>Слаб 2</i></center>");
				}
			else if (($pnts==4) || ($pnts==5))
				{
					print("<br /><center><b>Имате само ".$pnts." верни отговора от общо 16!</b></center>");
					print("<br /><center><b>ОЦЕНКА</b>: <i>Среден 3</i></center>");
				}
			else if (($pnts==6) || ($pnts==7) || ($pnts==8) || ($pnts==9))
				{
					print("<br /><center><b>Имате ".$pnts." верни отговора от общо 16!</b></center>");
					print("<br /><center><b>ОЦЕНКА</b>: <i>Добър 4</i></center>");
				}
			else if (($pnts==10) || ($pnts==11) || ($pnts==12) || ($pnts==13))
				{
					print("<br /><center><b>Имате ".$pnts." верни отговора от общо 16!</b></center>");
					print("<br /><center><b>ОЦЕНКА</b>: <i>Много добър 5</i></center>");
				}
			else if (($pnts==14) || ($pnts==15))
				{
					print("<br /><center><b>Имате ".$pnts." верни отговора от общо 16!</b></center>");
					print("<br /><center><b>ОЦЕНКА</b>: <i>Отличен 6</i></center>");
				}
			else
				{
					print("<br /><center><b>Поздравления! Нямате нито една грешка!</b></center>");
					print("<br /><center><b>ОЦЕНКА</b>: <i>Отличен 6</i></center>");
				}
		?>
			</div>
		</div>
		<?php
						}
					else
						{
		?>
				<div style="position: relative; margin: 0 auto; width: 1000px; max-height: 60px; height: 60px; min-height: 60px; background: #AA8866 url('./images/arr.png'); z-index: 5;">
				</div>
				<br /><b>Указания за попълване на теста:</b> <i>Вие ще имате на разположение 20 минути, за да отговорите на 16 въпроса. Можете да следите времето си от часовника по-горе. Когато времето изтече, Вашият тест ще бъде изпратен с всички посочени до момента отговори. Всеки празен отговор се смята за грешен. За да започнете с теста изберете своя клас, след това името си от списъка на класа и предмета, по който ще правите тест. Гледайте внимателно условието. В някои въпроси има повече от един верен отговор и имате текста след самия въпрос &quot;<font style="color: #990000;">посочете всички верни отговори</font>&quot;. В този случай трябва да посочите всички верни отговори. Въпросът се счита за верен от системата, ако наистина сте посочили САМО верните отговори.</i>
				<hr />
				<center>Изберете клас:</center>
				<select name="kl" style="position: relative; left: 350px; width: 300px; height: 30px;" onchange="window.open('./ps.php?kl='+this.value+'','ss'); return true;">
					<option value="ns">-- изберете клас --</option>
					<option value="2013051">5-а клас</option>
					<option value="2013052">5-б клас</option>
					<option value="2013053">5-в клас</option>
					<option value="2013054">5-г клас</option>
					<option value="2013061">6-а клас</option>
					<option value="2013062">6-б клас</option>
					<option value="2013063">6-в клас</option>
					<option value="2013064">6-г клас</option>
					<option value="2013071">7-а клас</option>
					<option value="2013072">7-б клас</option>
					<option value="2013073">7-в клас</option>
					<option value="2013074">7-г клас</option>
					<option value="2013081">8-а клас</option>
					<option value="2013082">8-б клас</option>
					<option value="2013083">8-в клас</option>
					<option value="2013084">8-г клас</option>
					<option value="2013085">8-д клас</option>
					<option value="2013091">9-а клас</option>
					<option value="2013092">9-б клас</option>
					<option value="2013093">9-в клас</option>
					<option value="2013101">10-а клас</option>
					<option value="2013102">10-б клас</option>
					<option value="2013103">10-в клас</option>
					<option value="2013104">10-г клас</option>
					<option value="2013111">11-а клас</option>
					<option value="2013112">11-б клас</option>
					<option value="2013113">11-в клас</option>
					<option value="2013114">11-г клас</option>
					<option value="2013121">12-а клас</option>
					<option value="2013122">12-б клас</option>
					<option value="2013123">12-в клас</option>
				</select>
				<br />
				<hr />
				<center>Изберете Вашето име от списъка:</center>
				<div id="snd">
				<select id="sn" name="sn" style="position: relative; left: 350px; width: 300px; height: 30px;">
					<option value="ns">-- първо изберете клас --</option>
				</select>
				</div>
				<br />
				<hr />
				<center>Изберете по какво ще правите тест:</center>
				<div id="tnd">
				<select name="tn" style="position: relative; left: 350px; width: 300px; height: 30px;">
					<option value="ns" selected>-- изберете по какво ще правите тест --</option>
				</select>
				</div>
				<br />
				<hr />
				<br />
				<input type="hidden" name="sp" value="2" />
				<input type="button" value="Започнете теста" name="stb" id="stb" style="position: relative; left: 350px; width: 300px; height: 50px;" onclick="if (document.getElementById('sn').value=='ns') { alert('Въведете Вашето име и след това натиснете бутона!'); } else if (document.getElementById('tn').value=='ns') { alert('Изберете по какво ще правите тест и след това натиснете бутона!'); } else { document.getElementById('frm').submit(); } return true;" />
				<iframe name="ss" id="ss" src="./pr.html" width="1" height="1" frameborder="0" scrolling="no" style="position: absolute; width: 1px; height: 1px; border: 0px; overflow: hidden; frameborder: 0px; z-index: 3;" allowTransparency="true"></iframe>
				<br />
				<br />
				<br />
			</div>
		</div>
		<script language="JavaScript" type="text/javascript">
			<!--
				document.getElementById("pr").innerHTML="20:00";
			// -->
		</script>
		<?php
						}
			if ($sp==2)
				{
					$res=mysql_query("SELECT un,n1,n2,n3,k,p FROM `students_names` WHERE `un` = ".$sn." LIMIT 1", $db);
					while ($rows=mysql_fetch_row($res))
						{
							$un="".$rows[0]."";
							$n1="".$rows[1]."";
							$n2="".$rows[2]."";
							$n3="".$rows[3]."";
							$kst="".$rows[4]."";
							$pst="".$rows[5]."";
							$nst="".$n1." ".$n2." ".$n3."";
							$nst=str_replace("  ", " ", $nst);
							$nst=str_replace("  ", " ", $nst);
							$nst=str_replace("  ", " ", $nst);
							$nst=str_replace("  ", " ", $nst);
							$nst=str_replace("  ", " ", $nst);
						}
					$stid="";
					$tmst=time();
					$res=mysql_query("INSERT INTO students (ts, tt, sn, qa, ra, ga, gr, pnts) VALUES (\"".$tmst."\", \"".$tn."\", \"".$nst."\", \"".$qqo."\", \"".$qro."\", \"\", \"".$tss."\", \"0\")", $db);
					$res=mysql_query("SELECT i FROM students WHERE sn='".$nst."' AND qa='".$qqo."' order by ts DESC LIMIT 1", $db);
					while ($rows=mysql_fetch_row($res))
						{
							$stid="".$rows[0]."";
						}
		?>
		<script language="JavaScript" type="text/javascript">
			<!--
				set_time=20;
				sttm=set_time*1200;
				clock();
				dms();
				<?php
					print("document.getElementById(\"stf\").innerHTML=\"Тестът попълва: <i>".$nst."</i> от ".$kst."-".$pst." клас\"; ");
					if ($stid=="")
						{
							print("window.open('./error.html','_self'); ");
						}
					else
						{
							print("document.getElementById(\"tstid\").value=\"".$stid."\"; ");
						}
				?>
			// -->
		</script>
		<?php
				}
		?>
		</form>
		</div>
	</body>
</html>