<?php
include "scrinit.php";
?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<?php

echo "<br>"."<br>"."<br>";
date_default_timezone_set("Europe/Athens");
require "dbconnect.php";

if (isset($_POST['adeia2']))
{
	$code=$_POST['code'];
	$sql1 = "SELECT e.*,a.*,es.pmp FROM ekdilosi as e,adeiain as a,ekdilosistu as es 
    WHERE e.onoma='ΑΔΕΙΑ ΕΙΣΟΔΟΥ' AND e.code='$code' and e.code=es.code and es.pmp=a.mitroo" ;
   if (!mysqli_query($con,$sql1)) {die('Error: ' . mysqli_error($con));   }
    $res=mysqli_query($con,$sql1);
    $c=mysqli_num_rows($res);
    $row = mysqli_fetch_array($res);
	$mitr=	$row['pmp'];
	$voithos=$row['teacher'];
	$date=$row['date'];
	$perapo=$row['perapo'];
	$tm=$row['time'];
	mysqli_query($con,"DELETE FROM ekdilosi WHERE code='$code' ");
	mysqli_query($con,"DELETE FROM ekdilosistu WHERE code='$code' ");
	mysqli_query($con,"DELETE FROM adeiain WHERE mitroo='$mitr' and date='$date' ");
	echo "Η ΑΔΕΙΑ ΕΞΟΔΟΥ ΜΕ ΚΩΔΙΚΟ : ".$code." ΕΧΕΙ ΔΙΑΓΡΑΦΕΙ";
	
}
/*if (isset($_POST['adeia3']))
{
	$code=$_POST['code'];
	$date=$_POST['date'];
	$date=date('Y-m-d', strtotime($date));
	$reason=$_POST['reason'];
	$kidemonas=$_POST['kidemonas'];
	$paralavi=$_POST['paralavi'];
	$tel=$_POST['tel'];
    $voithos=$_POST['voithos'];
	$perapo=$_POST['perapo'];
	$permexri=$_POST['permexri'];
	$mitr=$_POST['mitroo'];
	$tmimaid=$_POST['tmimaid'];
	$stname=$_POST['stname'];
	include "printadeia.php";
	
}*/

 ?>
 
 
 <br /><br /><br />
<form>
<input type='button' value='Επιστροφή' onclick='javascript:  window.location.href = "browseadeies.php";' />
</form>




</body>
</html>