1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
| <?php
if(isset($np)) {
$n_debut=($np-1)*5;
}
else {
$n_debut=0;
}
if($auth[2]==4) $sql = "SELECT * FROM $table_news ORDER BY DATE DESC LIMIT ".$n_debut.", 7";
else $sql = "SELECT * FROM $table_news WHERE OK ='1' ORDER BY DATE DESC LIMIT ".$n_debut.", 5";
$resultat = mysql_query ($sql);
while ($news = mysql_fetch_array ($resultat))
{
$id = $news['ID'];
$date = date("j M Y @ H\hi", $news['DATE']);
$idpseudo = $news['IDPSEUDO'];
$titre = $news['TITRE'];
$texte = $news['TEXTE'];
$nb_comm = $news['NBCOMM'];
$nb_hit = $news['NBHIT'];
$ok = $news['OK'];
$sql = "SELECT * FROM $table_membres WHERE ID ='$idpseudo'";
$result = mysql_query ($sql);
$row=MYSQL_FETCH_ARRAY($result);
if($ok==1) {
if ($nb_comm > 1) $comments = 'comments';
else $comments = 'comment';
if ($nb_hit > 1) $hit = 'hits';
else $hit = 'hit';
if($auth[2]==4) $del = " [<a >edite</a>] [<a >del</a>]";
$texte=str_replace(":)", "<img src=\"images/smilie/smile.gif\" >", $texte);
$texte=str_replace(";)", "<img src=\"images/smilie/smile_wink.gif\" >", $texte);
$texte=str_replace(">:(", "<img src=\"images/smilie/smile_mad.gif\" >", $texte);
$texte=str_replace(":o", "<img src=\"images/smilie/smile_redface.gif\" >", $texte);
$texte=str_replace(":(", "<img src=\"images/smilie/smile_frown.gif\" >", $texte);
$texte=str_replace("8)", "<img src=\"images/smilie/smile_cool.gif\" >", $texte);
$texte=str_replace(":D", "<img src=\"images/smilie/smile_biggrin.gif\" >", $texte);
$texte=str_replace(":p", "<img src=\"images/smilie/smile_tongue.gif\" >", $texte);
$texte=str_replace(":eek:", "<img src=\"images/smilie/smile_eek.gif\" >", $texte);
$texte=str_replace(":confused:", "<img src=\"images/smilie/smile_confused.gif\" >", $texte);
$texte=str_replace(":!:", "<img src=\"images/smilie/icon_!.gif\" >", $texte);
$texte=str_replace(":?:", "<img src=\"images/smilie/icon_interogation.gif\" >", $texte);
$texte=str_replace(":list:", "<img src=\"images/smilie/icon_list.gif\" >", $texte);
$texte=str_replace(":fleche:", "<img src=\"images/smilie/icon_fleche.gif\" >", $texte);
$texte=str_replace(":lampe:", "<img src=\"images/smilie/icon_lampe.gif\" >", $texte);
$texte=str_replace(":+:", "<img src=\"images/smilie/icon_mainplus.gif\" >", $texte);
$texte=str_replace(":-:", "<img src=\"images/smilie/icon_mainmoin.gif\" >", $texte);
$sql2 = "SELECT * FROM $table_ligues WHERE OK ='1' ORDER BY NAME ASC";
$resultat2 = mysql_query($sql2);
while ($ligues2 = mysql_fetch_array($resultat2)) {
$texte=str_replace(" ".$ligues2['NAME'], " <a href='".$ligues2['SITE']."' target=_blank >".$ligues2['NAME']."</a>", $texte);
$texte=str_replace(" ".strtolower($ligues2['NAME']), " <a href='".$ligues2['SITE']."' target=_blank >".$ligues2['NAME']."</a>", $texte);
$texte=str_replace(" ".strtoupper($ligues2['NAME']), " <a href='".$ligues2['SITE']."' target=_blank >".$ligues2['NAME']."</a>", $texte);
}
$sql3 = "SELECT * FROM $table_clans WHERE OK ='1' ORDER BY TAG ASC";
$resultat3 = mysql_query($sql3);
while ($clan3 = mysql_fetch_array($resultat3)) {
$texte=str_replace(" ".$clan3['TAG'], " <a href='".$clan3['SITE']."' target=_blank >".$clan3['TAG']."</a>", $texte);
$texte=str_replace(" ".strtolower($clan3['TAG']), " <a href='".$clan3['SITE']."' target=_blank >".$clan3['TAG']."</a>", $texte);
$texte=str_replace(" ".strtoupper($clan3['TAG']), " <a href='".$clan3['SITE']."' target=_blank >".$clan3['TAG']."</a>", $texte);
}
echo "<div><div class=titre><b><img src=\"images/arrow.gif\" border=\"0\"> $titre</b></div>";
echo "$texte</b></i>";
echo "<p align=\"right\"><a href=mailto:$row[EMAIL]>$row[PSEUDO]</a> - $date - [<a href=javascript:MM_openBrWindow('news_comm.php3?idnews=$id','news','scrollbars=yes,width=330,height=500') >$nb_comm $comments/$nb_hit $hit</a>]$del ";
echo "</div><br>";
}
elseif($ok=='0' && $auth[2]=='4') {
if(strlen($titre)>20) $titre=substr($titre, 0, 20)."...";
echo "<div><b> - $titre</b> <a href=mailto:$row[EMAIL]>$row[PSEUDO]</a> - $date - [<a href=javascript:MM_openBrWindow('news_look.php3?idnews=$id','looknews','scrollbars=yes,width=600,height=420') >voire</a>] [<a href=\"?action=reacnews&idnews=$id\" >réafficher</a>]</div><br>";
}
}
if($auth[2]==4) $sql = "SELECT * FROM $table_news";
else $sql = "SELECT * FROM $table_news WHERE OK ='1'";
$resultat = mysql_query ($sql);
$nb_news = mysql_num_rows($resultat);
$nb_pages=ceil($nb_news/5);
if(!isset($np)) $np=1;
echo "<center>[ ";
for($i=1; $i<=$nb_pages; $i++) {
$nb_affiche=$nb_pages-$i+1;
if($np==$i) echo $nb_affiche." ";
else echo "<a href='?p=news&np=$i' >".$nb_affiche."</a> ";
}
echo "]</center>";
?> |
Partager