Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.33 KB | None | 0 0
  1. <?php
  2.  
  3.  /*** phpBB3 - Last Active Topics System ***/
  4.         //Author: Ioan Filipov
  5.         //Email: jonidev@gmail.com
  6.         //Date: 04.06.2007
  7.         //------------------------------
  8.         //Edit these parameters:
  9.         //MySQL server adress
  10.         $host="localhost";
  11.         //Username
  12.         $user="...";
  13.         //Password
  14.         $pass="...";
  15.         //Database
  16.         $db="...";
  17.         //Table prefix
  18.         $table="phpbb_";
  19.         //Show last x topics
  20.         $laforums="15";
  21.         //post per page 10 is default
  22.         $posts_per_page = '10';
  23.  
  24.         $link=mysql_connect($host, $user, $pass);
  25.         $db=mysql_select_db($db);
  26.  
  27.     //to add excluded forum add "AND forum_id<>$id_to_the_forum" after "topic_approved = '1'" or AND forum_id=4 for only that forum
  28.         $query="select * from $table".topics."  WHERE topic_visibility = '1' AND forum_id<>20 order by topic_last_post_time desc limit 0,$laforums";
  29.         $query2="select config_name,config_value from $table".config." where config_name = 'server_name' limit 0,1";
  30.         $result2=mysql_query($query2);
  31.         $row2 = mysql_fetch_array($result2);
  32.         extract($row2);
  33.         $result=mysql_query($query);
  34.  
  35.   while ($row=mysql_fetch_array($result)) {
  36.         extract($row);
  37.         $topic_posts_sum = $topic_replies + 1;
  38.       $page_start_post = '0';
  39.       $counter = $posts_per_page;
  40.       do {
  41.          $page_start_post += $posts_per_page;
  42.          $counter += $posts_per_page;
  43.       } while ($counter < $topic_posts_sum);
  44.      
  45.         $date = date("d M Y", $topic_last_post_time );
  46.         $query3="select forum_name from $table".forums." WHERE forum_id = ".$forum_id."";
  47.         $result3=mysql_query($query3);
  48.         $row2 = mysql_fetch_array($result3);
  49.               if ($topic_posts_sum > $posts_per_page) {
  50.         echo "<a href='http://".$config_value."/forum/viewtopic.php?f=".$forum_id."&t=".$topic_id."&start=".$page_start_post."#p".$topic_last_post_id."' target='blank'><b>";
  51.       } else {
  52.          echo "<a href='http://".$config_value."/forum/viewtopic.php?f=".$forum_id."&t=".$topic_id."#p".$topic_last_post_id."' target='blank'><b>";
  53.       }
  54.       echo $topic_title."</b></a><BR><span class='smltxt'>views: ".$topic_views.", replies: ".$topic_replies."<BR>".$date."</span><br /><br>";
  55.         }
  56.  
  57. //-------------------------- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement