Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Path to forum and necessary initial vars
- define('IN_PHPBB', true);
- define('NO_KILL_ON_DB_ERROR',true);
- $phpEx = "php";
- $starttime = 0;
- $phpbb_root_path = "forum/";
- // Include common functions.
- include_once($phpbb_root_path . 'common.' . $phpEx);
- // Start session management.
- $user->session_begin();
- $user->setup('viewforum');
- // Require config for DB credentials.
- require("$phpbb_root_path" . "config.php");
- // Connect to database.
- $dbc = @mysql_connect($dbhost,$dbuser,$dbpasswd);
- // Error if connection could not be made.
- if (!$dbc) { echo " <p>Our forums are currently down. No recent news is available.</p>"; }
- else {
- // Grab 10 latest posts
- $db_selected = @mysql_select_db($dbname);
- $sql = 'SELECT topic_id,topic_title,topic_time,topic_first_poster_name,topic_replies,topic_first_post_id FROM `' . $table_prefix . 'topics` where `forum_id` = 2 ORDER BY `topic_id` DESC LIMIT 10';
- $result = @mysql_query("$sql");
- // Format posts in $allnews array
- while ($row = @mysql_fetch_array($result)) {
- $time = date("M j/y",$row[2]);
- $post_info = mysql_fetch_array(mysql_query("SELECT * FROM `{$table_prefix}posts` where `post_id` = {$row[5]}"));
- // The "7" flags on emoticons, BBCode, and magicURLs
- $post = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], 7);
- $comments = "<a href=\"http://rly.cc/forum/viewtopic.php?t={$row[0]}\">({$row[4]})</a> ";
- $allnews[$row[2]] = "
- <p>{$comments}<b>{$time} by {$row[3]}:</b> {$post} {$commentline}";
- }
- // Close that DB!
- @mysql_close($dbc);
- // Output our news!
- foreach ($allnews as $i => $data) echo $data;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement