Your IP : 216.73.217.87


Current Path : /hdd/hdd11/www/vlevski/enter/
Upload File :
Current File : /hdd/hdd11/www/vlevski/enter/index1.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");
	if (isset($_POST["egn"]))
	{
		include("./conn.php");
		$egn=$_POST["egn"];
		if (isset($_POST["vf"]))
		{
			$segn=$egn;
			$sac=mysqli_query($db, "SELECT `i` FROM `av` WHERE `e`='".$segn."' LIMIT 1");
			while ($rsac=mysqli_fetch_row($sac))
			{
				$segn="av";
			}
			if ($segn!="av")
			{
				$vf=$_POST["vf"];
				$avs=mysqli_query($db, "INSERT INTO `av` (`i`, `e`, `v`) VALUES (NULL, '".$egn."', '1');");
				$t=time();
				$rvs=mysqli_query($db, "INSERT INTO `rv` (`i`, `v`, `t`) VALUES (NULL, '".$vf."', '".$t."');");
			}
		}
		else
		{
			$vf="";
		}
		$sa=mysqli_query($db, "SELECT `i` FROM `students` WHERE `e`='".$egn."' LIMIT 1");
		$segn=$egn;
		$egn="notok";
		while ($rsa=mysqli_fetch_row($sa))
		{
			$egn="ok";
			$sac=mysqli_query($db, "SELECT `i` FROM `av` WHERE `e`='".$segn."' LIMIT 1");
			while ($rsac=mysqli_fetch_row($sac))
			{
				$egn="av";
			}
			$i=$rsa[0];
		}
	}
	else
	{
		$egn="";
	}
