Your IP : 216.73.217.87


Current Path : /hdd/hdd11/www/vlevski/g2s/ans/
Upload File :
Current File : /hdd/hdd11/www/vlevski/g2s/ans/index.php

<?php
	function curl()
	{
		$pu="http";
		if ($_SERVER["HTTPS"]=="on")
		{
			$pu.="s";
		}
		$pu.="://";
		$pu.=$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		$pu=str_replace("https://g2s.vlevski.eu/ans/", "", $pu);
		return $pu;
	}
	$tu=curl();
	$tun=explode("/", $tu);
	$g="".$tun[0]."";
	$d="".$tun[1]."";
	$q="".$tun[2]."";
	if (($g=="") || ($q=="") || ($d==""))
	{
		header("location: /play/");
	}
	if (is_nan($q))
	{
		header("location: /play/");
	}
	include("../conn.php");
	$s="";
	$n="";
	$ssql=mysqli_query($db, "SELECT `sc`, `pn` FROM `players` WHERE `pid`='".$d."' AND `gid`='".$g."' LIMIT 1");
	while ($res=mysqli_fetch_row($ssql))
	{
		$s=$res[0];
		$n=$res[1];
	}
	if (($s=="") || ($n==""))
	{
		header("location: /play/");
	}
	header("Cache-Control: no-cache, must-revalidate");
	header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
	$useragent=$_SERVER['HTTP_USER_AGENT'];
	function isMobile()
	{
		return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
	}
	if (isMobile())
	{
		$mbl=1;
	}
	else
	{
		$mbl=0;
	}
	$matrix=4;
	if ($matrix==3)
	{
		$qa=array("1", "2", "3");
	}
	else if ($matrix==4)
	{
		$qa=array("1", "2", "3", "4");
	}
	else
	{
		$qa=array("1", "2");
	}
	include("../l.php");
	//shuffle($qa);
