<?php
include_once("Settings.php");
//$timeformatstring1 = "%B %d, %Y, %I:%M:%S %p";
$dbcon = mysql_connect($db_server,$db_user,$db_passwd);
mysql_select_db ($db_name);
if ($limit == null)
{
$limit = 10;
}
$lasttop = mysql_query("SELECT ID_TOPIC,subject,posterName,posterEmail,posterTime,ID_MEMBER FROM wdn_messages ORDER BY ID_MSG DESC LIMIT $limit ");
$thead = "<table cellpadding=2 cellspacing=2 border=0 width=100%>";
echo "document.writeln('$thead');";
for($i=0; $i<mysql_numrows($lasttop); $i++)
{
$tlist=mysql_fetch_array($lasttop);
$posttimestr = date("H:i",$tlist[posterTime]);
//$posttime = strftime($timeformatstring,$tlist[posterTime]);
//$posttimestr = substr($posttime,strrpos($posttime,",")+1,9);
$topicsel = mysql_query("SELECT ID_TOPIC,ID_BOARD FROM wdn_topics WHERE ID_TOPIC = $tlist[ID_TOPIC]");
$topicstr=mysql_fetch_array($topicsel);
$boardID = $topicstr[ID_BOARD];
$boardsel = mysql_query("SELECT ID_BOARD,name FROM wdn_boards WHERE ID_BOARD = $boardID");
$boardstr=mysql_fetch_array($boardsel);
$boardname = $boardstr[name];
$postername = rawurlencode($tlist[posterName]);
if ($tlist[ID_MEMBER]!= (-1)){
$temptr = "<tr><td valign=top bgcolor=#F5F5F5 width=30% align=left valign=top><a target=_blank target=_blank href=http://www.forum.bryansktalk.ru/index.php?board=$boardID><b>[$boardname]</b></a></td><td valign=top bgcolor=#F5F5F5 width=30%><a target=_blank target=_blank href=http://www.forum.bryansktalk.ru/index.php?board=$boardID;action=display;threadid=$tlist[ID_TOPIC];start=10000#lastpost>".substr($tlist[subject],0,25)."...</a></td><td valign=top bgcolor=#F5F5F5 width=20%>автор:<br> <a target=_blank href=http://www.forum.bryansktalk.ru/index.php?action=viewprofile;user=$postername>$tlist[posterName]</a></td><td valign=top bgcolor=#F5F5F5 width=35% align=right><b> в $posttimestr</b></td></tr>";
echo "document.writeln ('$temptr');";
} else {
if ($tlist[ID_MEMBER]= (-1))
$temptr = "<tr><td valign=top bgcolor=#F5F5F5 width=30% align=left valign=top><a target=_blank target=_blank href=http://www.forum.bryansktalk.ru/index.php?board=$boardID><b>[$boardname]</b></a></td><td valign=top bgcolor=#F5F5F5 width=30%><a target=_blank target=_blank href=http://www.forum.bryansktalk.ru/index.php?board=$boardID;action=display;threadid=$tlist[ID_TOPIC];start=10000#lastpost>$tlist[subject]</a></td><td valign=top bgcolor=#F5F5F5 width=20%>автор:<br> $tlist[posterName]</td><td valign=top bgcolor=#F5F5F5 width=35% align=right><b>Сегодня</b> в $posttimestr</td></tr>";
echo "document.writeln('$temptr');";
}
}
$tfoot = "</table>";
echo "document.writeln('$tfoot');";
mysql_close();
exit;
?>