/home/bjcompany/domains/benjabhorn.com/public_html/BJconcrete/control/webboard_list.php


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
<?php 
    $rowPerPage
=30;
            if((!
$_GET['page'])||($_GET['page']==1)){
                        
$_GET['page']=1;
                        
$startRow=0;
            }else{
                    
$startRow=($_GET['page']-1)*$rowPerPage;
            }    
    
####################################################
          //------------------------------------
        
if($_GET['currID']){ $_POST['currID']=$_GET['currID'];}
        
//--------------------------------------------------------------------------


        
if($_POST['action']=='topic'){
                    
$query="DELETE FROM tbl_webboard_question  WHERE id='".$_POST['KEY']."'  ";
                    
mysql_query($query);
                    
$query="DELETE FROM tbl_webboard_ans  WHERE Qid='".$_POST['KEY']."'   ";
                    
mysql_query($query);
            }

        
//--------------------------------------------------------------------------
        
if($_POST['action']=="delete"){
            
$query="DELETE FROM tbl_category WHERE id='".$_POST['$KEY']."' ";
            
mysql_query($query);
        }
        
//--------------------------------------------------------------------------
        
$queryboard"SELECT * FROM `tbl_webboard_question`  ORDER BY  id DESC ";
    
//$queryboard= "SELECT * FROM `tbl_webboard_question`  ORDER BY  topic_type ASC  , id DESC ";    
   //    $queryboard= "SELECT * FROM `tbl_webboard_question`  ORDER BY   post_date DESC ";    
        
$queryboardLimit $queryboard." LIMIT  $startRow , $rowPerPage ";
        
$resultBoard mysql_query($queryboardLimit );
        
?>
<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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<form action="<?php $_SERVER['PHP_SELF']?>" method="post" name="form1" enctype="multipart/form-data">
<table width="99%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr class="red">
    <td width="4%" height="25" align="center" bgcolor="#D9D9B3"><img src="images/black_icon/16x16/app_window.png" width="16" height="16" /></td>
    <td width="96%" bgcolor="#D9D9B3">พูดคุยกับเรา
      <input type="hidden" name="action" id="action" />
          <input type="hidden" name="currID" id="currID" value="<?php echo $_POST['currID']?>" />
          <input type="hidden" name="RmPic" id="RmPic" />
      <input type="hidden" name="KEY" id="KEY" /></td>
  </tr>
  
  <tr>
    <td colspan="2" class="txt10-black"><table width="100%">
      <tbody>
        <tr  class="txt10-black">
          <th width="6%" height="30" align="center" bgcolor="#DDDDDD">กระทู้</th>
          <th width="49%" height="30" bgcolor="#DDDDDD">หัวข้อกระทู้</th>
          <th width="19%" height="30" bgcolor="#DDDDDD">โดย</th>
          <th width="19%" height="30" align="center" bgcolor="#DDDDDD">วันที่</th>
          <th width="7%" height="30" align="center" bgcolor="#DDDDDD">ลบ</th>
        </tr>
        <?php while($board=mysql_fetch_assoc($resultBoard)){  ?>
        <tr class="txt10-black">
          <td height="25" align="center" bgcolor="#E9E9E9"><img src="images/black_icon/16x16/notepad_2.png" alt="" width="16" height="16" /></td>
          <td bgcolor="#E9E9E9"><a href="#" onclick="windowOpener(700, 980, 'windowName', 'preview_board_admin.php?NID=<?php echo $board['id']?>')"> <?php echo $board['question']?></a></td>
          <td bgcolor="#E9E9E9"><?php echo $board['user']?></td>
          <td align="center" bgcolor="#E9E9E9"><?php GetThaiDateTime($board['post_date'])?></td>
          <td align="center" bgcolor="#E9E9E9"><input name="Submit22" type="button"  value=" ลบ " onClick="delBoard('topic','<?php echo $board['id'];?>')" /></td>
        </tr>
        <?php ?>
        <tr>
          <td align="center">&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="5" align="center" class="LRT10"><span class="txt10-black">หน้า
            <?php  $thisFile="main.php?work=webboard"PageDisplay($queryboard,$rowPerPage,$_GET['page'],$thisFile)?>
          </span></td>
        </tr>
      </tbody>
    </table></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
</table>
</form>