Location: PHPKode > projects > Taknshare > taknshare/home.php
<?php
	$nb=rand(1 , 999);
  	$res=mysqli_query($cnx, 'SELECT * FROM images WHERE id='.$nb) or die ('Erreur 4');
	while(!$donnees=mysqli_fetch_array($res))
	{
		 //$query='SELECT COUNT(*) AS nb_i FROM images';
	         //$res=mysqli_query($cnx, $query) or die ('Erreur 2');
  	         //$donnees = mysqli_fetch_array($res) or die ('Erreur 3');
  	         $nb=rand(1 , 999);
  	         $res=mysqli_query($cnx, 'SELECT * FROM images WHERE id='.$nb) or die ('Erreur 4');
	}
	$infos_image=$donnees;
	$chemin='/taknshare/images/mini/400-300_'.$infos_image['chemin'];
	$proprietaire=stripslashes($infos_image['proprietaire']);
	$titre_image=stripslashes($infos_image['titre']);
	
	$qr=mysqli_query($cnx, 'SELECT * FROM images ORDER BY visites DESC LIMIT 0 ,1') or die(mysqli_error($cnx));
	$infos_image_mois=mysqli_fetch_array($qr)or die(mysqli_error($cnx));
	$chemin_mois='/taknshare/images/mini/400-300_'.$infos_image_mois['chemin'];
	$proprietaire_mois=stripslashes($infos_image_mois['proprietaire']);
	$titre_image_mois=stripslashes($infos_image_mois['titre']);
	
	$res=mysqli_query($cnx, 'SELECT COUNT(*) AS nb_images FROM images');
        $donnees=mysqli_fetch_array($res);
	$nb_images=$donnees['nb_images'];
	
	$res=mysqli_query($cnx, 'SELECT COUNT(*) AS nb_users FROM users');
        $donnees=mysqli_fetch_array($res);
        $nb_users=$donnees['nb_users'];
	
	
?>
<div id="content">
	<table class='home'>
		<tr>
			<td id="picture_hasard">
				<h3>Une image au hasard ...</h3>
				<p><img src="<?php echo $chemin ?>" alt='image au hasard' /></p>
				<p id='legende_image_home'><?php echo '<a href="index.php?page=image&image='.$infos_image['id'].'">'.$titre_image.'</a>'; ?> par <?php echo '<a href="index.php?page=membre&membre='.$proprietaire.'">'.$proprietaire.'</a>' ?>
			</td>
			<td>
				<h3>Bienvenue sur 'Take & Share'</h3>
				<p>T&S est un nouveau service de stockage de vos photos avec deja <?php echo $nb_images; ?> images deposees par nos <?php echo $nb_users; ?> membres !<p>
				<h3>L'image la plus vue</h3>
                                 <p><img src="<?php echo $chemin_mois ?>" alt='image la plus vue' /></p>
                                 <p id='legende_image_home'><?php echo '<a href="index.php?page=image&image='.$infos_image_mois['id'].'">'.$titre_image_mois.'</a>'; ?> par <?php echo '    <a href="index.php?page=membre&membre='.$proprietaire_mois.'">'.$proprietaire_mois.'</a>' ?></p>

			</td>
		</tr>
	</table>
				
			
</div>
		
Return current item: Taknshare