<!doctype html>
<html lang=fr>
	<?php
	session_start();
	if (!isset($_SESSION['Autorisation']) or ($_SESSION['Autorisation'] != 1))  //prof
	{  
		header("Location: index.php");
	  	exit();
	}
	?>

	<head>
		<title>Prof accueil</title>
		<meta charset=utf-8> <meta name=viewport content="width=device-width, initial-scale=1">

		<link rel="stylesheet" href="nogstyle.css">		
	</head>
	<body>
		<header>
			<?php include('includes/header_simple.inc'); 
			echo'<h3>'.$_SESSION['PrenomAct'].' '.$_SESSION['NomAct'].' '.$_SESSION['NomEtab'].'</h3>';
			include('includes/menu_prof.inc'); ?>
		</header>
		
		<article>
			<?php
				require ('connect/mysqli_connect.php'); // Connect to the db.		
				$q = 'SELECT * FROM acteur WHERE Autorisation=99 ORDER BY NomAct;';	
				$result = mysqli_query ($dbcon, $q);
				if (mysqli_affected_rows($dbcon) >= 1) 
				{	
					// If it ran, display the records.
					// Table header.
					echo '<h3>Ces étudiants ont demandé leur inscription </h3>';
					echo'<h2>Demande d\'inscription étudiant</h2>';
					echo '<table>
						<tr>
						<th><b>Valider</b></th>
						<th><b>Suppr</b></th>
						<th><b>Nom</b></th>
						<th><b>Prénom</b></th>
						<th><b>Ident.</b></th>
						<th><b>Date naissance</b></th>
						<th><b>Session exam</b></th>
						</tr>';
						
						// Fetch and display the records:
						while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
						{
							echo '<tr>
							<td><a class="bouton" href="prof_valid_temp_ok.php?id='. $row['NumAct'] . '">&nbsp;&nbsp;<span class="iconic">y</span>&nbsp;&nbsp;</a></td>	
							<td><a class="bouton" href="prof_valid_temp_sup.php?id='. $row['NumAct'] . '">&nbsp;&nbsp;<span class="iconic">x</span>&nbsp;&nbsp;</a></td>		
							<td>' . $row['NomAct'] . '</td>
							<td>' . $row['PrenomAct'] . '</td>
							<td>' . $row['LoginAct'] . '</td>
							<td>' . $row['datenaissAct'] . '</td>
							<td>' . $row['SessionExam'] . '</td>
							</tr>';
						}
						echo '</table>'; // Close the table.
						mysqli_free_result ($result); // Free up the resources.	
						mysqli_close($dbcon); // Close the database connection.
				}
			?>
		</article>
		<footer>
				<?php include ('includes/footer.inc'); ?>
		</footer>
	</body>
</html>