$siteban=$nb_site_ban+1; $debut = ($page - 1) * $fin; if(empty($page)) $page = 1; if(empty($fin)) $fin = $nbparpage; if(empty($debut)) $debut = 0; if(empty($classement)) { $classement = $nb_inscrit2; } $link = mysql_connect ($host_db,$login_db,$pass_db) or die ('Erreur : '.mysql_error() ); mysql_select_db($db) or die ('Erreur 1 :'.mysql_error()); $select = "SELECT count(id) FROM $table_top where id_top=\"$id_top\""; $result = mysql_query($select,$link) or die ('Erreur count : '.mysql_error() ); $row = mysql_fetch_row($result); $total = $row[0]; $jour_reset = date("D"); $heure_reset = date("Hi"); if ($jour_reset == Fri AND 2359 == $heure_reset){ $sql = "UPDATE $table_top SET clic='0',vote='0'"; mysql_query($sql) or die('Erreur SQL !'.$sql.'
'.mysql_error()); } $select = "select *FROM $table_top WHERE id_top=\"$id_top\" ORDER BY vote DESC LIMIT $debut,$fin"; $result = mysql_query($select,$link) or die ('Erreur selec : '.mysql_error() ); $nb_inscrit = mysql_query("SELECT id FROM $table_top where id_top=\"$id_top\""); $nb_inscrit2 = mysql_num_rows($nb_inscrit); $nb_note = mysql_query("SELECT id_note FROM $table_top_note where id_top=\"$id_top\" and pseudo_note=\"$pseudo\""); $nb_note2 = mysql_num_rows($nb_note); echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if($total) { while($row = mysql_fetch_array($result)) { $pseudo="$row[pseudo]"; $id_top="$row[id_top]"; $titre="$row[titre]"; $text="$row[text]"; $url_ban="$row[url_ban]"; $url_site="$row[url_site]"; $mail="$row[mail]"; $vote="$row[vote]"; $clic="$row[clic]"; $i2 = $debut + $i + 1; $i++; $moy = "SELECT AVG(note) FROM $table_top_note where id_top=\"$id_top\" and pseudo_note=\"$pseudo\" and note >\"-1\""; $moy2 = mysql_query($moy,$link) or die ('Erreur moy : '.mysql_error() ); $moy3 = mysql_fetch_row($moy2); $moy4 = $moy3[0]; $moy5 = sprintf("%2.1d", $moy4); $nb_commentaires = mysql_query("SELECT id_commentaire FROM $table_top_commentaires WHERE id_commentaire=\"$pseudo\""); $nb_commentaires2 = mysql_num_rows($nb_commentaires); if(($i < $siteban) and ($debut == 0)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } elseif(($i == $siteban) and ($debut ==0)) { echo "
Nombres de sites inscrit: $nb_inscrit2

Rang

Site

Vote

Clic

$i

"; echo "
"; echo ""; echo "
$titre :

"; if($moy !=''){ echo"| Moyenne : $moy5/10"; } else{ echo"| Moyenne : aucune note"; } echo ' | Commentaires '; echo "[$nb_commentaires2] | "; echo "

"; echo ""; echo nl2br($text); echo "

$vote

$clic



"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } else{ echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } } } echo "

$i

"; echo ""; echo "
$titre :

"; if($moy !=''){ echo"| Moyenne : $moy5/10"; } else{ echo"| Moyenne : aucune note"; } echo ' | Commentaires '; echo "[$nb_commentaires2] | "; echo "

"; echo ""; echo nl2br($text); echo "

$vote

$clic

$i2

"; echo ""; echo "
$titre :

"; if($moy !=''){ echo"| Moyenne : $moy5/10"; } else{ echo"| Moyenne : aucune note"; } echo ' | Commentaires '; echo "[$nb_commentaires2] | "; echo "

"; echo ""; echo nl2br($text); echo "

$vote

$clic

"; $classement = $nb_inscrit2; if($classement != '0' ) { echo "
\n"; $nbrarr = $classement / $fin ; $nbdepage = ceil($nbrarr); if($page != 1) { $pre = $page - 1 ; echo " \n"; echo "\n"; } else { echo " \n"; echo "\n"; } $ndbdepage = ceil($nbrarr); echo ""; if($page == $nbdepage) { echo "\n"; echo "\n"; } else { $page2 = $page + 1 ; echo "\n"; echo "\n"; } echo "
<< Page Précédente\n"; echo "
<< Page Précédente\n"; echo "\n"; for($i = 1;$i <= $nbdepage;$i ++) { if($i == $page) echo "$i\n"; else echo "$i\n"; if($i < $nbdepage) echo " - "; } echo ""; echo ""; echo ""; echo "

Page Suivante >>

Page Suivante >>

"; } ?>