1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
<? include("wb_header.php");?>
<?php include_once("config.php"); include_once("lib.php"); ?> <? $_SESSION['num']=1; ?> <div id="mtalk_area"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><span class="mTag"><br><u style='float:left; padding-right:10px;'><b>แสดงกระทู้จากหัวข้อ:</b></u> <? $sql="SELECT mtalk_category.cat_type, mtalk_category.cat_id, mtalk_category.cat_name, Count(mtalk_catused.cat_id) AS cc FROM mtalk_category LEFT JOIN mtalk_catused ON mtalk_category.cat_id = mtalk_catused.cat_id GROUP BY mtalk_category.cat_type, mtalk_category.cat_id, mtalk_category.cat_name ORDER BY mtalk_category.cat_type;"; $result=@mysql_query($sql); for ($i=0; $i<=mysql_num_rows($result)-1; $i++){ $tag=mysql_result($result,$i,2); $cid=mysql_result($result,$i,1); if (mysql_result($result,$i,3)>0) { echo "<a class='chk_item' href='?cat_id=$cid'>• $tag</a> \n"; }else{ echo "$tag "; } } ?> <span style="margin-left:15px;">• <a href='?cat_id='>แสดงทั้งหมด</a> </span> </span> <!-- <div id="box" style="margin:5px 0px 5px 0px"><div class="box-body"> <span><b>mTag</b></span> </div></div> --> </td> </tr> </table>
<div style="text-align:center; padding:10px; margin:20px"><a href="newtopic.php" class="new_item">ตั้งกระทู้ใหม่</a></div> <div id="title_cat"> <? $cat_name="รวมกระทู้ทั้งหมด"; if ($cat_id) { mysql_query("UPDATE mtalk_catused SET cat_count=cat_count+1 WHERE cat_id=$cat_id"); $res=@mysql_query("select cat_name,cat_description from mtalk_category where cat_id=$cat_id"); $cat_name=mysql_result($res,0,0); $cat_des=mysql_result($res,0,1); } ?> <h1 style="float:none; text-align:center; font-size:16px"><? echo $cat_name?></h1> <? //if ($cat_des) echo "<h2><font color=#999999>$cat_des</font></h2>\n"; ?> <h2><a href="index.php">หน้าหลัก</a> > <? if ($cat_id) echo $cat_name;?></h2> <br> </div> <div id="title"> <? if ($cat_id) $wh=" WHERE topic_category LIKE '%/$cat_id/%' "; if (!isset($start) OR ($start == "")) $start = 0 ; $sql="SELECT mtalk_topic.*, email, web, poster, post_time FROM mtalk_topic LEFT JOIN mtalk_post ON (mtalk_topic.topic_last_post_id = mtalk_post.post_id) AND (mtalk_topic.topic_id = mtalk_post.topic_id) $wh ORDER BY topic_time DESC LIMIT $start,$itemperpage;"; //$wh ORDER BY mtalk_post.post_time DESC LIMIT $start,$itemperpage;";
$query = mysql_query($sql); $nRow = @mysql_num_rows($query) or die("<span class=\"error\">No topic found!</span>");
for ($i=1; $i<=$nRow; $i++) { // for 1 $rs = mysql_fetch_array($query) or die("No topic found!"); $cont= "<a href=\"viewtopic.php?id=".$rs['topic_id']."\"><b>".$rs['topic_title']."</b></a>"; $ti=($rs['post_time'])? $rs['post_time'] : $rs['topic_time']; $email=trim($rs['email']); $poster = ($rs['poster']) ? "<a href=mailto:$email>".$rs['poster']."</a>" : $rs['poster']; $bt="» ตอบล่าสุดโดย $poster เมื่อ $ti | ตอบ: ".$rs['topic_replies'].", ชม: ".$rs['topic_views']. " |"; $tday=date("Y-m-d"); if ($tday==substr($ti,0,10)) { $dayS="วันนี้"; }else{ $dayS=substr($ti,0,10); } $bg=($bg=="title_bg0") ?"title_bg1" : "title_bg0"; ?> <div class="<? echo $bg?> title_list"> <div class="title_dt"><? echo $dayS?></div> <div class="title_t"><?php echo $cont?></div><div class="title_bt"><?php echo $bt?></div> </div> <? } //end for 1 ?>
</div><!--end div title -->
<div id='navigator'> <? $query_jumlah = mysql_query("SELECT count(*) FROM mtalk_topic $wh"); $data_jumlah = mysql_fetch_row($query_jumlah); $all_record = $data_jumlah[0];
$query = mysql_query("SELECT * FROM mtalk_topic ORDER BY topic_time DESC LIMIT $start,$itemperpage"); $this_page = @mysql_num_rows($query) or die("<span class=\"error\">No topic found!</span>");
$paging = generate_pagination("index.php?action=none", $all_record, $itemperpage, $start); if (!$paging == "") echo " | "; echo $paging; ?> </div> </div><!--end mtalk -->
<? include("wb_footer.php")?>
|