Advertisement
Guest User

Untitled

a guest
Mar 10th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.41 KB | None | 0 0
  1. <?php
  2. include ("config.php");
  3.  
  4. $link = mysql_connect ($dbhost,$dbuser,$dbpasswd) or die ('Erreur : '.mysql_error() );
  5. mysql_select_db($dbname) or die ('Erreur :'.mysql_error());
  6.  
  7. $select = "SELECT topic_title,topic_id,topic_poster,forum_id,topic_last_poster_name,topic_last_post_time FROM phpbb_topics where forum_id !='37' ORDER BY topic_last_post_time DESC limit 3";
  8. $result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
  9.  
  10. while($row = mysql_fetch_array($result))
  11. {
  12. $topic_id = $row['topic_id'];
  13. $titre = $row['topic_title'];
  14. $posteur = $row['topic_last_poster_name'];
  15.  
  16.  ##########  Début format URL ##########
  17.   $annonce= $titre;
  18.    $annonce = preg_replace("`\[.*\]`U","",$annonce);
  19.    $annonce = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$annonce);
  20.    $annonce = htmlentities($annonce, ENT_COMPAT, 'UTF-8');
  21.    $annonce = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i","\\1", $annonce );
  22.    $annonce = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $annonce);
  23.    $annonce = ( $annonce == "" ) ? $type : strtolower(trim($annonce, '-'));
  24.  
  25.  ##########  Fin format URL ##########
  26.  
  27.   $titre_lien= (strlen($titre) > 32) ? substr($titre, 0,29).'...' : $titre;
  28.   echo '<a href="/forum/viewtopic.php?t='.$topic_id.'" target="_blank">'.ucfirst(strtolower($titre_lien)).'</a> - par '.$posteur.'<br>';
  29.     }
  30. mysql_free_result($result);
  31. mysql_close();
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement