<?php
include "scrinit.php";
include "logo.php";
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">

function popupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2)  - (w / 2);
    var top  = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800, height=800, top='+top+', left='+left);
}
</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:9pt; }
<p style="font-size:09px;"></p>

</style>


</head>
<body>

<?php
require("dbconnect.php");
$stname=$_POST['stname'];
$usr=$_SESSION['usr'];

$error = false;
if (!strlen(trim($_POST['perigrafi']))) 
  {
    $error = true;
  }

if ($error) // DISPALY A MESSAGE BOX IF FIELDS ARE EMPTY
{ 
   echo '<script type="text/javascript">';
   echo 'alert("ΠΡΕΠΕΙ ΑΠΑΡΑΙΤΗΤΑ ΝΑ ΔΩΣΕΤΕ ΠΕΡΙΓΡΑΦΗ ΓΙΑ ΤΟ ΠΑΡΑΠΤΩΜΑ")';
   echo '</script>';	
   $time = 1; //Time (in seconds) to wait. 
   $url = "dispkataggelia.php?pmp=".$mitr; //Location to send to. 
   header("Refresh: $time; url=$url");
} 
else 
{
   $mitr= $_POST['mitroo'];	
   $kataggelon= $_POST['kathig'];
   $datekata= $_POST['datekata'];
   $perigrafi=$_POST['perigrafi'];
   $sxolia=$_POST['sxolia'];
   $aranaforas=$_POST['aranaforas'];
   $tmimaid=$_POST['tmimaid'];
   $bd=$_POST['bd'];
   $arsimp=$_POST['arsimpx'];

   $sql=mysqli_query($con,"UPDATE kataggelia SET sxolia='$sxolia',perigrafi='$perigrafi',arsimperiforas='$arsimp'  WHERE aranaforas='$aranaforas'");

  if (!$sql) 
  { 
    echo '<script type="text/javascript">';
   echo 'alert("Η καταγγελία δεν ενημερώθηκε! ")';
   echo '</script>';	
   $time = 0.5; //Time (in seconds) to wait. 
   $url = "kataggeliakath.php?pmp=".$mitr; //Location to send to. 
   header("Refresh: $time; url=$url");
	
  }
  else
   {   
   
   echo '<script type="text/javascript">';
   echo 'alert("Η καταγγελία καταχωρήθηκε/ενημερώθηκε με τη νέα κατάσταση")';
   echo '</script>';	
   $time = 0.5; //Time (in seconds) to wait. 
   $url = "kataggeliakath.php?pmp=".$mitr; //Location to send to. 
   header("Refresh: $time; url=$url");
   }
}


?>	

</body>
</html>