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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
<?php session_start(); import_request_variables('pG', 'p_'); if($p_name_post!="") { $name_post=trim($p_name_post); } if($p_web_name!="") { $web_name=trim($p_web_name); }
echo"<link href='../../ccs/style.css' rel='stylesheet' type='text/css'>"; if($_SESSION["web_name"]=="") $_SESSION["web_name"]=$web_name; if($_SESSION["name_post"]=="") $_SESSION["name_post"]="$name_post";
echo"<table width='97%' border='0' cellpadding='0' cellspacing='0' align=center><tr><td>"; echo "<fieldset><legend align=left><font color='green'>กระดานสนทนา</font></legend><br>"; include('../../../coremain/connec_out.php');
echo"<title>กระดานข่าว Webboard</title>";
import_request_variables('pG', 'p_'); if($p_re!="") { $re=trim($p_re); } if($p_evar!="") { $evar=trim($p_evar); } if($p_No!="") { $No=trim($p_No); } if($p_del!="") { $del=trim($p_del); } if($p_num!="") { $num=trim($p_num); } if($_SESSION['admin_web']=="admin"){ if($del=="1") { $sql1 = "DELETE FROM cms_webboard_data WHERE No='$num'"; $sql2 = "DELETE FROM cms_webboard_ans WHERE QuestionNo='$num'"; $result1=mysql_query($sql1); $result2=mysql_query($sql2); echo "<br><br><br><center>ประเด็นได้ถูกลบแล้ว<br><br>"; ?> <script language="JavaScript"> window.opener.location.href='../../../index.php?mod=move&path=move'; window.close(); </script> <? } if($del=="2") { // ตรวจสอบดูว่ามีกระทู้เท่าไหร่และลบออก 1 เสมอ $sql="SELECT Reply FROM `cms_webboard_data` WHERE No='$No'"; $data_ch=mysql_query($sql); $data=mysql_fetch_array($data_ch); $ch_k=$data[0]+0; if($ch_k>0){ $ch_=$ch_k-1; $sql="UPDATE `cms_webboard_data` SET `Reply` = '$ch_' WHERE No='$No'"; $data_ch=mysql_query($sql); } // ลบกระทู้ย่อย $sql = "DELETE FROM cms_webboard_ans WHERE No='$num'"; $result=mysql_query($sql); }
if($re=="0") { echo "<meta http-equiv='refresh' content='0; url='>" ; $re=1; } } echo"<center>"; // ติดต่อ database เพื่ออ่านข้อมูล $sql = "select * from cms_webboard_data where No='$No'"; $result = mysql_query($sql); $NRow = mysql_num_rows($result); if($NRow==0) { echo "Error"; exit(); } $row = mysql_fetch_array($result); // กำหนดค่าตัวแปร เพื่อนำไปแสดง $Question = ($row["Question"]); $Note = ($row["Note"]); $Name = $row["Name"]; $Member = $row["Member"]; $Email = $row["Email"]; $Date = $row["Date"]; $Image = $row["Image"];
// ตรวจสอบรูปแบบการแสดง IP Address switch ($showIP) { case "ALL" : $IP = "(".$row["IP"].")"; break; case "BAN" : $IP = "(".substr($row["IP"],0,strrpos($row["IP"],".")).".*)"; break; case "NONE": $IP = ""; break; default : $IP = $row["IP"]; }
if($Member) { $sql = "select * from webboard_member where User='$Name'"; $result = mysql_db_query($dbname,$sql); $NRow = mysql_num_rows($result); if($NRow==0) { echo "Error"; exit(); }
$row = mysql_fetch_array($result); // กำหนดค่าตัวแปร เพื่อนำไปแสดง $ICQ = $row["ICQ"]; $WebName = $row["WebName"]; $URL = $row["URL"]; }
// แสดงข้อมูลของประเด็น(กระทู้) //echo "<table width=60% border=1 bordercolor='$datatm[line_title_table]' cellspacing=0 cellpadding=5>"; echo "<table width=670 border=1 cellspacing=0 cellpadding=2 bordercolor='#000099'>\n"; echo "<tr bgcolor='#eeeeee'>\n"; echo "<td>"; if($_SESSION['admin_web']=="admin"){
echo"<a href='show.php?num=$No&del=1' onclick='return goURL1();'><img src='img/delete.gif' border=0></a> \n"; } echo "\t<font class=Menu1><b>$Question</b></font>\n"; echo "</td></tr>\n";
echo "<tr><td>\n"; echo "<br>\n"; echo "\t<table border=0 width=590 align=center>\n"; echo "\t<tr><td>\n";
echo "$Note"; echo "\t</td></tr>\n"; echo "\t</table>\n"; echo "<br>\n"; echo "</td></tr>\n";
echo "<tr><td>\n"; echo "\t<table border=0 align=center width=100% bgcolor='#eeeeee'>\n"; echo "\t<tr ><td align=left>\n"; echo "\t</td>\n"; echo "\t<td align=right>\n";
echo "\t\tโดยคุณ $Name $Email\n";
echo "\t\t$IP\n"; echo "\t\t[$Date]\n"; echo "\t</font></td></tr>\n"; echo "\t</table>\n";
echo "</td></tr>\n"; echo "</table>\n"; ?>
<br>
<? // ส่วนแสดงคำตอบของประเด็น(กระทู้) $sql = "select * from cms_webboard_ans where QuestionNo='$No' order by No desc"; $result = mysql_query($sql); $NRow = mysql_num_rows($result);
if($order=="ASC") $i = 1; else $i = $NRow;
if($result==0) { echo "<b>Error</b>"; exit(); }
// วนลูปแสดงข้อมูลที่อ่านได้ while ($row = mysql_fetch_array($result)) {
// กำหนดค่าตัวแปร เพื่อนำไปแสดง $QuestionNo = $row["No"]; $Name = $row["Name"]; $Member = $row["Member"]; $Email = $row["Email"]; $Msg = $row["Msg"]; $Date = $row["Date"]; $Image = $row["Image"]; // ตรวจสอบรูปแบบการแสดง IP Address switch ($showIP) { case "ALL" : $IP = "(".$row["IP"].")"; break; case "BAN" : $IP = "(".substr($row["IP"],0,strrpos($row["IP"],".")).".*)"; break; case "NONE": $IP = ""; break; default : $IP = $row["IP"]; }
echo "<table width=670 border=1 cellspacing=0 cellpadding=2>\n"; echo "<tr bgcolor='#ffffff'><td>\n";
echo "\t<table border=0 width=660>\n"; echo "\t<tr><td>\n"; echo "\t\t<font class=Menu face='MS Sans Serif'>\n";
if($_SESSION['admin_web']=="admin"){ echo "<a href='show.php?num=$QuestionNo&del=2&No=$No' onclick='return goURL2();'><img src='img/delete.gif' border=0></a>"; } echo "\t\tโดยคุณ <b>$Name</b> $Email\n";
echo "\t\t$IP\n"; echo "\t\t[$Date] ($i/$NRow)\n";
echo "\t\t</font>\n"; echo "\t</td>\n";
echo "\t<td align=right>\n"; if($Member){
if($ICQ) { echo "\t\t<img src=\"http://online.mirabilis.com/scripts/online.dll?icq=$ICQ&img=$ICQ_Image_Type"."online.gif\" alt='ICQ - $ICQ'>\n"; } } echo "\t</td>\n"; echo "\t</tr></table>\n";
echo "\t<table border=0 width=590 align=center>\n"; echo "\t<tr><td>\n";
echo "\t\t "; echo ($Msg); echo "\t</td></tr>\n"; echo "\t</table>\n";
echo "</td></tr>\n"; echo "</table><br>";
if($order=="ASC") $i++; else $i--; }
// ไม่ใช่กระเบื้องใหญ่ if($_SESSION[web_name]!="krabuangyai"){ echo"<form method=post action='../move/reply.php?No=$No' name='add' onsubmit='return checkadd()'>"; echo "<table width=670 border=1 cellspacing=0 cellpadding=2>\n"; echo "<tr bgcolor=$datatm[bg_list_table]>\n"; echo"<td align=center>"; echo" <font class=Menu1 color=000000><b>ขอเชิญร่วมตอบประเด็น</font></b>"; echo"</td></tr>"; echo"<tr><td><table border=0>"; echo"<tr>"; echo" <td align=right valign=top>ความคิดเห็น</td>"; echo" <td>"; include("../../../coremain/editor/fckeditor.php") ; $oFCKeditor = new FCKeditor('evar') ; $oFCKeditor->BasePath = '../../../coremain/editor/'; $oFCKeditor->Value = "$evar"; $oFCKeditor->Width = '456'; $oFCKeditor->Height = '250'; $oFCKeditor->Create() ; echo"</td>"; echo"</tr>"; echo"<tr>"; echo" <td>โดย</td>"; echo" <td><input size=74 type=text name='MsgBy' maxlength='100' value=''></td>"; echo"</tr>";
echo"<tr>"; echo" <td>อีเมล์</td>"; echo" <td><input type=text name='Email' maxlength=100 size='74' value='$_SESSION[name_email]'></td>"; echo"</tr>"; echo " <tr> "; echo " <td>รหัสลับ</td>"; echo " <td><img src='../../../coremain/module/webboard/login1_image.php' align='center' title='ป้อนตามที่เห็นในภาพ'></td>"; echo " </tr> ";
echo " <tr> "; echo " <td>ป้อนรหัสลับ</td>"; echo " <td><input name='from_pic'> <img src='../../../coremain/images/bu.gif' title='ป้อนรหัสลับตามที่ปรากฏ' onmouseover=this.style.cursor='hand'></td>"; echo " </tr> "; echo "</table>"; echo"</td></tr>"; echo" <td>"; echo"</tr>"; echo"</table>";
echo"<br>";
echo"<input type=submit value='ตอบประเด็น' name='submit' onmouseover=this.style.cursor='hand'>"; echo" <input type=button value=' ปิดหน้านี้ ' onclick='window.close()' name='submit' onmouseover=this.style.cursor='hand'> "; echo"</form>"; } // สำหรับกระเบื้องใหญ่ที่เป็น admin เท่านั้นที่ตอบกระทู้ได้ else{ if($_SESSION['admin_web']=="admin"){ echo"<form method=post action='../move/reply.php?No=$No' name='add' onsubmit='return checkadd()'>"; echo "<table width=670 border=1 cellspacing=0 cellpadding=2>\n"; echo "<tr bgcolor=$datatm[bg_list_table]>\n"; echo"<td align=center>"; echo" <font class=Menu1 color=000000><b>ขอเชิญร่วมตอบประเด็น</font></b>"; echo"</td></tr>"; echo"<tr><td><table border=0>"; echo"<tr>"; echo" <td align=right valign=top>ความคิดเห็น</td>"; echo" <td>"; include("../../../coremain/editor/fckeditor.php") ; $oFCKeditor = new FCKeditor('evar') ; $oFCKeditor->BasePath = '../../../coremain/editor/'; $oFCKeditor->Value = "$evar"; $oFCKeditor->Width = '456'; $oFCKeditor->Height = '250'; $oFCKeditor->Create() ; echo"</td>"; echo"</tr>"; echo"<tr>"; echo" <td>โดย</td>"; echo" <td><input size=74 type=text name='MsgBy' maxlength='100' value=''></td>"; echo"</tr>";
echo"<tr>"; echo" <td>อีเมล์</td>"; echo" <td><input type=text name='Email' maxlength=100 size='74' value='$_SESSION[name_email]'></td>"; echo"</tr>"; echo " <tr> "; echo " <td>รหัสลับ</td>"; echo " <td><img src='../../../coremain/module/move/login1_image.php' align='center' title='ป้อนตามที่เห็นในภาพ'></td>"; echo " </tr> ";
echo " <tr> "; echo " <td>ป้อนรหัสลับ</td>"; echo " <td><input name='from_pic'> <img src='../../../coremain/images/bu.gif' title='ป้อนรหัสลับตามที่ปรากฏ' onmouseover=this.style.cursor='hand'></td>"; echo " </tr> "; echo "</table>"; echo"</td></tr>"; echo" <td>"; echo"</tr>"; echo"</table>";
echo"<br>";
echo"<input type=submit value='ตอบประเด็น' name='submit' onmouseover=this.style.cursor='hand'>"; echo" <input type=button value=' ปิดหน้านี้ ' onclick='window.close()' name='submit' onmouseover=this.style.cursor='hand'> "; echo"</form>"; } }
mysql_close($handle_out);
?> <link href="../ccs/style.css" rel="stylesheet" type="text/css"></head>
<script language="javascript"> function checkadd() { if(document.add.from_pic.value=="") { alert("กรุณากรอก รหัสลับ!") ; document.add.from_pic.focus() ; return false ; }
else return true ; } </script>
<script language="JavaScript"> <!-- function goURL1() { var blnLink blnLink = confirm("Click OK เพื่อยืนยันการลบหัวข้อกระทู้ !") if (!blnLink) { return false; } return true; } <!-- function goURL2() { var blnLink blnLink = confirm("Click OK เพื่อยืนยันการลงคำตอบของกระทู้ !") if (!blnLink) { return false; } return true; } </script>
|