c.klouchi
dimanche 8 janvier 2006 à 19:40
Bon comme j'étais en plein dedans
CODE
<?php
// on se connecte à MySQL
$db = mysql_connect('', '', '');
// on sélectionne la base
mysql_select_db('',$db);
$sql = "SELECT t.topic_id, t.topic_title, t.topic_replies, t.topic_last_post_id, f.forum_id, f.forum_name, p.post_time, u.user_id, u.username
FROM phpbb_topics AS t, phpbb_forums AS f, phpbb_posts AS p, phpbb_users AS u
WHERE t.forum_id = f.forum_id
AND f.auth_view < 3 AND f.auth_read < 3
AND t.topic_moved_id = 0
AND p.post_id = t.topic_last_post_id
AND u.user_id = p.poster_id
AND f.forum_id != 8
ORDER BY t.topic_last_post_id DESC
LIMIT 15";
if( !($result = mysql_query($sql)) )
{
echo '15 derniers posts.';
}
while( $ary = mysql_fetch_array($result) )
{
$xpostrow[] = $ary;
}
echo '<ul>';
for( $i = 0; $i < count($xpostrow); $i++ )
{
$topic_title = htmlspecialchars(stripslashes($xpostrow[$i]['topic_title']));
if( strlen($topic_title) > 20 )
{
$k = substr($topic_title, 0, 20);
$pos = strrpos($k, " ");
$k = substr($k, 0, $pos);
$topic_title = $k . "...";
}
echo '<li>
<a href="webmasters/viewtopic.php?p=' . $xpostrow[$i]['topic_last_post_id'] . '#' . $xpostrow[$i]['topic_last_post_id'] . '" rel="nofollow">
'. $topic_title .'</a>
</li>';
}
echo '</ul>';
?>
Attention j'ai mis du nofollow car je suis en url friendly alors j'espère que ça évitera le duplicate