Your IP : 216.73.216.48


Current Path : /srv/www/vlevski/g2s/play/
Upload File :
Current File : //srv/www/vlevski/g2s/play/index.php

<?php
	session_start();
	date_default_timezone_set("Europe/Sofia");
	if (isset($_COOKIE["d"]))
	{
		$d=$_COOKIE["d"];
	}
	else
	{
		$shc="".time()."_sha_".rand(1000,9999)."";
		$d=sha1($shc);
		setcookie("d", "".$d."", time() + 3600, "/", "", true, false);
	}
	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;
	}
	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/play/", "", $pu);
		return $pu;
	}
	$tu=curl();
	if (isset($_GET["lng"]))
	{
		$lng=$_GET["lng"];
		if ($lng=="bg" || $lng=="es" || $lng=="pl" || $lng=="rs" || $lng=="tr")
		{
		}
		else
		{
			$lng="uk";
		}
		$_SESSION["lng"]=$lng;
		$rld=explode("?", $tu);
		header("location: https://g2s.vlevski.eu/play/".$rld[0]."");
	}
	$gn=str_replace("game/", "", $tu);
	$gn=str_replace(".", "", $gn);
	$gn=str_replace(",", "", $gn);
	$gn=str_replace("#", "", $gn);
	if (strlen($gn)!=6)
	{
		$gn="";
	}
	else
	{
		if (!is_numeric($gn))
		{
			$gn="";
		}
	}
	$gnd="ng";
	if ($gn!="")
	{
		include("../conn.php");
		$gsql=mysqli_query($db, "SELECT * FROM `games` WHERE `gid`='".$gn."' AND `a`='1' LIMIT 1");
		while ($res=mysqli_fetch_row($gsql))
		{
			$gnd=$res[1];
		}
		if ($gnd=="ng")
		{
			$gn="9999999";
		}
	}
	$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=1;
			var n;
			var s=0;
			var d;
			var tms;
			var tmm;
			var dif;
			var tme;
			function ext()
			{
				Website2APK.exitApp();
			}
			d="<?php print("".$d.""); ?>";
			function rgs()
			{
				n=$("#playerid").text();
				nchek=n.trim();
				if (nchek.length>=1)
				{
					gn="<?php print("".$gn.""); ?>";
					$.ajax({url: "/ru.php", type: "POST", data:{"gn": ""+gn+"", "n": ""+n+"", "d": ""+d+""}, success: function(data) { if (data!="ERR") { window.open("/ans/"+gn+"/"+d+"/1", "_self"); } else { } } });
				}
				else
				{
					$("#m").modal("show");
				}
			}
			function gs()
			{
				var l=$("#gameid").text().length;
				if (l<6)
				{
					$("#m").modal("show");
				}
				else
				{
					var pl="/play/game/"+$("#gameid").text()+"";
					window.open(""+pl+"", "_self");
				}
			}
			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>
		<?php
			if ($gn=="")
			{
		?>
		<div style="position: fixed; top: 100px;" class="modal fade" id="m" data-keyboard="false" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="m" aria-hidden="true">
			<div class="modal-dialog modal-lg" style="width: 95%;">	
				<div class="modal-dialog modal-lg" style="width: 95%;">
					<div class="modal-content" style="background-image: linear-gradient(to right, rgba(255,255,17,0.85), rgba(255,255,17,1))!important;">
						<div class="modal-header">
							<h5 class="modal-title" style="font-weight: bold; color: #112233; font-size: 30px;" id="mt">
								<i class="fas fa-info-circle"></i> <?php print("".$l["short"].""); ?>
							</h5>
							<button type="button" style="font-size: 45px;" class="close" data-dismiss="modal" aria-label="Затвори">
								<span aria-hidden="true" style="color: #112233;">&times;</span>
							</button>
						</div>
						<div id="mb" class="modal-body">
							<?php print("".$l["shortdes"].""); ?>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="container-fluid" style="position: relative; width: 100%; height: 100vh; max-height: 100vh; font-size: 0.5vh; overflow: hidden;">
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 30px; overflow: hidden; margin-bottom: 20px; color: #DDDDDD;">
					<?php print("".$l["ent6"].""); ?>
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="text-align: center;">
					<div id="gameid" name="gameid" style="background-color: #DDDDDD; border-radius: 10px; color: #112233; font-size: 40px; font-weight: bold; height: 80px; line-height: 40px; margin: 0px; padding-top: 15px; overflow: hidden;" contenteditable="true" onkeyup="onlynum(); return true;"></div>
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 80px; overflow: hidden; margin: 0px; color: #DDDDDD;">
					<button type="button" id="bw" onclick="gs(); return true;" class="btn btn-info btn-lg" style="position: relative; text-align: center; width: 100%; height: 95px; max-height: 95px; font-size: 45px; opacity: 1;">
						<div class="container-fluid">
							<div class="row">
								<div class="col-2">
									<i class="fas fa-sign-in-alt"></i>
								</div>
								<div class="col-10">
									<?php print("".$l["enter"].""); ?>
								</div>
							</div>
						</div>
					</button>
					<div style="font-size: 30px;"><?php print("".$l["switchto"].""); ?><br />
					<a title="<?php print("".$l["lbg"].""); ?>" href="?lng=bg"><img alt="<?php print("".$l["lbg"].""); ?>" src="/images/f/bg.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["les"].""); ?>" href="?lng=es"><img alt="<?php print("".$l["les"].""); ?>" src="/images/f/es.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["lpl"].""); ?>" href="?lng=pl"><img alt="<?php print("".$l["lpl"].""); ?>" src="/images/f/pl.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["lrs"].""); ?>" href="?lng=rs"><img alt="<?php print("".$l["lrs"].""); ?>" src="/images/f/rs.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["ltr"].""); ?>" href="?lng=tr"><img alt="<?php print("".$l["ltr"].""); ?>" src="/images/f/tr.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["luk"].""); ?>" href="?lng=uk"><img alt="<?php print("".$l["luk"].""); ?>" src="/images/f/uk.png" style="width: 40px; height: 20px; border: none;" /></a>
					</div>
					<img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>
		<?php
			}
			else if (($gn!=$gnd) || ($gn=="100001"))
			{
		?>
		<div class="container-fluid" style="position: relative; width: 100%; height: 100vh; max-height: 100vh; font-size: 0.5vh; overflow: hidden;">
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 30px; overflow: hidden; margin-bottom: 20px; color: #DDDDDD;">
					<?php print("".$l["nogame"].""); ?>
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 80px; overflow: hidden; margin: 0px; color: #DDDDDD;">
					<button type="button" id="bw" onclick="window.open('/play/', '_self'); return true;" class="btn btn-danger btn-lg" style="position: relative; text-align: center; width: 100%; height: 95px; max-height: 95px; font-size: 45px; opacity: 1;">
						<div class="container-fluid">
							<div class="row">
								<div class="col-2">
									<i class="fas fa-refresh"></i>
								</div>
								<div class="col-10">
									<?php print("".$l["try"].""); ?>
								</div>
							</div>
						</div>
					</button>
					<br /><img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>		
		<?php
			}
			else
			{
		?>
		<div style="position: fixed; top: 100px; z-index: 9999;" class="modal fade" id="m" data-keyboard="false" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="m" aria-hidden="true">
			<div class="modal-dialog modal-lg" style="width: 95%;">	
				<div class="modal-dialog modal-lg" style="width: 95%;">
					<div class="modal-content" style="background-image: linear-gradient(to right, rgba(255,255,17,0.85), rgba(255,255,17,1))!important;">
						<div class="modal-header">
							<h5 class="modal-title" style="font-weight: bold; color: #112233; font-size: 30px;" id="mt">
								<i class="fas fa-info-circle"></i> <?php print("".$l["noname"].""); ?>
							</h5>
							<button type="button" style="font-size: 45px;" class="close" data-dismiss="modal" aria-label="Затвори">
								<span aria-hidden="true" style="color: #112233;">&times;</span>
							</button>
						</div>
						<div id="mb" class="modal-body">
							<?php print("".$l["nonamedes"].""); ?>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div id="user" class="container-fluid" style="position: fixed; top: 0px; left: 0px; width: 100%; height: 100vh; max-height: 100vh; font-size: 0.5vh; overflow: hidden; z-index: 2001;">
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 30px; overflow: hidden; margin-bottom: 20px; color: #DDDDDD;">
					<?php print("".$l["enterpn"].""); ?><br />&nbsp;
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="text-align: center;">
					<div id="playerid" name="playerid" style="background-color: #DDDDDD; border-radius: 10px; color: #112233; font-size: 40px; font-weight: bold; height: 80px; line-height: 40px; margin: 0px; padding-top: 15px; overflow: hidden;" contenteditable="true" onkeyup="namerestrict(); return true;"></div>
				</div>
			</div>
			<div class="row">
				<div class="col-12" style="text-align: center; font-size: 80px; overflow: hidden; margin: 0px; color: #DDDDDD;">
					<button type="button" id="bw" onclick="rgs(); return true;" class="btn btn-info btn-lg" style="position: relative; text-align: center; width: 100%; height: 95px; max-height: 95px; font-size: 45px; opacity: 1;">
						<div class="container-fluid">
							<div class="row">
								<div class="col-2">
									<i class="fas fa-user-plus"></i>
								</div>
								<div class="col-10">
									<?php print("".$l["join"].""); ?>
								</div>
							</div>
						</div>
					</button>
					<div style="font-size: 30px;"><?php print("".$l["switchto"].""); ?><br />
					<a title="<?php print("".$l["lbg"].""); ?>" href="?lng=bg"><img alt="<?php print("".$l["lbg"].""); ?>" src="/images/f/bg.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["les"].""); ?>" href="?lng=es"><img alt="<?php print("".$l["les"].""); ?>" src="/images/f/es.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["lpl"].""); ?>" href="?lng=pl"><img alt="<?php print("".$l["lpl"].""); ?>" src="/images/f/pl.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["lrs"].""); ?>" href="?lng=rs"><img alt="<?php print("".$l["lrs"].""); ?>" src="/images/f/rs.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["ltr"].""); ?>" href="?lng=tr"><img alt="<?php print("".$l["ltr"].""); ?>" src="/images/f/tr.png" style="width: 40px; height: 20px; border: none;" /></a>&nbsp;
					<a title="<?php print("".$l["luk"].""); ?>" href="?lng=uk"><img alt="<?php print("".$l["luk"].""); ?>" src="/images/f/uk.png" style="width: 40px; height: 20px; border: none;" /></a>
					</div>
					<img src="/assets/images/site/g2s-logo.png" style="width: 240px; border: none;" />
				</div>
			</div>
		</div>
		<?php
			}
		?>
	</body>
</html>