<?php
//Префикс таблицы с IPB
$prefix = ibf;
//Сколько тем выводить
$num = 10;
//Формат времени
$time = 'd.m H:i';
//Длина заголовка
$name_length = 200;
//Настройка коннекта к базе ФОРУМА
$dbhost = "localhost";
$dbname = "ИМЯ БАЗЫ";
$dbuser = "ПОЛЬЗОВАТЕЛЬ";
$dbpass = "ПАРОЛЬ";
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
mysql_query("SET NAMES 'cp1251';");
$ipb = mysql_query("SELECT * FROM
".$prefix."_topics
ORDER BY last_post DESC LIMIT $num");
while($row = mysql_fetch_array($ipb))
{
$title = $row['title'];
$as = $title;
if (strlen($title) > $name_length)
{
$title = substr($title, 0, $name_length - 3) . "...";
}
else
{
$title = $row['title'];
}
$last_poster_name = $row['last_poster_name'];
$id = $row['tid'];
$last_poster_id = $row['last_poster_id'];
$last_post = $row['last_post'];
$last_date = date($time,$last_post);
$description = $row['description'];
print"<b><a href='/forum/index.php?showtopic=$id'
title='$description'>$title</a></b><br/>
[ автор:
<a href='/forum/index.php?showuser=$last_poster_id'>
$last_poster_name</a>
- $last_date ]<br/><br/>";
}
?>