?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
		<title>Гласуване за председател на ученически съвет в СУ &quot;Васил Левски&quot; - Троян</title>
		<style>
			body
			{
				font-family: Calibri;
				background: #444;
			}
			h2
			{
				font-size: 18px;
				font-family: Calibri, sans-serif;
				font-weight: bold;
				color: #fff;
			}
			.flipswitch, .flipswitch2
			{
				position: relative;
				background: #777;
				width: 320px;
				height: 40px;
				-webkit-appearance: initial;
				border-radius: 0px 0px 5px 5px;
				-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
				outline: none;
				font-size: 12px;
				font-family: Calibri, sans-serif;
				font-weight: bold;
				cursor: pointer;
				border: 1px solid #777;
			}
			.flipswitch:after, .flipswitch2:after
			{
				position: absolute;
				top: 5%;
				display: block;
				line-height: 32px;
				width: 45%;
				height: 90%;
				background: #900;
				box-sizing: border-box;
				text-align: center;
				transition: all 0.3s ease-in 0s;
				color: #FFF;
				border: #777 1px solid;
				border-radius: 3px;
			}
			.flipswitch:after
			{
				left: 2%;
				content: "НЕ СТЕ ГЛАСУВАЛИ";
				background: #900;
			}
			.flipswitch:checked:after
			{
				left: 53%;
				content: "ИЗБРАХТЕ НИКОЛА";
				background: #090;
			}
			.flipswitch2:after
			{
				left: 2%;
				content: "НЕ СТЕ ГЛАСУВАЛИ";
				background: #900;
			}
			.flipswitch2:checked:after
			{
				left: 53%;
				content: "ИЗБРАХТЕ ГЕРГАНА";
				background: #090;
			}
		</style>
		<script>
			function cvote()
			{
				v1=document.getElementById("ch1").checked;
				v2=document.getElementById("ch2").checked;
				if ((v1==false) && (v2==false))
				{
					document.getElementById("vb").disabled=true;
					document.getElementById("vb").style.backgroundColor="#333";
					document.getElementById("vb").style.color="#555";
				}
				else
				{
					document.getElementById("vb").disabled=false;
					document.getElementById("vb").style.backgroundColor="#090";
					document.getElementById("vb").style.color="#fff";
				}
			}
			function chv()
			{
				v1=document.getElementById("ch1").checked;
				v2=document.getElementById("ch2").checked;
				if (v1==true)
				{
					document.getElementById("vf").value="1";
					document.getElementById("msg").style.display="block";
					document.getElementById("msg").innerHTML="Вие ще гласувате<br />за Никола Петров.<br /><img src=\"./1.jpg\" style=\"width: 200px; border-radius: 10px; border: none;\" alt=\"\" /><br /><br /><input type=\"button\" onclick=\"document.getElementById('vnow').submit(); return true;\" style=\"cursor: pointer; position: relative; top: 0; border-radius: 5px; width: 320px; height: 40px; background-color: #090; color: #fff;\" value=\"ГЛАСУВАЙ\" /><br /><br /><input type=\"button\" style=\"cursor: pointer; position: relative; top: 0; border-radius: 5px; width: 320px; height: 40px; background-color: #900; color: #fff;\" onclick=\"document.getElementById('msg').style.display='none'; return true;\" value=\"ПРОМЕНИ\" />";
				}
				if (v2==true)
				{
					document.getElementById("vf").value="2";
					document.getElementById("msg").style.display="block";
					document.getElementById("msg").innerHTML="Вие ще гласувате<br />за Гергана Монева.<br /><img src=\"./2.jpg\" style=\"width: 200px; border-radius: 10px; border: none;\" alt=\"\" /><br /><br /><input type=\"button\" onclick=\"document.getElementById('vnow').submit(); return true;\" style=\"cursor: pointer; position: relative; top: 0; border-radius: 5px; width: 320px; height: 40px; background-color: #090; color: #fff;\" value=\"ГЛАСУВАЙ\" /><br /><br /><input type=\"button\" style=\"cursor: pointer; position: relative; top: 0; border-radius: 5px; width: 320px; height: 40px; background-color: #900; color: #fff;\" onclick=\"document.getElementById('msg').style.display='none'; return true;\" value=\"ПРОМЕНИ\" />";
				}
			}
		</script>
	</head>
	<body>
		<div style="position: relative; width: 100%; text-align: center; border; none;">
		<h2>Гласуване за председател<br />на ученически съвет<br />в СУ &quot;Васил Левски&quot; - Троян</h2>
		<?php
			if ($egn=="")
			{
		?>
		<div style="cursor: pointer; position: relative; margin: 0 auto; top: 0; width: 320px; height: 320px; margin-bottom: 10px; background: transparent;">
			<form action="./" method="POST">
				<input id="egn" name="egn" type="input" value="" placeholder="Въведете Вашето ЕГН" style="position: relative; top: 0; border-radius: 5px; width: 310px; height: 40px; background-color: #333; color: #fff;" />
				<br />
				<br />
				<input id="vb" name="vb" type="submit" value="ВХОД" style="cursor: pointer; position: relative; top: 0; border-radius: 5px; width: 320px; height: 40px; background-color: #090; color: #fff;" />
			</form>
		</div>
		<?php
			}
			else if ($egn=="av")
			{
				if ($vf=="")
				{
		?>
		<div style="cursor: pointer; position: relative; margin: 0 auto; top: 0; width: 320px; height: 320px; margin-bottom: 10px; background: transparent; color: orange;">
			<form action="./" method="POST">
				ВИЕ ВЕЧЕ СТЕ ГЛАСУВАЛИ!
				<br />
				<br />
			</form>
		</div>
		<?php
				}
				else
				{
		?>
		<div style="cursor: pointer; position: relative; margin: 0 auto; top: 0; width: 320px; height: 320px; margin-bottom: 10px; background: transparent; color: orange;">
			<form action="./" method="POST">
				БЛАГОДАРИМ ВИ!
				<br />
				<br />ВАШИЯТ ГЛАС БЕШЕ ОТЧЕТЕН!
			</form>
		</div>
		<?php
				}
			}
			else if ($egn=="ok")
			{
		?>
		<form id="vnow" action="./" method="POST">
			<div id="msg" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 100; opacity: 0.9; background-color: #000000; color: #ffffff; text-align: center;">
			</div>
			</div>
			<input type="hidden" name="egn" value="<?php print("".$segn.""); ?>" />
			<input type="hidden" id="vf" name="vf" value="" />
			<div style="cursor: pointer; position: relative; margin: 0 auto; top: 0; width: 320px; height: 320px; margin-bottom: 10px; background: transparent;">
			<div onclick="if (document.getElementById('ch1').checked==true) { document.getElementById('ch1').checked=false; } else { document.getElementById('ch1').checked=true; } cvote(); document.getElementById('ch2').checked=false;" style="cursor: pointer; position: absolute; top: 10px; left: 20px; font-size: 60px; z-index: 2; color: #fff; text-shadow: 2px 2px #000;">1</div>
			<div onclick="if (document.getElementById('ch1').checked==true) { document.getElementById('ch1').checked=false; } else { document.getElementById('ch1').checked=true; } cvote(); document.getElementById('ch2').checked=false;" style="cursor: pointer; position: absolute; top: 240px; left: 10px; font-size: 30px; font-style: italic; z-index: 2; color: #fff; text-shadow: 2px 2px #000;">Никола Петров, 10. а</div>
			<img src="./1.jpg" onclick="if (document.getElementById('ch1').checked==true) { document.getElementById('ch1').checked=false; } else { document.getElementById('ch1').checked=true; } cvote(); document.getElementById('ch2').checked=false;" style="cursor: pointer; position: absolute; left: 0px; top: 0px; width: 320px; border-radius: 5px; border: none; z-index: 1;" />
			<input type="checkbox" class="flipswitch" id="ch1" onclick="document.getElementById('ch2').checked=false; cvote();" style="position: absolute; top: 280px; left: 0px; padding: 0; margin: 0; z-index: 2;" />
			</div>
			<div style="cursor: pointer; position: relative; margin: 0 auto; top: 0; width: 320px; height: 320px; margin-bottom: 10px; background: transparent;">
			<div onclick="if (document.getElementById('ch2').checked==true) { document.getElementById('ch2').checked=false; } else { document.getElementById('ch2').checked=true; } cvote(); document.getElementById('ch1').checked=false;" style="cursor: pointer; position: absolute; top: 10px; left: 20px; font-size: 60px; z-index: 2; color: #fff; text-shadow: 2px 2px #000;">2</div>
			<div onclick="if (document.getElementById('ch2').checked==true) { document.getElementById('ch2').checked=false; } else { document.getElementById('ch2').checked=true; } cvote(); document.getElementById('ch1').checked=false;" style="cursor: pointer; position: absolute; top: 240px; left: 10px; font-size: 30px; font-style: italic; z-index: 2; color: #fff; text-shadow: 2px 2px #000;">Гергана Монева, 10. б</div>
			<img src="./2.jpg" onclick="if (document.getElementById('ch2').checked==true) { document.getElementById('ch2').checked=false; } else { document.getElementById('ch2').checked=true; } cvote(); document.getElementById('ch1').checked=false;" style="cursor: pointer; position: absolute; left: 0px; top: 0px; width: 320px; border-radius: 5px; border: none; z-index: 1;" />
			<br />
			<input type="checkbox" class="flipswitch2" id="ch2" onclick="document.getElementById('ch1').checked=false; cvote();" style="position: absolute; top: 280px; left: 0px; padding: 0; margin: 0; z-index: 2;" />
			</div>
			<div style="cursor: pointer; position: relative; margin: 0 auto; top: 0; width: 320px; height: 320px; margin-bottom: 10px; background: transparent;">
			<input id="vb" disabled=true type="button" onclick="chv(); return true;" value="ГЛАСУВАЙ" style="cursor: pointer; position: relative; top: 0; border-radius: 5px; width: 320px; height: 40px; background-color: #333; color: #555;" />
		</form>
		<?php
			}
			else
			{
		?>
		<div style="cursor: pointer; position: relative; margin: 0 auto; top: 0; width: 320px; height: 320px; margin-bottom: 10px; background: transparent; color: orange;">
			<form action="./" method="POST">
				ГРЕШНО ЕГН!
				<br />
				<br />
				<input id="vb" name="vb" type="submit" value="ОПИТАЙ ПАК" style="cursor: pointer; position: relative; top: 0; border-radius: 5px; width: 320px; height: 40px; background-color: #900; color: #fff;" />
			</form>
		</div>
		<?php
			}
		?>
		</div>
</html>