<?php
session_start(); 

if($_SESSION['mdp']=="jojolakymzer" )
{

?>



<html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../css.css" />
    <title>ServiceWeb</title>
	<style type="text/css" media="screen">
@import "css.css";
</style>
  </head>
<body>

<br>


<?php
 //connection au serveur
  $cnx = mysql_connect( "localhost", "root", "" ) ;
 
  //sélection de la base de données:
  $db  = mysql_select_db( "messagesanonymes" ) ;
  mysql_query ('SET NAMES UTF8');
 
  //récupération des valeurs des champs:
  //nom
  $Valider = $_POST["Valider"] ;


  //création de la requête SQL:
  $sql = "SELECT * FROM anonyme WHERE Valider LIKE '%$Valider%' ORDER BY Date DESC"  ;
 
  //exécution de la requête SQL:
	$result = mysql_query($sql);
  
  ?>
    <a href="../deconnexion.php">Deconnexion</a>
    <a href="administrationlastreetzer.php">Retour</a>



  
  <table>
		<tr>
			
			<th>Date</th>
			<th>Catégorie</th>
			<th>Nom</th>
			<th>Age</th>
			<th>Sexe</th>
			<th>Message</th>
			<th>Validé</th>
			<th>Supprimer</th>

		</tr>
		
		
			 <?php  while( $requete = mysql_fetch_array( $result ) ) 
		{ ?>
		<tr>			
			<td><?php echo $requete[5] ;  ?></td>
			<td><?php echo $requete[6] ;  ?></td>
			
			<td><?php echo $requete[1] ;  ?></td>
			<td><?php echo $requete[2] ;  ?></td>
			<td><?php echo $requete[3] ;  ?></td>
			<td><?php echo $requete[4] ;  ?></td>

			<td><a href="valider.php?id=<?php echo $requete[0] ; ?>" ><input type="submit" value="Valider" /> </a> <?php echo $requete[9] ; ?></td>
			<td><a href="supprimer.php?id=<?php echo $requete[0] ; ?>" ><input type="submit" value="Supprimer" /> </a> </td>
			
		</tr>
<?php 	} ?>
	</table>
<br>
	<br>
	<br>
	
  



<?php
}
else
{
echo '<script>alert("Vous n\'avez pas access a cette page");window.location="../index.html";</script>';
} 
?>