<?php
session_start();
ob_start();
if ($_SESSION['islogin']=='' ) { 
  echo "ΠΡΕΠΕΙ ΝΑ ΕΓΓΡΑΦΕΙΤΕ ΓΙΑ ΝΑ ΧΡΗΣΙΜΟΠΟΙΗΣΕΤΕ ΤΟ ΣΥΣΤΗΜΑ"."<BR>";
  sleep(3);
  header("Location: loginall.php"); /* Redirect browser */
  exit();
  }
$menu = $_SESSION['menu'];
include "logo.php";
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
table.myTable { border-collapse:collapse }
table.myTable td, table.myTable th { border:1px solid black;padding:3px;font-size:11pt; }
</style>


</head>
<body>

<h2>ΣΤΟΙΧΕΙΑ ΜΑΘΗΤΩΝ</h2>
<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];
$ac=$_SESSION['access'];
$go='true';
if ($ac==1) 
{
   $sql = mysqli_query($con,"SELECT Class_id  FROM voithos  where yt='$usr' ");
   if (mysqli_num_rows($sql) > 0) 
   {
	 $row=mysqli_fetch_array($sql);
	 $class=$row['Class_id'];
	 $sql1 = "SELECT *  FROM allstudentinfo  where tmima='$class' ORDER BY eponimo,onoma ASC";
     $result = mysqli_query($con,$sql1);
   }
   else
   { echo " ΔΕΝ ΕΧΕΤΕ ΥΠΕΥΘΥΝΟΤΗΤΑ ΤΜΗΜΑΤΟΣ";
     $go='false';
	 }
}
else
{
    $sql = "SELECT *  FROM allstudentinfo  ORDER BY tmima ASC";
    $result = mysqli_query($con,$sql);
}
if ($go=='true')
{
echo "<table class='myTable' >
<tr style='border:1px solid black' >
<tr bgcolor='#66CC99'>
<tr>
<th>A/A</th>
<th>ΜΗΤΡΩΟ</th>
<th>ΤΜΗΜΑ</th>
<th>ΌΝΟΝΑΤΕΠΩΝΥΜΟ ΜΑΘΗΤΗ / ΤΡΙΑΣ</th>
<th>ΠΑΤΕΡΑΣ</th>
<th>ΚΙΝ ΠΑΤ</th>
<th>ΜΗΤΕΡΑ</th>
<th>ΚΙΝ ΜΗΤ</th>
<th>ΣΤΑΘΕΡΟ</th>
<th>ΚΙΝ ΜΑΘΗΤΗ</th>
<th>ΚΙΝ SMS</th>
</tr>";
$i=1;
while ($row = mysqli_fetch_array($result)) 
{
	$am=$row['mitroo'];
	$tm1=$row['tmima'];
	
	$epo=$row['eponimo']." ".$row['onoma'];;
	$pat=$row['pateras'];$mit=$row['mitera'];$sms=$row['kinito'];$sta=$row['stathero'];
	$kpat=$row['kpatera'];$kmit=$row['kmiteras'];$pat=$row['pateras'];$mit=$row['mitera'];
	$math=$row['kmathiti'];
	echo "<tr>";
	echo "<td>". $i . "</td>"; 
	echo "<td>" . "<a href=\"simvmeet31.php?m=".$am."\">"."<b>".$am."</b>". "</a>". "</td>";
	// echo "<td>". $am . "</td>";
	echo "<td>". $tm1 . "</td>";
	     echo "<td>". $epo . "</td>";
	     echo "<td>". $pat."</td>";
		 echo "<td>". $kpat."</td>";
		 echo "<td>". $mit."</td>";
		 echo "<td>". $kmit."</td>";
		 echo "<td>". $sta."</td>";
		 echo "<td>". $math."</td>";
		 echo "<td>". $sms."</td>";
	     echo "</tr>";
		 
	  echo "<tr>";

	$i++;
}
echo "</table>";
}
?>

	 

<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>
</body>
</html>