<!DOCTYPE html>
<html lang="fr">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF8_unicode_ci" />
   <meta name="viewport" content="width=device-width, target-densitydpi=device-dpi"/>
		
   <!-- //Modification 1/4  -->
  <title>Messages anonymes</title>
  <link rel="stylesheet" href="../style.css">

  
				<link href="../favicon.ico" rel="icon" type="../image/x-icon" />
		<link rel="stylesheet" type="text/css" href="../css/default.css" />
		<link rel="stylesheet" type="text/css" href="../css/component.css" />

		
</head>
<body>
	


         <?php

// Check connection
if($bdd = mysqli_connect('localhost', 'root', '', 'messagesanonymes'))
{
	// Si la connexion a réussi, rien ne se passe.
}
else // Mais si elle rate…
{
	echo 'Erreur'; // On affiche un message d'erreur.
}

 
    



$i=0;
$id=$_GET["id"];
$requete = mysqli_query($bdd,"SELECT sexe, Images, Vues FROM anonyme WHERE id='$id'");



 while($donnees = mysqli_fetch_assoc($requete)) {

	$nouveau_nombre_de_clics;
 	$nouveau_nombre_de_clics = $donnees['Vues']+1; //on récupère le nombre de clics auquel on ajoute1
 	
 	mysqli_query($bdd,"UPDATE anonyme SET Vues='".$nouveau_nombre_de_clics."' WHERE id='$id'");
 	


 if(($donnees['sexe']=="Homme" OR $donnees['sexe']==NULL) AND $donnees['Images']==NULL) {

 	?>

  <img src="../images/commentaireanonyme2.jpg" style="  
										height: 730px;     
										margin-right: 0px;    
										width: 1050px; "/> 
<?php

 } elseif($donnees['sexe']=="Femme" AND $donnees['Images']==NULL){

  ?>

  <img src="../images/commentaireanonyme.jpg" style="  
										height: 730px;     
										margin-right: 0px;    
										width: 1050px; "/> <?php

	} 


elseif($donnees['Images']!=NULL) {

		
?>
		 <img src="../uploads/<?php echo $donnees['Images'];?>" style=" 
		 								background-size:cover; 
		 								opacity: 0.4;
										height: 730px;     
										margin-right: 0px;    
										width: 100%; "/>

<?php  
	}

}
?>									

											
<div class="main" style="
    height: 0px;
">
					<!-- //Modification 2/4  -->
					<ul class="commentaireamour redac" style="
								width: 750px; 
								height: 0px;  
								bottom: 700px;
								margin-left: 500px;
">
					
						
									<a href="../index.php" ><img src="../images/fleche.jpg" title="Retour" style="
    margin-left: 150px;
"></a>
						<li style="
								width: 600px;">
						<!-- //Modification 3/4  -->
							
							<div class="amour4 amour4-phone"></div>
							<div class="amour3" style="
								left: 0px;
								margin-left: 337px;
								width: 476.8000030517578px;
								top: 65px;">
									<!-- //Modification 4/4  -->		
									<h2><?php

									

									$requete = mysqli_query($bdd,"SELECT nom FROM anonyme WHERE id='$id'");
                    while($donnees = mysqli_fetch_assoc($requete))
                    {
                    	 if($donnees['nom']==NULL) {
                                         echo "Anonyme";
                                      } else echo $donnees['nom'];
                                      
                    }
                    mysqli_free_result($requete);
                   


                    $requete = mysqli_query($bdd,"SELECT age FROM anonyme WHERE id='$id'");
                    while($donnees = mysqli_fetch_assoc($requete)) {
                    if($donnees['age']!=NULL) { 
                    	echo (' / ');
                    } 

								
                   
                    
                    	echo $donnees['age'];  if($donnees['age']!=NULL) { echo (' ans');} 
                    }
                    mysqli_free_result($requete);



                    $requete = mysqli_query($bdd,"SELECT sexe FROM anonyme WHERE id='$id'");
                     while($donnees = mysqli_fetch_assoc($requete)) {
                    if($donnees['sexe']!=NULL) { echo (' / ');} ?> <?php

									
                   
                    
                    	echo $donnees['sexe'];
                    }
                    mysqli_free_result($requete);
                    ?>
									


									</h2>
									<p><?php

									$requete = mysqli_query($bdd,"SELECT message FROM anonyme WHERE id='$id'");
                    while($donnees = mysqli_fetch_assoc($requete))
                    {
                    	echo $donnees['message'];
                    }
                    mysqli_free_result($requete);
                    ?>... </p>


                    <?php
                    $requete = mysqli_query($bdd,"SELECT Vues FROM anonyme WHERE id='$id'");
                    while($donnees = mysqli_fetch_assoc($requete))
                    {
?>
									<b  style="margin-left: 400px;">	<?php echo $donnees['Vues'].' Vues';  ?> </b>
									<?php } ?>



									<time class="amour2" datetime="2014-14-02 18:30"><span><?php

									
									

									$requete = mysqli_query($bdd,"SELECT Date FROM anonyme WHERE id='$id'");
									

                    while($donnees = mysqli_fetch_assoc($requete))
                    {
                    	?> <b><?php echo $donnees['Date']; ?><b> <?php
                    }
                    mysqli_free_result($requete);
                    ?></span></time>
							</div>
						

<div id="disqus_thread" style=" margin-left: 160px;
  
    height: 200px;
    margin-top: 100px;
    width: 680px;
	"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'kymzmessagesanonymes93'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

    

						</li>
					</ul>
					
						
								
						
	
					
						
								
						
					
				</div>
					
						
								
					
					
						
								
		
				
</body>
</html>