<?php require("forum/Settings.php"); //ใส่ path ของไฟล์ให้ถูกต้องที่อยู่ของบอร์ดครับ?>
<table width='100%' border='0' cellpadding='2' cellspacing='2' >
<?
$number = "8"; // amount of topic(s)
$board = "5,22"; //specify board, u can add board more than one such as 1,2,3,4,5 etc
$prefix1 = $db_prefix."topics";
$prefix2 = $db_prefix."messages";
$prefix3 = $db_prefix."members";
$prefix4 = $db_prefix. "attachments";
@mysql_connect($db_server,$db_user,$db_passwd) or die("sorry! now it can't connect the smf database");
$charset ="SET NAMES utf8";mysql_query($charset) //set language utf8 or tis620
or die('Invalid query: ' . mysql_error());
$sql = "select t.ID_TOPIC,t.ID_BOARD,t.ID_LAST_MSG,t.numReplies,t.numViews,m.ID_TOPIC,m.ID_BOARD,m.ID_MSG,m.subject,m.ID_MEMBER,m.posterTime,s.ID_MEMBER,IFNULL(s.realName, m.posterName) AS posterName,IFNULL(a.ID_ATTACH,0) AS ID_THUMB,a.ID_MSG
from $prefix1 AS t
LEFT JOIN $prefix2 AS m ON (t.ID_TOPIC=m.ID_TOPIC)
LEFT JOIN $prefix3 AS s ON (m.ID_MEMBER=s.ID_MEMBER)
LEFT JOIN $prefix4 AS a ON (m.ID_MSG=a.ID_MSG AND ID_THUMB = 0)
where t.ID_BOARD IN($board) GROUP BY t.ID_TOPIC order by t.ID_TOPIC DESC limit 0,$number";
$result = mysql_db_query($db_name,$sql);
$row = mysql_num_rows($result);
$i = 0;
while ($num = mysql_fetch_array($result)) {
$idtopic = $num["ID_TOPIC"];
$id_msg = $num["ID_MSG"];
$title = $num["subject"];
$id_last_msg = $num["ID_LAST_MSG"];
$numViews =$num["numViews"];
$reply = $num["numReplies"];
$id_thumb =$num["ID_THUMB"];
$id_poster =$num["ID_MEMBER"];
$poster =$num["posterName"];
$datepost =$num["posterTime"];
// picture front of topic
if(!empty($num['ID_MSG'])){
$avatar="<img src=\"".$boardurl."/index.php?action=dlattach;topic=".$idtopic.";attach=".$id_thumb.";image\" width='55' height='55' border='0'>";
}else {
$avatar="";
}
$today = date("d M Y");
$date =date("d",$num["posterTime"]);
$month = $thaiful_n[date ("m",$num["posterTime"]) -1];
$year=date("Y",$num["posterTime"]) +543;
$datepost =date("d M Y",$num["posterTime"]);
$stime =date("H:i:s",$num["posterTime"]);
//date post
if ($today==$datepost)
{
$time = date("<font color='#FF0000'>วันนี้, $stime</font>");
} else {
$time = date ("เมื่อวันที่ : $date $month $year, $stime");
}
if($datepost==$today){
$img_new="<img src=\"images/new_topic.gif\">"; //path picture new
}else {
$img_new="";
}
//show the content
if ($i % 2 == 0) echo("<tr>");
echo ("<td valign='top' align='center' width=''><table bgcolor='#F3F3F3' border='0' cellpadding='1' cellspacing='0' width='100%'><tr><td><table width='100%' border='0' cellpadding='1' cellspacing='0' bgcolor='#FFFFFF'><tr><td valign='top' ><a href='".$boardurl."/index.php?topic=".$idtopic.".msg".$id_msg.";topicseen#new'' target='_blank' >".$avatar."[/url]</td><td align='left'><a href='".$boardurl."/index.php?topic=".$idtopic.".msg".$id_msg.";topicseen#new'' target='_blank' >". $title."[/url] (ดู : ".$numViews."|ตอบ :".$reply." )".$img_new."
Last update by : <a href='".$b...
<table width='100%' border='0' cellpadding='2' cellspacing='2' >
<?
$number = "8"; // amount of topic(s)
$board = "5,22"; //specify board, u can add board more than one such as 1,2,3,4,5 etc
$prefix1 = $db_prefix."topics";
$prefix2 = $db_prefix."messages";
$prefix3 = $db_prefix."members";
$prefix4 = $db_prefix. "attachments";
@mysql_connect($db_server,$db_user,$db_passwd) or die("sorry! now it can't connect the smf database");
$charset ="SET NAMES utf8";mysql_query($charset) //set language utf8 or tis620
or die('Invalid query: ' . mysql_error());
$sql = "select t.ID_TOPIC,t.ID_BOARD,t.ID_LAST_MSG,t.numReplies,t.numViews,m.ID_TOPIC,m.ID_BOARD,m.ID_MSG,m.subject,m.ID_MEMBER,m.posterTime,s.ID_MEMBER,IFNULL(s.realName, m.posterName) AS posterName,IFNULL(a.ID_ATTACH,0) AS ID_THUMB,a.ID_MSG
from $prefix1 AS t
LEFT JOIN $prefix2 AS m ON (t.ID_TOPIC=m.ID_TOPIC)
LEFT JOIN $prefix3 AS s ON (m.ID_MEMBER=s.ID_MEMBER)
LEFT JOIN $prefix4 AS a ON (m.ID_MSG=a.ID_MSG AND ID_THUMB = 0)
where t.ID_BOARD IN($board) GROUP BY t.ID_TOPIC order by t.ID_TOPIC DESC limit 0,$number";
$result = mysql_db_query($db_name,$sql);
$row = mysql_num_rows($result);
$i = 0;
while ($num = mysql_fetch_array($result)) {
$idtopic = $num["ID_TOPIC"];
$id_msg = $num["ID_MSG"];
$title = $num["subject"];
$id_last_msg = $num["ID_LAST_MSG"];
$numViews =$num["numViews"];
$reply = $num["numReplies"];
$id_thumb =$num["ID_THUMB"];
$id_poster =$num["ID_MEMBER"];
$poster =$num["posterName"];
$datepost =$num["posterTime"];
// picture front of topic
if(!empty($num['ID_MSG'])){
$avatar="<img src=\"".$boardurl."/index.php?action=dlattach;topic=".$idtopic.";attach=".$id_thumb.";image\" width='55' height='55' border='0'>";
}else {
$avatar="";
}
$today = date("d M Y");
$date =date("d",$num["posterTime"]);
$month = $thaiful_n[date ("m",$num["posterTime"]) -1];
$year=date("Y",$num["posterTime"]) +543;
$datepost =date("d M Y",$num["posterTime"]);
$stime =date("H:i:s",$num["posterTime"]);
//date post
if ($today==$datepost)
{
$time = date("<font color='#FF0000'>วันนี้, $stime</font>");
} else {
$time = date ("เมื่อวันที่ : $date $month $year, $stime");
}
if($datepost==$today){
$img_new="<img src=\"images/new_topic.gif\">"; //path picture new
}else {
$img_new="";
}
//show the content
if ($i % 2 == 0) echo("<tr>");
echo ("<td valign='top' align='center' width=''><table bgcolor='#F3F3F3' border='0' cellpadding='1' cellspacing='0' width='100%'><tr><td><table width='100%' border='0' cellpadding='1' cellspacing='0' bgcolor='#FFFFFF'><tr><td valign='top' ><a href='".$boardurl."/index.php?topic=".$idtopic.".msg".$id_msg.";topicseen#new'' target='_blank' >".$avatar."[/url]</td><td align='left'><a href='".$boardurl."/index.php?topic=".$idtopic.".msg".$id_msg.";topicseen#new'' target='_blank' >". $title."[/url] (ดู : ".$numViews."|ตอบ :".$reply." )".$img_new."
Last update by : <a href='".$b...