?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
		<title>
			Game 2 STEM
		</title>
		<link rel="shortcut icon" type="image/png" href="/assets/images/site/g2s-logo.png" />
		<link rel="stylesheet" href="/assets/css/select2.min.css" />
		<link rel="stylesheet" href="/assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="/assets/css/datepicker.css" />
		<script src="/assets/js/jquery.min.js"></script>
		<script src="/assets/js/form.min.js"></script>
		<script src="/assets/js/select.min.js"></script>
		<script src="/assets/js/popper.min.js"></script>
		<script src="/assets/js/bootstrap.min.js"></script>
		<script src="/assets/js/bootstrap-datepicker.js"></script>
		<script src="/assets/js/jquery.dataTables.min.js"></script>
		<script src="/assets/js/dataTables.bootstrap4.min.js"></script>
		<script src="/assets/fa6/js/all.min.js" defer></script>
		<style>
			@font-face
			{
				font-family: "CalibriVL";
				src: url("/assets/fonts/calibri.woff") format("woff");
				font-weight: normal;
				font-style: normal;
			}
			html, body
			{
				background-color: #112233;
				margin: 0;
				overflow: hidden;
			}
			div, table, tr, td, label, button
			{
				font-family: CalibriVL, Calibri;
				margin: 0;
			}
		</style>
		<script>
			var anst=0;
			var tl;
			var ra;
			var it;
			var wt;
			var gn;
			var gans;
			var qn=<?php print("".$q.""); ?>;
			var n;
			var s=<?php print("".$s.""); ?>;
			var d;
			var tms;
			var tmm;
			var dif;
			var tme;
			function ext()
			{
				Website2APK.exitApp();
			}
			function strt()
			{
				tms=Date.now();
				tmm=tl*10;
			}
			function stp()
			{
				tme=Date.now();
				dif=tme-tms;
				dif=Math.round(dif/100);
				dif=tmm-dif;
				if (dif<0)
				{
					dif=0;
				}
				s+=dif;
			}
			function sha1(m)
			{
				function rotate_left(n,s){var t4=(n<<s)|(n>>>(32-s));return t4;};function lsb_hex(val){var str='';var i;var vh;var vl;for(i=0;i<=6;i+=2){vh=(val>>>(i*4+4))&0x0f;vl=(val>>>(i*4))&0x0f;str+=vh.toString(16)+vl.toString(16);} return str;};function cvt_hex(val){var str='';var i;var v;for(i=7;i>=0;i--){v=(val>>>(i*4))&0x0f;str+=v.toString(16);} return str;};function Utf8Encode(string){string=string.replace(/\r\n/g,'\n');var utftext='';for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);} else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);} else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}} return utftext;};var blockstart;var i,j;var W=new Array(80);var H0=0x67452301;var H1=0xEFCDAB89;var H2=0x98BADCFE;var H3=0x10325476;var H4=0xC3D2E1F0;var A,B,C,D,E;var temp;m=Utf8Encode(m);var m_len=m.length;var word_array=new Array();for(i=0;i<m_len-3;i+=4){j=m.charCodeAt(i)<<24|m.charCodeAt(i+1)<<16|m.charCodeAt(i+2)<<8|m.charCodeAt(i+3);word_array.push(j);} switch(m_len % 4){case 0:i=0x080000000;break;case 1:i=m.charCodeAt(m_len-1)<<24|0x0800000;break;case 2:i=m.charCodeAt(m_len-2)<<24|m.charCodeAt(m_len-1)<<16|0x08000;break;case 3:i=m.charCodeAt(m_len-3)<<24|m.charCodeAt(m_len-2)<<16|m.charCodeAt(m_len-1)<<8|0x80;break;} word_array.push(i);while((word_array.length % 16)!=14)word_array.push(0);word_array.push(m_len>>>29);word_array.push((m_len<<3)&0x0ffffffff);for(blockstart=0;blockstart<word_array.length;blockstart+=16){for(i=0;i<16;i++)W[i]=word_array[blockstart+i];for(i=16;i<=79;i++)W[i]=rotate_left(W[i-3]^W[i-8]^W[i-14]^W[i-16],1);A=H0;B=H1;C=H2;D=H3;E=H4;for(i=0;i<=19;i++){temp=(rotate_left(A,5)+((B&C)|(~B&D))+E+W[i]+0x5A827999)&0x0ffffffff;E=D;D=C;C=rotate_left(B,30);B=A;A=temp;} for(i=20;i<=39;i++){temp=(rotate_left(A,5)+(B^C^D)+E+W[i]+0x6ED9EBA1)&0x0ffffffff;E=D;D=C;C=rotate_left(B,30);B=A;A=temp;} for(i=40;i<=59;i++){temp=(rotate_left(A,5)+((B&C)|(B&D)|(C&D))+E+W[i]+0x8F1BBCDC)&0x0ffffffff;E=D;D=C;C=rotate_left(B,30);B=A;A=temp;} for(i=60;i<=79;i++){temp=(rotate_left(A,5)+(B^C^D)+E+W[i]+0xCA62C1D6)&0x0ffffffff;E=D;D=C;C=rotate_left(B,30);B=A;A=temp;} H0=(H0+A)&0x0ffffffff;H1=(H1+B)&0x0ffffffff;H2=(H2+C)&0x0ffffffff;H3=(H3+D)&0x0ffffffff;H4=(H4+E)&0x0ffffffff;} var temp=cvt_hex(H0)+cvt_hex(H1)+cvt_hex(H2)+cvt_hex(H3)+cvt_hex(H4);return temp.toLowerCase();
			}
			d="<?php print("".$d.""); ?>";
			function dq()
			{
				$("#aw").css("opacity", "0");
				$("#cnt").css("opacity", "1");
				$("#game").css("opacity", "1");
				$("#game").css("pointer-events", "auto");
				$("#l1").prop("disabled", false);
				$("#l2").prop("disabled", false);
				$("#l3").prop("disabled", false);
				$("#l4").prop("disabled", false);
				$("#l1").css("pointer-events", "auto");
				$("#l2").css("pointer-events", "auto");
				$("#l3").css("pointer-events", "auto");
				$("#l4").css("pointer-events", "auto");
				cdt();
			}
			function rgs()
			{
				n="<?php print("".$n.""); ?>";
				gn="<?php print("".$g.""); ?>";
				$("#pn").html("<i class=\"fas fa-user\"></i> "+n+"");
				$("#aw").css("opacity", "1");
				$("#qnt").html(""+qn+"");
				wt=setInterval(function()
				{
					$.ajax({url: "/aq.php", type: "POST", data:{"qn": ""+qn+"", "gn": ""+gn+""}, success: function(data) { if (data=="OK") { clearInterval(wt); stpq(); dq(); } else { } } });
				}, 1000);
			}
			function stpq()
			{
				<?php
					if ($g!="")
					{
						$i=0;
						$splt=0;
						include("../conn.php");
						$qsql=mysqli_query($db, "SELECT * FROM `games` WHERE `gid`='".$g."' AND `a`='1' LIMIT 1");
						while ($res=mysqli_fetch_row($qsql))
						{
							$qrd=explode("^|^", $res[2]);
							$qmax=$res[4];
							$qmaxc=$qmax*8;
							while ($splt<$qmaxc)
							{
								$i++;
								$splt+=6;
								$pl=$qrd[$splt];
								$splt++;
								$tt=$qrd[$splt];
								$splt++;
								print("if (qn==".$i.")");
								print(" { ");
								print("tl=".$tt."; ");
								print("$(\"#dtime\").html(\"\"+tl+\"\"); ");
								print("ra=".$pl.";");
								print(" } ");
							}
							print(" mqn=".$qmax."; ");
						}
					}
				?>
			}
			function ans(id, clr, icn)
			{
				anst=1;
				$("#ws").css("display", "block");
				$("#ws").css("opacity", "0.95");
				$("#game").css("pointer-events", "none");
				$("#l1").prop("disabled", true);
				$("#l2").prop("disabled", true);
				$("#l3").prop("disabled", true);
				$("#l4").prop("disabled", true);
				$("#l1").css("pointer-events", "none");
				$("#l2").css("pointer-events", "none");
				$("#l3").css("pointer-events", "none");
				$("#l4").css("pointer-events", "none");
				$("#ga").css("background-color", ""+clr+"");
				$("#ga").html("<i class=\"fas "+icn+"\" style=\"transform: rotate(-45deg); font-size: 195px; padding-top: 35px; padding-bottom: 35px; line-height: 190px; color: #DDDDDD;\"></i>");
				id=parseInt(id);
				if (ra==id)
				{
					stp();
					gans="r";
				}
				else
				{
					gans="w";
				}
				$.ajax({url: "/ua.php", type: "POST", data:{"qn": ""+qn+"", "s": ""+s+"", "d": ""+d+""}, success: function(data) { if (data!="ERR") { } else { } } });
			}
			function edt()
			{
				$("#game").css("pointer-events", "none");
				$("#l1").prop("disabled", true);
				$("#l2").prop("disabled", true);
				$("#l3").prop("disabled", true);
				$("#l4").prop("disabled", true);
				$("#l1").css("pointer-events", "none");
				$("#l2").css("pointer-events", "none");
				$("#l3").css("pointer-events", "none");
				$("#l4").css("pointer-events", "none");
				$("#dtime").css("opacity", "1");
				$("#dtime").html("-");
				clearInterval(it);
				qn++;
				$("#ws").css("opacity", "0");
				$("#game").css("opacity", "0");
				if (anst==0)
				{
					$("#wans").css("opacity", "1");
				}
				else
				{
					if (gans=="r")
					{
						$("#rans").css("opacity", "1");
					}
					else
					{
						$("#wans").css("opacity", "1");
					}
				}
				setTimeout(function()
				{
					$("#rans").css("opacity", "0");
					$("#wans").css("opacity", "0");
					$("#cnt").css("opacity", "0");
					if (qn>mqn)
					{
						$("#gansa").css("opacity", "1");
					}
					else
					{
						window.open("/ans/<?php print("".$g.""); ?>/<?php print("".$d.""); ?>/<?php $q++; print("".$q.""); ?>", "_self");
					}
				}, 5000);
			}
			function cdt()
			{
				anst=0;
				dif=0;
				strt();
				it=setInterval(function()
				{
					$.ajax({url: "/pa.php", type: "POST", data:{"qn": ""+qn+"", "gn": ""+gn+""}, success: function(data) { if (data=="OK") { edt(); } else { } } });
					tl--;
					if (tl<0)
					{
						$("#dtime").html("0");
					}
					else
					{
						$("#dtime").html(""+tl+"");
					}
					if (tl%2==0)
					{
						$("#dtime").css("color", "#DDDD00");
					}
					else
					{
						$("#dtime").css("color", "#DDDDDD");
					}
					$("#dtime").css("opacity", "1");
					if ((tl<=5) && (tl>=0))
					{
						$("#dtime").animate({opacity:'0'},900);
					}
					if (tl<0)
					{
						edt();
					}
				}, 1000);
			}
			$(document).ready(function()
			{
				$("#dtime").html(""+tl+"");
				rgs();
			});
			function seoc(ce)
			{
				var r;
				var s;
				if(document.createRange)
				{
					r=document.createRange();
					r.selectNodeContents(ce);
					r.collapse(false);
					s=window.getSelection();
					s.removeAllRanges();
					s.addRange(r);
				}
			}
			function onlynum()
			{
				var id=$("#gameid").text();
				if (id.length>=7)
				{
					$("#gameid").text(id.substr(0, 6));
					var el=document.getElementById("gameid");
					seoc(el);
				}
				else
				{
					var chk=id.replaceAll("0", "");
					chk=chk.replaceAll("1", "");
					chk=chk.replaceAll("2", "");
					chk=chk.replaceAll("3", "");
					chk=chk.replaceAll("4", "");
					chk=chk.replaceAll("5", "");
					chk=chk.replaceAll("6", "");
					chk=chk.replaceAll("7", "");
					chk=chk.replaceAll("8", "");
					chk=chk.replaceAll("9", "");
					if (chk!="")
					{
						$("#gameid").text(id.substr(0, id.length-1));
						var el=document.getElementById("gameid");
						seoc(el);
					}
				}
			}
			function namerestrict()
			{
				var id=$("#playerid").text();
				if (id.length>=22)
				{
					$("#playerid").text(id.substr(0, 22));
					var el=document.getElementById("playerid");
					seoc(el);
				}

			}
		</script>
	</head>
	<body>
		<script>
		if (typeof(Website2APK)!="undefined")
		{
			document.write("<div style=\"position: fixed; top: 0px; right: 0px; width: 40px; height: 45px; z-index: 9999;\">");
			document.write("<button type=\"button\" style=\"position: relative; top: 0px; left: 0px; width: 40px; height: 45px; margin: 0px; padding: 0px; line-height: 35px; border-radius: 5px; font-size: 35px; background-color: #EE1133; color: #DDDDDD;\" onclick=\"ext(); return true;\">");
			document.write("&times;");
			document.write("</button>");
			document.write("</div>");
		}
		</script>
		<div id="aw" class="container-fluid" style="position: fixed; top: 0px; left: 0px; width: 100%; height: 100vh; max-height: 100vh; font-size: 0.5vh; overflow: hidden; pointer-events: none; opacity: 0; z-index: 2002;">
			<div class="row">
				<div class="col-12" style="padding-top: 80px; font-size: 30px; color: #DDDDDD; text-align: center;">
					<i class="fas fa-circle-notch fa-spin" style="font-size: 150px;"></i>
					<br /><?php print("".$l["waitq"].""); ?> <span id="qnt"></span>
					<br /><img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>
		<div id="game" class="container-fluid" style="position: fixed; top: 0px; left: 0px; width: 100%; height: 100vh; max-height: 100vh; font-size: 0.5vh; overflow: hidden; pointer-events: none; opacity: 0; z-index: 2003;">
			<div class="row">
				<div id="pn" class="col-12" style="text-align: center; font-size: 30px; max-height: 260px; overflow: hidden; margin-bottom: 40px; color: #DDDDDD;">
				</div>
			</div>
			<div class="row">
			<?php
				for ($i=1; $i<=$matrix; $i++)
				{
					if ($i==1)
					{
						$icn="fa-pause-circle";
						$clr="#EE1133";
					}
					else if ($i==2)
					{
						$icn="fa-stop-circle";
						$clr="#3366BB";
					}
					else if ($i==3)
					{
						$icn="fa-dot-circle";
						$clr="#AA7700";
					}
					else
					{
						$icn="fa-play-circle";
						$clr="#339944";
					}
					print("<div class=\"col-6\" style=\"margin-bottom: 2vh; text-align: center;\">");
					print("<button id=\"l".$qa[$i-1]."\" onclick=\"ans('".$qa[$i-1]."', '".$clr."', '".$icn."');\" class=\"btn btn-info btn-lg\" style=\"position: relative; text-align: center; width: 90%; height: 100%; max-height: 100%; color: #DDDDDD; background-color: ".$clr.";\">");
					print("<i id=\"i".$qa[$i-1]."\" class=\"fas ".$icn."\" style=\"transform: rotate(-45deg); font-size: 95px; padding-top: 10px; padding-bottom: 10px; line-height: 95px; color: #DDDDDD;\"></i>");
					print("</button></div>");
				}
			?>
			</div>
			<div class="row">
				<div class="col-12" style="text-align: center;">
					<img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>
		<div id="rans" class="container-fluid" style="position: fixed; background-color: #000000; top: 0px; left: 0px; width: 100%; height: 100%; max-height: 100%; line-height: 80px; font-size: 80px; overflow: hidden; z-index: 1000; pointer-events: none; opacity: 0; z-index: 2004;">
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 30px; overflow: hidden; padding-top: 10px; color: #DDDDDD;">
					<span id="rya"><?php print("".$l["rightans"].""); ?></span>
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="padding-top: 0px; text-align: center;">
					<button id="rga" class="btn btn-info btn-lg" style="position: relative; text-align: center; padding-top: 20px; padding-bottom: 20px; width: 90%; color: #DDDDDD; background-color: #339944;"><i class="fas fa-check-circle" style="font-size: 195px; padding-top: 35px; padding-bottom: 35px; line-height: 190px; color: #DDDDDD;"></i></button>
					<br /><img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>
		<div id="wans" class="container-fluid" style="position: fixed; background-color: #000000; top: 0px; left: 0px; width: 100%; height: 100%; max-height: 100%; line-height: 80px; font-size: 80px; overflow: hidden; z-index: 1000; pointer-events: none; opacity: 0; z-index: 2004;">
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 30px; overflow: hidden; padding-top: 10px; color: #DDDDDD;">
					<span id="wya"><?php print("".$l["wrongans"].""); ?></span>
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="padding-top: 0px; text-align: center;">
					<button id="wga" class="btn btn-info btn-lg" style="position: relative; text-align: center; padding-top: 20px; padding-bottom: 20px; width: 90%; color: #DDDDDD; background-color: #EE1133;"><i class="fas fa-times-circle" style="font-size: 195px; padding-top: 35px; padding-bottom: 35px; line-height: 190px; color: #DDDDDD;"></i></button>
					<br /><img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>
		<div id="gansa" class="container-fluid" style="position: fixed; background-color: #000000; top: 0px; left: 0px; width: 100%; height: 100%; max-height: 100%; line-height: 80px; font-size: 80px; overflow: hidden; z-index: 1000; pointer-events: none; opacity: 0; z-index: 2004;">
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 30px; overflow: hidden; padding-top: 10px; color: #DDDDDD;">
					<span id="gya"><?php print("".$l["thanks"].""); ?></span>
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="padding-top: 0px; text-align: center;">
					<br /><img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>
		<div id="ws" class="container-fluid" style="position: fixed; background-color: #000000; top: 0px; left: 0px; width: 100%; height: 100%; max-height: 100%; line-height: 80px; font-size: 80px; overflow: hidden; z-index: 1000; pointer-events: none; opacity: 0; z-index: 2004;">
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 30px; overflow: hidden; padding-top: 10px; color: #DDDDDD;">
					<span id="ya"><?php print("".$l["yourans"].""); ?></span>
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="padding-top: 0px; text-align: center;">
					<button id="ga" class="btn btn-info btn-lg" style="position: relative; text-align: center; padding-top: 20px; padding-bottom: 20px; width: 90%; color: #DDDDDD;"></button>
					<br /><img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>
		<div id="cnt" class="container-fluid" style="position: fixed; bottom: 0px; left: 0px; width: 100%; height: 85px; max-height: 85px; line-height: 80px; font-size: 80px; overflow: hidden; z-index: 2005; pointer-events: none; opacity: 0;">
			<div class="row">
				<div class="col-6" style="padding-top: 0px; text-align: left;">
					<i class="fa fa-clock" style="font-size: 55px; color: #DDDDDD;"></i>
				</div>
				<div class="col-6" style="text-align: right;">
					<div id="dtime" style="font-size: 60px; padding-top: 5px; font-style: italic; color: #DDDDDD;"></div>
				</div>
			</div>
		</div>
	</body>
</html>