<?php 
include('connexion_mysql.php');
if (isset($_GET['supprimer_annonce'])) // Si l'on demande de supprimerune news.
{
// Alors on supprime la news correspondante.
// On protège la variable « id_news » pour éviter une faille SQL
$_GET['supprimer_annonce'] = addslashes($_GET['supprimer_annonce']);
mysql_query('DELETE FROM annonces WHERE id=\'' .
$_GET['supprimer_annonce'] . '\'');

}

	 
 $file_name = mysql_fetch_array(mysql_query("SELECT COUNT(*) AS verif_exist,id FROM annonces WHERE id_eleve= '".$_SESSION['id']."' AND valid = 'ok' AND reponse='non'"));

        if($file_name['verif_exist'] > 0)
		 { 
include('pagination_voir_annonces.php');
include('function_court.php');?>



<?php $retour = mysql_query('SELECT * FROM annonces WHERE id_eleve = "'.$_SESSION['id'].'" AND valid = "ok" AND reponse="non" ORDER BY id DESC LIMIT '.$premiereEntree.', '.$messagesParPage.'');

while ($donnees = mysql_fetch_array($retour)) // On fait une boucle
{?> 

<?php $donnees['titre'] = mb_strtoupper($donnees['titre']); ?>
<br /><div class="consult" style="margin-top:-70px; background:transparent; width:600px;padding:20px; line-height:20px;">
<p><b>Code</b> : <font style="color	:#000;"><?php 
	$id = sprintf("%06d",$donnees['id']);
echo $id;
?></font></p>
<p><b>Date limite</b> :<span style="color:red;"> <?php 
echo $donnees['date_limite'];
?></span></p>
<p style="vertical-align:middle; margin-left:90px; margin-left:90px;"><a href="<?php echo "consulter_annonce.php?mark=".$donnees['id']."";?>"><span id="bout" style="padding-top:3px; height:20px; font-size:13px; width:130px; padding:5px;">Consulter l'annonce</span></a></p>
<p style="width:470px; text-align:center; margin-top:-10px; text-align:center; font-size:14px; color: #134579;"><b><?php echo mb_strtoupper($donnees['titre'], 'UTF-8'); ?></b></p>
<p style="width:470px; text-align:center; margin-top:-10px; text-align:left; font-size:14px; color: #134579; width:330px;"><?php $str = $donnees['contenu'];
$str = truncate($str, 100, '...', true);
echo $str; // salut tout le monde ... ?>
</p><br />
<table align="center" style="margin-top:-35px; border-bottom:1px solid rgba(0,0,0,0.5); background:transparent; width:100%; height:auto;padding-bottom:5px;"><tr align="center"><td colspan="2"><a href="<?php echo "modifier_annonce.php?modifier_annonce=".$donnees['id']."";?>">Modifier</a>&nbsp;&nbsp;<a href="<?php echo "annonces.php?supprimer_annonce=".$donnees['id']."";?>">Supprimer</a></td></tr>
</table><BR />

</div>



<?php
  }
 
 }
 
else
  {echo "<div style=\"float:left; display:inline; width:300px; height:200px; margin-left:0px;color:rgba(0,0,0,0.7); font-family:'Century Gothic'; font-size:16px;\"><img src=\"img/vide.png\"><br>aucune annonce disponible</div>";}
  

?>





