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
|
<?php session_start(); $_SESSION['Xcheck']=md5(uniqid(time())); ; //------------------------------------------------------------------------------------------------------ include('../phpconfig.php'); //--------------------------------------------------------------------------------------------------------------------------------------------------- $link = mysql_connect($cfgServers['host'],$cfgServers['stduser'],$cfgServers['stdpass'])or die("Can't connect Server"); mysql_select_db($cfgServers['selectdb']) or die("Can't connect databases"); //----------------------------------------------------------- if($_POST['action']=='topic'){ $query="DELETE FROM tbl_webboard_question WHERE id= '".$_GET['NID']."' "; mysql_query($query); $query="DELETE FROM tbl_webboard_ans WHERE Qid= '".$_GET['NID']."' "; mysql_query($query); ?> <script language="javascript"> alert("ลบกระทู้และคำตอบเรียบร้อยค่ะ"); window.close(); </script> <?php } if($_POST['action']=='ans'){ $query="DELETE FROM tbl_webboard_ans WHERE id='".$_POST['key']."' "; mysql_query($query); $query="UPDATE tbl_webboard_question SET ans = ans-1 WHERE id= '".$_GET['NID']."' "; mysql_query($query); }
//---------------------------------------------------------------- $query = "SELECT * FROM tbl_webboard_question WHERE id = '".$_GET['NID']."' "; $result = mysql_query($query); $data=mysql_fetch_assoc($result);
//-------------------------------------------------------------------- $query="SELECT * FROM tbl_webboard_ans WHERE Qid ='".$_GET['NID']."' ORDER BY id ASC "; $result = mysql_query($query); $number=mysql_num_rows($result); //---------------------------------------------------------------------- if($_POST['action2']=='login'){ $query="SELECT * FROM tbl_member_data WHERE user_email='".$_POST['email']."' AND user_password = '".$_POST['password']."' "; $resultLogin=mysql_query($query); $dataLogin =mysql_fetch_assoc($resultLogin); if($dataLogin['id']!=""){ $_SESSION['MemberID']=$dataLogin['id']; $_SESSION['MemberName']=$dataLogin['name_sname']; }else{ ?> <script language="javascript"> alert("email และ password ผิดพลาด กรุณาลองใหม่"); </script> <?php } }
?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="style.css" rel="stylesheet" type="text/css"> <title>Webboard</title><style type="text/css"> <!-- body { margin-left: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; background-color: #C9C9C9; } .style1 {color: #FFFFFF} --> </style></head> <script language="javascript"> function delBoard(dtype,BID){ if(confirm('ต้องการลบ ?')){ document.form1.action.value=dtype; document.form1.key.value=BID; document.form1.submit(); }else{ return false; } } </script> <body> <form action="<?php $PHP_SELF?>" method="post" name="form1"> <table width="961" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <input name="action" type="hidden"> <input name="BID" type="hidden" id="BID" value="<?php echo $BID?>"> <input name="key" type="hidden"></td> </tr> <tr> <td align="left" valign="top" class="LRTB20 txt-white" background="images/inside_02.jpg" ><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="txt10-black" > <tr> <td align="center" valign="top" ><br /> <table width="100%" border="0" class="radius5" bgcolor="#FFFFFF"> <tr> <td><span class="txt-h-ms"><img src="images/black_icon/16x16/notepad_2.png" alt="webboard" width="16" height="16" hspace="5" vspace="3" align="bottom" /></span></td> <td width="81%"><span class="txt-h-ms"><?php echo $data['question']?></span></td> <td width="15%" align="center" bgcolor="#FF0000" class="txt-white16"> <a href="#" onClick="delBoard('topic','<?php echo $_GET['NID']?>')"> <img src="images/black_icon/16x16/delete.png" alt="" width="16" height="16" style="border:none; padding-right:5px;" /><span class="txt-white16"> ลบกระทู้นี้ </span></a></td> </tr> <tr> <td colspan="3"><hr size="2" color="#009900" /></td> </tr> <tr> <td width="4%"> </td> <td height="53" colspan="2" valign="top"><span class="MS10-board"><?php echo $data['detail']?></span></td> </tr> <tr> <td height="26"> </td> <td colspan="2" align="right" bgcolor="#FEFBE7"><span class="fonts-11">ผู้ตั้งกระทู้ :: <?php echo $data['user']?> :: <?php GetThaiDate($data['post_date'])?> </span></td> </tr> </table> <br /></td> </tr> <?php if($number > 0){ $n=1; while($data=mysql_fetch_assoc($result)){ ?> <tr> <td valign="top"><table width="100%" border="0" class="radius5" bgcolor="#FFFFFF"> <tr> <td align="left"><span class="txt-h-ms"><img src="images/black_icon/16x16/user.png" alt="webboard" width="16" height="16" hspace="5" vspace="3" align="bottom" /></span></td> <td width="81%" align="left"><span class="txt-h-ms"><span class="font14-black-bold">ข้อคิดเห็นที่ <?php //echo $number-$n;?> <?php echo $n;?></span></span></td> <td width="15%" align="center" bgcolor="#FF6262" > <a href="#" onClick="delBoard('ans','<?php echo $data['id']?>')"> <img src="images/black_icon/16x16/delete.png" alt="" width="16" height="16" style="border:none; padding-right:5px;" /><strong><span class="txt-white16">ลบคำตอบนี้</span></strong></a></td> </tr> <tr> <td colspan="3"><hr size="1" color="#CC3300"/></td> </tr> <tr> <td width="4%"> </td> <td height="40" colspan="2" align="left" valign="top"><span class="fonts-11"><?php echo $data['answer']?></span></td> </tr> <tr> <td> </td> <td colspan="2" align="right" bgcolor="#FEFBE7"><span class="fonts-11">ผู้ตอบ <?php echo $data['post_by']?> :: <?php GetThaiDateTime($data['post_date'])?> </span></td> </tr> </table> <br /></td> </tr> <?php $n++; } } ?> <tr> <td align="center" valign="top"> </td> </tr> <tr> <td height="30" align="center" valign="middle" bgcolor="#FFFFFF" class="txt-white16"> <input name="action22" type="hidden" id="action22" /> <a href="#" onclick="window.close()"><img src="images/black_icon/16x16/cancel.png" alt="close" hspace="5" border="0" />ปิดหน้าต่างนี้</a></td> </tr> <tr> <td align="center" valign="top"> </td> </tr> </table> <br /></td> </tr> <tr> <td> </td> </tr> </table> </form> </body> </html><?php mysql_close($link)?>
|