<?php
session_start(); // start up your PHP session!
 if ($_SESSION['islogin']=='' ) { 
  echo "ΠΡΕΠΕΙ ΝΑ ΚΑΝΕΤΕ ΕΓΓΡΑΦΗ ΓΙΑ ΧΡΗΣΗΣ ΤΟΥ ΣΥΣΤΗΜΑΤΟΣ"."<BR>";
  sleep(3);
  header("Location: loginall.php"); /* Redirect browser */
  exit();
  }
$menu=$_SESSION['menu'];
include "logo.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<style type="text/css">
input.right{  text-align:right;  }
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:10pt; }
</style>
<body>

<?php
require "dbconnect.php";
$dt=date('Y-m-d');
  
$sql= mysqli_query($con,"SELECT semname,plithos,semcode from seminaria order by semcode");
$i=1;$max=0;
while($row=mysqli_fetch_array($sql))
{
   $semname[$i]=$row['semname'];
   $sm[$i]=$row['semcode'];
   $semplithos[$i]=$row['plithos'];
   $sqls= mysqli_query($con,"SELECT a.eponimo,a.onoma,a.tmima,d.mitroo from allstudentinfo as a,dilosisem as d 
         where d.mitroo=a.mitroo and d.semcode='$sm[$i]' order by a.tmima,a.eponimo,a.onoma");
		 $k=0;
         while($rows=mysqli_fetch_array($sqls))
         {
			$k++;
		    $tm[$sm[$i]][$k]=$rows['tmima'];
			$st[$sm[$i]][$k]=$rows['eponimo']." ".$rows['onoma'];
		 }
		 if ($k > $max){$max=$k;}
   $i++;   
}

// display plithos by day and session

echo "<table style='width:800px' border-radius:5px class='myTable' >
<tr style='border:1px solid black;' bgcolor='#819FF7'  >
<th colspan='7'> ΠΡΩΤΗ ΗΜΕΡΑ 21-12-16 </th>
<tr>
<th>"." "."</th>
<th colspan='2'>".$semname[1]."</th>
<th colspan='2'>".$semname[2]."</th>
<th colspan='2'>".$semname[3]."</th>
</tr>";

echo "<tr>
<th>A/A </th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
</tr>";

for ($i=1;$i<=$max;$i++)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td>".$tm[$sm[1]][$i]."</td>";
echo "<td>".$st[$sm[1]][$i]."</td>";
echo "<td>".$tm[$sm[2]][$i]."</td>";
echo "<td>".$st[$sm[2]][$i]."</td>";
echo "<td>".$tm[$sm[3]][$i]."</td>";
echo "<td>".$st[$sm[3]][$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>"."<br>";
echo "<table style='width:800px' border-radius:5px class='myTable' >
<tr style='border:1px solid black;' bgcolor='#819FF7'  >
<th colspan='7'> ΠΡΩΤΗ ΗΜΕΡΑ 21-12-16 </th>
<tr>
<th>"." "."</th>
<th colspan='2'>".$semname[4]."</th>
<th colspan='2'>".$semname[5]."</th>
<th colspan='2'>".$semname[6]."</th>
</tr>";

echo "<tr>
<th>A/A </th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
</tr>";

for ($i=1;$i<=$max;$i++)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td>".$tm[$sm[4]][$i]."</td>";
echo "<td>".$st[$sm[4]][$i]."</td>";
echo "<td>".$tm[$sm[5]][$i]."</td>";
echo "<td>".$st[$sm[5]][$i]."</td>";
echo "<td>".$tm[$sm[6]][$i]."</td>";
echo "<td>".$st[$sm[6]][$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>"."<br>";
echo "<table style='width:800px' border-radius:5px class='myTable' >
<tr style='border:1px solid black;' bgcolor='#819FF7'  >
<th colspan='7'> ΔΕΥΤΕΡΗ ΗΜΕΡΑ 22-12-16 </th>
<tr>
<th>"." "."</th>
<th colspan='2'>".$semname[7]."</th>
<th colspan='2'>".$semname[8]."</th>
<th colspan='2'>".$semname[9]."</th>
</tr>";

echo "<tr>
<th>A/A </th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
</tr>";

for ($i=1;$i<=$max;$i++)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td>".$tm[$sm[7]][$i]."</td>";
echo "<td>".$st[$sm[7]][$i]."</td>";
echo "<td>".$tm[$sm[8]][$i]."</td>";
echo "<td>".$st[$sm[8]][$i]."</td>";
echo "<td>".$tm[$sm[9]][$i]."</td>";
echo "<td>".$st[$sm[9]][$i]."</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>"."<br>";
echo "<table style='width:800px' border-radius:5px class='myTable' >
<tr style='border:1px solid black;' bgcolor='#819FF7'  >
<th colspan='7'> ΔΕΥΤΕΡΗ ΗΜΕΡΑ 22-12-16 </th>
<tr>
<th>"." "."</th>
<th colspan='2'>".$semname[10]."</th>
<th colspan='2'>".$semname[11]."</th>
<th colspan='2'>".$semname[12]."</th>
</tr>";

echo "<tr>
<th>A/A </th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΜΑΘΗΤΗΣ / ΤΡΙΑ</th>
</tr>";

for ($i=1;$i<=$max;$i++)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td>".$tm[$sm[10]][$i]."</td>";
echo "<td>".$st[$sm[10]][$i]."</td>";
echo "<td>".$tm[$sm[11]][$i]."</td>";
echo "<td>".$st[$sm[11]][$i]."</td>";
echo "<td>".$tm[$sm[12]][$i]."</td>";
echo "<td>".$st[$sm[12]][$i]."</td>";
echo "</tr>";
}
echo "</table>";
?>
<br><br>
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a>

</body>
</html>