Your IP : 216.73.216.48


Current Path : /var/www/vlevski/enter/doctor/
Upload File :
Current File : //var/www/vlevski/enter/doctor/index.php

<?php
	header("Cache-Control: no-cache, must-revalidate");
	header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
			<title>
				Пропускателен режим СУ &quot;Васил Левски&quot; - Троян
			</title>
			<link rel="stylesheet" href="./jquery-ui.css">
			<script src="./jquery-3.1.1.min.js"></script>
			<script src="./jquery-ui.js"></script>
			<script>
				$(function()
					{
						$("#dt").datepicker();
						$("#dt").datepicker("option", "showAnim", "drop");
					});
				function shw(t)
					{
						d=document.getElementById("dt").value;
						window.open("./?t="+t+"&d="+d+"", "_self");
					}
			</script>
	</head>
	<body style="font-family: Verdana;">
		<center>
			<?php
				if (isset($_GET["t"]))
					{
						include("./conn.php");
						$i=1;
						$k=1;
						$t=$_GET["t"];
						if (!isset($_GET["d"]))
							{
								$d=date("d.m.Y");
							}
						else
							{
								$d=$_GET["d"];
							}
						$ds=explode(".",$d);
						$day=$ds[0];
						$month=$ds[1];
						$year=$ds[2];
						if ($year=="")
							{
								$day=date("d");
								$month=date("m");
								$year=date("Y");
							}
						$first=mktime(0, 0, 1, $month, $day, $year);
						$last=mktime(23, 59, 59, $month, $day, $year);
						if ($t=="s")
							{
								print("<b>С П Р А В К А</b><br />за регистрираните ученици на ".$day.".".$month.".".$year." г.<br /><br />");
								print("<div style=\"width: 800px; height: 150px; text-align: center;\" id=\"nfost\"></div>");
								$cardsint=mysqli_query($db, "SELECT * FROM `students`");
								$numst=874;
								$regst=0;
								while ($singlecardint=mysqli_fetch_row($cardsint))
									{
										$pprint="без регистрация";
										$hch=99;
										$cards=mysqli_query($db, "SELECT * FROM `visits` WHERE `c`='".$singlecardint[1]."' AND `t`>".$first." AND `t`<".$last." ORDER BY `t` ASC LIMIT 1");
										while ($singlecard=mysqli_fetch_row($cards))
											{
												$ts=$singlecard[2];
												$pprint="dif";
											}
										if ($pprint!="без регистрация")
											{
												$regst++;
											}
										$i++;
									}
								$uregst=$numst-$regst;
								$percent=round((($uregst/$numst)*100), 2);
								print("<script> document.getElementById(\"nfost\").innerHTML=\"Брой ученици: <b>".$numst."</b>, в т. ч. регистрирани: <b>".$regst."</b> и нерегистрирани: <b>".$uregst."</b><br /><br /><font style='font-size: 30px;'>Процент на отсъстващите: ".$percent."%</font>\"; </script>");
							}
						else
							{
								print("Нещо се обърка!");
							}
						print("<br /><br /><br /><input style=\"width: 800px; height: 50px; font-family: Verdana; font-size: 25px;\" type=\"button\" value=\"Нова справка\" onclick=\"window.open('./','_self');\" />");
					}
				else
					{
			?>
				<br />Пропускателен режим СУ &quot;Васил Левски&quot; - Троян
				<br />
				<br />За коя дата искате справка?
				<br /><input id="dt" style="width: 400px; text-align: center; height: 50px; font-family: Verdana; font-size: 25px; margin-right: 20px;" type="text" value="<?php print(date("d.m.Y")); ?>" />
				<br />
				<br /><input style="width: 800px; height: 50px; font-family: Verdana; font-size: 25px;" type="button" value="Информация за ученици" onclick="shw('s');" />
			<?php
					}
			?>
		</center>
	</body>
</html>