Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.77 KB | None | 0 0
  1. <?php
  2.     // How Many Topics you want to display?
  3.     $topicnumber = 7;
  4.     // Change this to your phpBB path
  5.     $urlPath = "/forums";
  6.  
  7.  
  8.     define( 'IN_PHPBB', TRUE );
  9.     $phpbb_root_path= defined( 'PHPBB_ROOT_PATH' )? PHPBB_ROOT_PATH: 'forums/';
  10.     $phpEx= substr( strrchr( __FILE__, '.' ), 1 );
  11.     include( $phpbb_root_path. 'common.'. $phpEx );
  12.     include( $phpbb_root_path. 'includes/functions_display.'. $phpEx );
  13.     include( $phpbb_root_path. 'includes/bbcode.'. $phpEx );
  14.  
  15.     // Database Configuration (Where your phpBB config.php file is located)
  16.     include 'forums/config.php';
  17.  
  18.     // Start session management
  19.     $user-> session_begin();
  20.     $auth-> acl( $user-> data );
  21.  
  22.     $table_topics = $table_prefix. "topics";
  23.     $table_forums = $table_prefix. "forums";
  24.     $table_posts = $table_prefix. "posts";
  25.     $table_users = $table_prefix. "users";
  26.     $link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
  27.     mysql_select_db("$dbname") or die("Could not select database");
  28.  
  29.     $query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.topic_replies, t.forum_id, p.bbcode_uid, p.bbcode_bitfield, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_id, p.post_text, p.icon_id, p.poster_id, p.post_time, u.group_id, u.user_id, u.username
  30.    FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
  31.    WHERE t.topic_id = p.topic_id AND
  32.    f.forum_id = t.forum_id AND
  33.    t.forum_id = 1 AND
  34.    u.group_id = 4 AND
  35.    p.icon_id = 8 AND
  36.    t.topic_status <> 2 AND
  37.    
  38.    p.poster_id = u.user_id
  39.    ORDER BY p.post_id DESC LIMIT $topicnumber";
  40.     $result = mysql_query($query) or die("Query failed");                                  
  41.  
  42.     while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  43.  
  44.     $post = censor_text(substr($row[post_text], 0, 400));
  45.  
  46.  /*       // Second parse bbcode
  47.         if( $row['bbcode_bitfield'] ) $bbcode-> bbcode_second_pass( $post, $row['bbcode_uid'], $row['bbcode_bitfield'] );
  48.  
  49.         // Parse smileys and convert linebreaks to HTML
  50.         $post= smiley_text( bbcode_nl2br( $post ) );
  51.  */
  52.  
  53.     echo "<div style=\"margin-bottom:30px;\">";
  54.     echo  "<h1>" . $row["topic_title"] . "</h1>
  55.     <div class=\"box\">
  56.     <div style=\"text-align:left; padding:3px; margin-top:3px; margin-bottom:5px;\"><em>Posted on " .
  57.     date('F j, Y, g:i a', $row["post_time"]) ." by <a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\" TARGET=\"_blank\">" . $row["username"] . "</a></em><br />" . $post . "</div><br /><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" TARGET=\"_blank\">Read More •</a> " . $row["topic_replies"] . " Comments</div></div>";
  58.  
  59.     }
  60.     mysql_free_result($result);
  61.     mysql_close($link);
  62.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement