Your IP : 216.73.216.48


Current Path : /hdd/hdd11/www/vlevski/enter/sold/
Upload File :
Current File : /hdd/hdd11/www/vlevski/enter/sold/indexold.php

<?php
	session_start();
	header("Cache-Control: no-cache, must-revalidate");
	header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
	date_default_timezone_set("Europe/Sofia");
	$code="";
	if (isset($_GET["logout"]))
	{
		$oldtime=time()-(60*60*24*7);
		setcookie("code", "", $oldtime, "/");
		unset($_COOKIE["code"]);
	}
	if (isset($_POST["code"]))
	{
		$code=$_POST["code"];
	}
	if (isset($_COOKIE["code"]))
	{
		$code=$_COOKIE["code"];
	}
?><!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 shw(t)
					{
						d=document.getElementById("dt").value;
						l=document.getElementById("lt").value;
						window.open("./?t="+t+"&d="+d+"&l="+l+"", "_self");
					}
				<?php
					if (!isset($_GET["t"]))
						{
				?>
				$(function()
					{
						$("#dt").datepicker();
						$("#dt").datepicker("option", "showAnim", "drop");
					});
				<?php
						}
					else
						{
							$t=$_GET["t"];
							if ($t=="s")
								{
				?>
			</script>
			<script src="./jquery.tablesorter.min.js"></script>
			<script>
				$(function()
					{
						$("table").tablesorter();
					});
				<?php
								}
						}
				?>
			</script>
			<style>
				table, tr, td
					{
						margin: 0px;
						padding: 0px;
						border: 1px solid black;
					}
				th
					{
						margin: 0px;
						padding: 0px;
						border: 1px solid black;
						background-color: #000000;
						color: #FFFFFF;
						cursor: pointer;
					}
			</style>
	</head>
	<body style="font-family: Verdana;">
		<?php
			if ($code!="")
				{
		?>
		<input style="position: fixed; right: 10px; top: 10px; width: 100px; height: 50px; font-family: Verdana; font-size: 25px; background-color: #990000; color: #FFFFFF" type="button" value="Изход" onclick="window.open('./?logout','_self'); return true;" />
		<?php
				}
		?>
		<center>
			<?php
				if ($code=="")
				{
			?>
			<form action="./" method="POST">
				<br />Пропускателен режим СУ &quot;Васил Левски&quot; - Троян
				<br />
				<br />Въведете цифрите от кода на Вашия служебен пропуск без интервали в полето по-долу:
				<br /><input name="code" style="width: 400px; text-align: center; height: 50px; font-family: Verdana; font-size: 25px; margin-right: 20px;" type="text" value="" autocomplete="off"  />
				<br />
				<br /><input style="width: 800px; height: 50px; font-family: Verdana; font-size: 25px;" type="submit" value="Вход в системата" />
			</form>
			<?php
				}
				else if (($code=="5056610067") || ($code=="7717537011") || ($code=="4750605065") || ($code=="2326533023") || ($code=="5014546010") || ($code=="7411614007") || ($code=="2356582074") || ($code=="9859586081") || ($code=="6247591049") || ($code=="1459597078") || ($code=="4726614022") || ($code=="4120551014") || ($code=="4147616043") || ($code=="3847641058") || ($code=="6259653076") || ($code=="7477607094") || ($code=="6547637046") || ($code=="4735627031") || ($code=="4777557095") || ($code=="7747691050") || ($code=="7447492057") || ($code=="1120583013") || ($code=="6523525019") || ($code=="2347527044") || ($code=="4135819035") || ($code=="4762565088") || ($code=="4756617073") || ($code=="3835537026") || ($code=="4747582055") || ($code=="5659627077") || ($code=="4135654034") || ($code=="1756656071") || ($code=="5950535061") || ($code=="4777707096") || ($code=="7411707005") || ($code=="4144577041") || ($code=="1414688008"))
				{
					$newtime=time()+(60*60*24*7);
					setcookie("code", "".$code."", $newtime, "/");
					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"];
							}
						if (!isset($_GET["l"]))
							{
								$l=0;
							}
						else
							{
								$l=$_GET["l"];
							}
						$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 (isset($_GET["a"]))
							{
								$a=$_GET["a"];
								$regt=mktime(7, 50, 0, $month, $day, $year);
								$enterdata=mysqli_query($db, "INSERT INTO `visits` (`i`, `c`, `t`, `m`) VALUES (NULL, '".$a."', '".$regt."', '2')");
							}
						if (isset($_GET["r"]))
							{
								$r=$_GET["r"];
								$regt=mktime(7, 50, 0, $month, $day, $year);
								$deletedata=mysqli_query($db, "DELETE FROM `visits` WHERE (`c`='".$r."' AND `t`='".$regt."' AND `m`='2')");
							}
						if ($t=="s")
							{
								if ($code=="5056610067")
								{
									// 01 Пенка Неофитова
									$klas="1а";
								}
								if ($code=="7717537011")
								{
									// 02 Валентина Маринова
									$klas="1б";
								}
								if ($code=="4750605065")
								{
									// 03 Нягул Моллов
									$klas="2а";
								}
								if ($code=="2326533023")
								{
									// 04 Емилия Дачева
									$klas="2б";
								}
								if ($code=="5014546010")
								{
									// 05 Боряна Нановска
									$klas="3а";
								}
								if ($code=="7411614007")
								{
									// 06 Атанаска Стоянова
									$klas="3б";
								}
								if ($code=="2356582074")
								{
									// 07 Поля Дудева
									$klas="4а";
								}
								if ($code=="9859586081")
								{
									// 08 Росица Якова
									$klas="4б";
								}
								if ($code=="6247591049")
								{
									// 09 Марийка Станчева
									$klas="5а";
								}
								if ($code=="1459597078")
								{
									// 10 Ренета Бакарова
									$klas="5б";
								}
								if ($code=="4726614022")
								{
									// 11 Емил Мичев
									$klas="5в";
								}
								if ($code=="4120551014")
								{
									// 12 Галинка Калева
									$klas="6а";
								}
								if ($code=="4147616043")
								{
									// 13 Магда Колева
									$klas="6б";
								}
								if ($code=="3847641058")
								{
									// 14 Мирослава Йовчевска
									$klas="6в";
								}
								if ($code=="6259653076")
								{
									// 15 Радосвета Станевска
									$klas="6г";
								}
								if ($code=="7477607094")
								{
									// 16 Цветанка Христова
									$klas="7а";
								}
								if ($code=="6547637046")
								{
									// 17 Мариела Тенева
									$klas="7б";
								}
								if ($code=="4735627031")
								{
									// 18 Ивелина Маринова
									$klas="7в";
								}
								if ($code=="4777557095")
								{
									// 19 Цветелина Мутафова
									$klas="7г";
								}
								if ($code=="7747691050")
								{
									// 20 Мария Църовска
									$klas="8а";
								}
								if ($code=="7447492057")
								{
									// 21 Милкана Христова
									$klas="8б";
								}
								if ($code=="1120583013")
								{
									// 22 Габриела Ангелска
									$klas="8в";
								}
								if ($code=="6523525019")
								{
									// 23 Диляна Табакова
									$klas="9а";
								}
								if ($code=="2347527044")
								{
									// 24 Магдалена Димова
									$klas="9б";
								}
								if ($code=="4135819035")
								{
									// 25 Ирина Калинова
									$klas="9в";
								}
								if ($code=="4762565088")
								{
									// 26 Стела Михайлова
									$klas="10а";
								}
								if ($code=="4756617073")
								{
									// 27 Поля Минкова
									$klas="10б";
								}
								if ($code=="3835537026")
								{
									// 28 Ивайло Йорданов
									$klas="10в";
								}
								if ($code=="4747582055")
								{
									// 29 Милена Мартинова
									$klas="10г";
								}
								if ($code=="5659627077")
								{
									// 30 Радостка Петкова
									$klas="11а";
								}
								if ($code=="4135654034")
								{
									// 31 Илиян Ковачев
									$klas="11б";
								}
								if ($code=="1756656071")
								{
									// 32 Пешка Вачева
									$klas="11в";
								}
								if ($code=="5950535061")
								{
									// 33 Нели Радева
									$klas="11г";
								}
								if ($code=="4777707096")
								{
									// 34 Цветлина Митева
									$klas="12а";
								}
								if ($code=="7411707005")
								{
									// 35 Андриана Хаджийска
									$klas="12б";
								}
								if ($code=="4144577041")
								{
									// 36 Лидия Кирилова
									$klas="12в";
								}
								if ($code=="1414688008")
								{
									// 37 Бихрияна Брилска
									$klas="12г";
								}
								print("<b>С П Р А В К А</b><br />за регистрираните ученици от ".$klas." клас на ".$day.".".$month.".".$year." г.<br /><br />");
								print("<table id=\"large".$k."\" class=\"tablesorter\" style=\"width: 800px;\">");
								print("<thead><tr><th style=\"width: 50px;\"><b>N</b></th><th style=\"width: 250px;\"><b>дата и час</b></th><th style=\"width: 450px;\"><b>Имена</b></th><th style=\"width: 50px;\"><b>клас</b></th></tr></thead><tbody>");
								$pkl=$klas;
								$cardsint=mysqli_query($db, "SELECT * FROM `students` WHERE `k` = '".$klas."' AND `a`='1' ORDER BY `n1` ASC, n2 ASC, n3 ASC");
								while ($singlecardint=mysqli_fetch_row($cardsint))
									{
										$lprint="</td><td>".$singlecardint[2]." ".$singlecardint[3]." ".$singlecardint[4]."</td><td>".$singlecardint[7]."</td></tr>";
										$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");
										$tr=1;
										while ($singlecard=mysqli_fetch_row($cards))
											{
												$ts=$singlecard[2];
												$pprint=date("d.m.Y г., H:i:s", $ts);
												$hch=date("G", $ts);
												$mch=date("i", $ts);
												$mch*=1;
												$tr=$singlecard[3];
											}
										if ($i>1)
											{
												$nkl="".$singlecardint[7]."";
												if ($nkl!=$pkl)
													{
														$pkl=$nkl;
														$i=1;
														$k++;
														print("</tbody></table><br /><table id=\"large".$k."\" class=\"tablesorter\" style=\"width: 800px;\">");
														print("<thead><tr><th style=\"width: 50px;\"><b>N</b></th><th style=\"width: 250px;\"><b>дата и час</b></th><th style=\"width: 450px;\"><b>Имена</b></th><th style=\"width: 50px;\"><b>клас</b></th></tr></thead><tbody>");
													}
											}
										if ($tr==2)
											{
												print("<tr style=\"background-color: #DDDD00; cursor: pointer;\" onclick=\"window.open('./?r=".$singlecardint[1]."&t=".$t."&d=".$d."&l=".$l."', '_self'); return true;\"><td><b>".$i.".</b></td><td><img src=\"./manual.png\" style=\"position: relative; top: 0px; left: 0px; width: 30px; height: 18px; border: none; margin-right: 5px;\" />".$pprint."".$lprint."");
											}
										else
											{											
												if ($hch>=8)
													{
														if ($hch==99)
															{
																print("<tr style=\"background-color: #999999; cursor: pointer;\" onclick=\"window.open('./?a=".$singlecardint[1]."&t=".$t."&d=".$d."&l=".$l."', '_self'); return true;\"><td><b>".$i.".</b></td><td><img src=\"./nocard.png\" style=\"position: relative; top: 0px; left: 0px; width: 30px; height: 18px; border: none; margin-right: 5px;\" />".$pprint."".$lprint."");
															}
														else if ($hch==8)
															{
																if ($mch>=$l)
																	{
																		if (($nkl=="1а") || ($nkl=="1б") || ($nkl=="2а") || ($nkl=="2б") || ($nkl=="3а") || ($nkl=="3б") || ($nkl=="4а") || ($nkl=="4б"))
																			{
																				print("<tr><td><b>".$i.".</b></td><td><img src=\"./card.png\" style=\"position: relative; top: 0px; left: 0px; width: 30px; height: 18px; border: none; margin-right: 5px;\" />".$pprint."".$lprint."");
																			}
																		else
																			{
																				print("<tr style=\"background-color: #DD6666;\"><td><b>".$i.".</b></td><td><img src=\"./card.png\" style=\"position: relative; top: 0px; left: 0px; width: 30px; height: 18px; border: none; margin-right: 5px;\" />".$pprint."".$lprint."");
																			}
																	}
																else
																	{
																		print("<tr><td><b>".$i.".</b></td><td><img src=\"./card.png\" style=\"position: relative; top: 0px; left: 0px; width: 30px; height: 18px; border: none; margin-right: 5px;\" />".$pprint."".$lprint."");
																	}
															}
														else
															{
																print("<tr style=\"background-color: #DD6666;\"><td><b>".$i.".</b></td><td><img src=\"./card.png\" style=\"position: relative; top: 0px; left: 0px; width: 30px; height: 18px; border: none; margin-right: 5px;\" />".$pprint."".$lprint."");
															}
													}
												else
													{
														print("<tr><td><b>".$i."</b>.</td><td><img src=\"./card.png\" style=\"position: relative; top: 0px; left: 0px; width: 30px; height: 18px; border: none; margin-right: 5px;\" />".$pprint."".$lprint."");
													}
											}
										$i++;
									}
							}
						else
							{
								print("Нещо се обърка!");
							}
						print("</tbody></table>");
						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")); ?>" />
				Толеранс за закъснение:
				<select id="lt" style="width: 150px; text-align: left; height: 50px; font-family: Verdana; font-size: 25px; margin-left: 10px;">
					<option value="0">без закъснения</option>
					<option value="2" selected>2 минути</option>
					<option value="5">5 минути</option>
					<option value="10">10 минути</option>
					<option value="15">15 минути</option>
				</select>
				<br />
				<br /><input style="width: 800px; height: 50px; font-family: Verdana; font-size: 25px;" type="button" value="Информация за ученици" onclick="shw('s');" />
			<?php
					}
				}
				else
				{
			?>
				<br />Пропускателен режим СУ &quot;Васил Левски&quot; - Троян
				<br />
				<br />ГРЕШЕН КОД!
				<br />
				<br /><input style="width: 800px; height: 50px; font-family: Verdana; font-size: 25px;" type="button" value="ОПИТАЙТЕ ОТНОВО" onclick="window.open('./','_self'); return true;" />
			<?php
				}
			?>
		</center>
	</body>
</html>