/home/bjcompany/domains/benjabhorn.com/public_html/benjabhorn_group/control/newsAdd.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
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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
<?php
        $monthArray 
= array("01"=>"มกราคม","02"=>"กุมภาพันธ์","03"=>"มีนาคม","04"=>"เมษายน""05"=>"พฤษภาคม","06"=>"มิถุนายน","07"=>"กรกฏาคม","08"=>"สิงหาคม","09"=>"กันยายน","10"=>"ตุลาคม","11"=>"พฤศจิกายน","12"=>"ธันวาคม");    
        
$currentDate=date("d");
        
$currentMonthdate("m");
        
$currentMonthnamedate("m");            
        
$currentYeardate("Y");    
            
//------------------------------------------------------------------------
                
if($_GET['currentID']){
                    
$_POST['currentID']=$_GET['currentID'];
            }
            
//-----------------------------Date------------------------------------
            
setlocale (LC_TIME'th');
            
            if(!
$sdate) { $sdatestrftime("%Y-%m-%d"); }else{ $sdate=$sdate; }
            
$time=strftime("%H:%M:%S");
            
$time_sec=explode(":",$time);
            
$time_array explode(":",$time);    
        
####################################################-DELETE Video
        
if($_POST['action2']=='DeleteClip'){
                 if(
file_exists($path_product."/".$_POST['RmPic'])){
                             @
unlink ($path_product."/".$_POST['RmPic']);
                 }
                   
$query="DELETE FROM tbl_act3_video WHERE id = '".$_POST['dataID']."' ";
                     
mysql_query($query);
        }
        
####################################################-DELETE IMAGEs FILE
            
if($_POST['action2']=='deletePic'){
                 if(
file_exists($path_product."/thb/".$_POST['RmPic'])){
                             @
unlink ($path_product."/thb/".$_POST['RmPic']);
                 }
                 if(
file_exists($path_product."/".$_POST['RmPic'])){
                             @
unlink ($path_product."/".$_POST['RmPic']);
                 }
                 
$query "DELETE FROM  tbl_act3_pic WHERE  pic_name = '".$_POST['RmPic']."' ";
                 
mysql_query($query);
            }
        
####################################################-DELETE DOCUMENT FILE
            
if($_POST['action2']=='deleteDoc'){
                 if(
file_exists($path_product."/".$_POST['RmPic'])){
                             @
unlink ($path_product."/".$_POST['RmPic']);
                 }
                 
$query "DELETE FROM  tbl_act3_doc WHERE  pic_name = '".$_POST['RmPic']."' ";
                 
mysql_query($query);
            }            
        
####################################################-ADD NEWS DATA
        
if($_POST['action']=='Add'){
                
$_POST['date_start'] = date("Y-m-d");
                if(
$_POST['currentID']==""){     
                    
                     
$_POST['product_name']=htmlspecialchars($_POST['product_name']);        
                     
$date_post     $_POST['checkInYear']."-".$_POST['checkInMonth']."-".$_POST['checkInDay'];
                    
$query "INSERT INTO `tbl_act3_data`  "
                    
."(`id` ,`topic` ,`topic_en` ,`detail` ,`detail_en` ,`date_post`, `cate_id`  ,`first_page` , `date_start` , `refer_from`) "
                    
."VALUES "
                    
." ('' , '".$_POST['product_name']."', '".$_POST['product_name_en']."', '".$_POST['detailth']."', '".$_POST['detail_en']."', '".$date_post."' ,'".$_POST['cate_id']."', '".$_POST['first_page']."'  ,'".$_POST['date_start']."' ,'".$_POST['refer_from']."' ) ";
                    
mysql_query($query);
                    
$_POST['currentID']= mysql_insert_id();
                    
                }else{
                        
$_POST['product_name']=htmlspecialchars($_POST['product_name']);    
              
$date_post     $_POST['checkInYear']."-".$_POST['checkInMonth']."-".$_POST['checkInDay'];
            
$query "UPDATE `tbl_act3_data` SET  "
                    
." `topic` ='".$_POST['product_name']."'  ,`topic_en` =  '".$_POST['product_name_en']."' "
                    
." ,`detail`='".$_POST['detailth']."' ,`detail_en`='".$_POST['detail_en']."' , `cate_id`= '".$_POST['cate_id']."'   ,`date_post` =  '"$date_post."'  "
                    
." ,`first_page`=  '".$_POST['first_page']."'  , `refer_from` ='".$_POST['refer_from']."' , `date_start` = '".$_POST['date_start']."'  WHERE id = '".$_POST['currentID']."'  ";  //selectCateID
            
mysql_query($query);
                    }
            }
        
####################################################-UPDATE NEWS DATA first_page
        
if($_POST['action']=='update'){
             
$_POST['product_name']=htmlspecialchars($_POST['product_name']);    
              
$date_post     $_POST['checkInYear']."-".$_POST['checkInMonth']."-".$_POST['checkInDay'];
            
$query "UPDATE `tbl_act3_data` SET  "
                    
." `topic` ='".$_POST['product_name']."'  ,`topic_en` =  '".$_POST['product_name_en']."' "
                    
." ,`detail`='".$_POST['detailth']."' ,`detail_en`='".$_POST['detail_en']."' , `cate_id`= '".$_POST['selectCateID']."'   ,`date_post` =  '"$date_post."'  "
                    
." , `refer_from` ='".$_POST['refer_from']."' , `date_start` = '".$_POST['sdate']."'  WHERE id = '".$_POST['currentID']."'  ";  //selectCateID
            
mysql_query($query);
        }
        
        
####################################################-ADD IMAGEs
        
if($_POST['action2']=='addpic'){        
                    if(
$_FILES['uploadfile']['name']!=""){
                     
$tempFileName $_FILES['uploadfile']['name'];
                    
GetNewFileName($_FILES['uploadfile']['tmp_name'],$_FILES['uploadfile']['name'],$i);
                    
move_uploaded_file($_FILES['uploadfile']['tmp_name'], $path_product.$_FILES['uploadfile']['name']);
                    
$query "INSERT INTO `tbl_act3_pic` "
                        
." (`id` ,`pic_name` ,`model_data_id`  ,`oldFilename`,`title_img` ) "
                        
." VALUES ('' , '".$_FILES['uploadfile']['name']."', '".$_POST['currentID']."' ,  '".$tempFileName."', '".$_POST['title_img']."') ";
                        
mysql_query($query);
                    }
        }    
        
####################################################-ADD DOCUMENT
        
if($_POST['action2']=='addDoc'){        
                    if(
$_FILES['uploadfile2']['name']!=""){
                     
$tempFileName $_FILES['uploadfile2']['name'];
                    
GetNewFileName($_FILES['uploadfile2']['tmp_name'],&$_FILES['uploadfile2']['name'],$i);
                    
move_uploaded_file($_FILES['uploadfile2']['tmp_name'], $path_product.$_FILES['uploadfile2']['name']);
                    
$query "INSERT INTO `tbl_act3_doc` "
                        
." (`id` ,`pic_name` ,`model_data_id`  ,`oldFilename`,`title_img` ) "
                        
." VALUES ('' , '".$_FILES['uploadfile2']['name']."', '".$_POST['currentID']."' ,  '".$tempFileName."', '".$_POST['title_img']."') ";
                        
mysql_query($query);
                    }
        }            
        
####################################################-Image Text        
        
if($_POST['action2']=='editText'){
                    
$query="UPDATE tbl_act3_pic SET title_img='".$_POST['title'][$_POST['dataID']]."' WHERE id = '".$_POST['dataID']."' ";
                    
mysql_query($query);
            }
        
###################################################    -ADD VIDEO & Youtube
        
if($_POST['action2']=='addclip'){    
                    
$errorCopy=0;
                            if(
$_FILES['uploadfile3']['name']!=""){
                                   
$fileSizefilesize($_FILES['uploadfile3']['tmp_name']);
                                           if(
$fileSize <  8192000){ 
                                            
$tempFileName $_FILES['uploadfile3']['name'];
                                            
GetNewFileName($_FILES['uploadfile3']['tmp_name'],&$_FILES['uploadfile3']['name'],$i);
                                            
move_uploaded_file($_FILES['uploadfile3']['tmp_name'], $path_product.$_FILES['uploadfile3']['name']);
                                         }else{
                                                   
$error="ขนาดของไฟล์เกิน 8เมกกะไบต์";
                                                
$errorCopy=1;
                                          }
                               }
                              
               if(
$errorCopy==0){ 
                             if(
$_POST['youtubeCode']!=''){
                                     
$_POST['youtubeCode']=ereg_replace("http://youtu.be/","",$_POST['youtubeCode']);
                             }
                     
$datePost=date("Y-m-d");
                             
$query="INSERT INTO  `tbl_act3_video`  "
                             
." (`id` ,`Title` ,`postBy` ,`UserID` ,`postDate` ,`postPoint` ,`postView` ,`cateID` ,`PostStatus`,`fileName` ,`youtubeCode` )"
                             
." VALUES "
                             
." ( '' ,  '".$_POST['Title']."',  '".$_POST['postBy']."',  '".$_POST['userID']."' ,  '".$datePost."',  '0',  '0',   '".$_POST['currentID']."',  '1'  ,  '".$_FILES['uploadfile3']['name']."',  '".$_POST['youtubeCode']."') ";
                            
mysql_query($query);
                  }
            
        }    
    
        
####################################################-SELECTD DATA
        
if($_POST['currentID']){
                
$query "SELECT * FROM tbl_act3_data WHERE id = '".$_POST['currentID']."' ";
                
$result mysql_query($query);
                
$currentData=mysql_fetch_assoc($result);
                
$cate_id  =$currentData['cate_id'];
                
$dateStartArray=explode("-",$currentData['date_start']);
                
$CurrArray=explode("-",$currentData['date_post']);
                        
$currentDate=$CurrArray[2];
                        
$currentMonth=$CurrArray[1];
                        
$currentYear$CurrArray[0];    
                
$query "SELECT * FROM `tbl_act3_pic` WHERE model_data_id = '".$_POST['currentID']."' ORDER BY id  ";
                
$resultPic mysql_query($query);
                
$query "SELECT * FROM `tbl_act3_doc` WHERE model_data_id = '".$_POST['currentID']."' ORDER BY id  ";
                
$resultDocmysql_query($query);            
                
                
$queryClip="SELECT * FROM tbl_act3_video WHERE cateID= '".$_POST['currentID']."'   ORDER BY id ASC   ";
                
$resultClip=mysql_query($queryClip);    

        }        
   
//---------------------------------------SELECT CATEGORY----------------------
   
$query="SELECT * FROM  tbl_act_category  ORDER BY id  ASC ";
   
$resultCategory=mysql_query($query);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="ajax.js"></script>
<script language="javascript">
                //--------------------------------        
            function  FormValid(){
                    if((document.form1.product_name.value=="")){
                                 alert("กรุณาใส่หัวข้อข่าวสาร ");
                                return false;
                    }else if(document.form1.cate_id.value=="-"){
                                 alert("กรุณาเลือกหมวดข่าวสาร ");
                                return false;                        
                   }else {     
                            document.form1.action.value = 'Add';
                        }
                }
        //-----------------------------------------------    
        function GetSubCate(MainCateID, SubCate){
                var str=Math.random();
                    var isNS4 = (navigator.appName=="Netscape")?1:0;
                    var mydata='MainCateID='+MainCateID+'&SubCate='+SubCate+'&str='+str;    
                     ajax = new sack('getSubCate.php');
                    ajax.element ="showSubCate";
                    ajax.runAJAX(mydata)
    }
    //-------------------------------------------------
    function removePic(pic){
        if(confirm('ต้องการลบรุปนี้')){
                document.form1.RmPic.value=pic;
                document.form1.action2.value='deletePic';
                document.form1.submit();
        }else{
                return false;
            }
    }
    //-------------------------------------------------
    function removeDoc(pic){
        if(confirm('ต้องการลบไฟล์นี้')){
                document.form1.RmPic.value=pic;
                document.form1.action2.value='deleteDoc';
                document.form1.submit();
        }else{
                return false;
            }
    }    
    //----------------------------------------
            function deleteThisClip(ids,filename){
                    if(confirm('ต้องการลบรายการนี้ ?')){
                                document.form1.action2.value='DeleteClip';
                                document.form1.dataID.value=ids;
                                document.form1.RemoveFile.value=filename;                            
                                document.form1.submit();                        
                        }else{
                               return false;
                            }
            }
</script>
</head>

<body>
<form action="<?php $_SERVER['PHP_SELF']?>" method="post" name="form1" onSubmit="return FormValid();" enctype="multipart/form-data">
    <table width="100%" border="0" cellspacing="3" cellpadding="3">
  <tr>
    <td class="txt10-black">
      <table width="100%" border="0" cellspacing="1" cellpadding="3">
     <tr>
          <td width="100%" align="left" bgcolor="#ECECD9"><!--<a href="main.php?work=articleList"><img src="images/black_icon/16x16/br_prev.png" width="16" height="16" hspace="5" border="0" align="absmiddle" />Back  </a> --> &nbsp;&nbsp;<img src="images/black_icon/16x16/sq_plus.png" width="16" height="16" hspace="5" border="0" align="absmiddle" />เพิ่มข่าวสาร</td>
          </tr>
     <tr>
       <td align="left">
       <!--8888888888888888888888888888 -->
       <form action="<?php $_SERVER['PHP_SELF']?>" method="post" name="form1" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
  <tr>
        <td class="txt10-black"><table width="100%" border="0" cellspacing="2" cellpadding="2">
          <tr>
            <td width="22%" height="4" align="right">ชื่อหัวข้อ</td>
            <td width="78%"><span >
              <input name="product_name" type="text" id="product_name" size="60" value="<?php echo $currentData['topic']?>" />
            </span></td>
          </tr>
          <tr>
            <td height="5" align="right">หมวดข่าวสาร</td>
            <td width="78%"><label for="cate_id"></label>
              <select name="cate_id" id="cate_id">
               <option value="-">--เลือกหมวดข่าวสาร--</option>
               <?php while($cate=mysql_fetch_assoc($resultCategory)){?>
                           <option value="<?php echo $cate['id']?><?php if($currentData['cate_id']==$cate['id']){ echo "selected";}?>><?php echo $cate['category_name']?></option>
               <?php }?>
            </select>
            
            </td>
          </tr>

          <tr>
            <td height="25" align="right">รายละเอียด</td>
            <td><span >
              <textarea name="detailth" cols="55" rows="15" id="detailth"><?php echo $currentData['detail']?></textarea><script language="javascript1.2">
              generate_wysiwyg('detailth');
        </script>
            </span></td>
          </tr>
           <tr>
            <td height="11" align="right">วันที่</td>
            <td><select name="checkInDay" id="checkInDay">
              <?php for($i=1;$i<=31;$i++){ 
                            if(
$i<10){ $i"0".$i;}    
                
?>
              <option value="<?php echo $i?><?php if($currentDate==$i) echo "selected";?>><?php echo $i?></option>
              <?php ?>
            </select>
-
<select name="checkInMonth" id="checkInMonth">
  <?php
        
if($_POST['stopMonth']){  $currentMonth=$_POST['stopMonth'];}
        
reset($monthArray); 
        while(
$month=each($monthArray)){ ?>
  <option value="<?php echo $month['key']?><?php if($currentMonth==$month['key']) echo "selected";?>><?php echo $month['value']?></option>
  <?php }?>
</select>
-
<?php  $startYear=2008;
  
$RangeYear=$currentYear$startYear;
  
$RangeYear =$RangeYear +1;
?>
<select name="checkInYear" id="checkInYear">
  <?php
  
  
if($_POST['stopYear']){ $currentYear=$_POST['stopYear']; }
   for(
$i=1;$i <= $RangeYear ;$i++){ ?>
  <option value="<?php echo $startYear+$i?>"<?php if($startYear+$i==$currentYear) echo "selected";?>><?php echo ($startYear+$i)+543?></option>
  <?php ?>
</select></td>
          </tr>
           <tr>
             <td height="12" align="right">แสดงข่าว</td>
             <td><label for="first_page"></label>
               <select name="first_page" id="first_page">
                 <option value="1" <?php if($currentData['first_page']=='1') echo "selected";?>>แสดงทันที</option>
                 <option value="0" <?php if($currentData['first_page']=='0') echo "selected";?>>ไม่แสดง</option>
             </select></td>
           </tr>
         <!-- <tr>
            <td height="25" align="right">ที่มา</td>
            <td><span class="txt-8-red">
              <input name="refer_from" type="text" id="refer_from" size="50" value="<?php echo $currentData['refer_from']?>"  />
            ใส่ http://</span></td>
          </tr> -->
          <tr>
            <td height="25" align="right"><span >
            <input type="hidden" name="currentID" value="<?php echo $_POST['currentID']?>"/>
            <input type="hidden" name="RmPic" />
            </span></td>
            <td><span >
              <?php if($_POST['currentID']){?>
              <input name="Submit" type="submit"  value=" แก้ไขข้อมูล " onclick="form1.action.value='update'" />
              <?php }else{ ?>
              <input name="Submit" type="submit"  value=" เพิ่ม " onclick="form1.action.value='Add'" />
              <?php ?>
              <input name="action" type="hidden" id="action" />
            </span></td>
          </tr>
          <tr>
            <td height="25" align="right">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="25" colspan="2" align="center"><?php if($_POST['currentID']){?>
              <table class="tableborder_full" height="138" cellspacing="0" cellpadding="0"  width="100%" border="0">
              <tbody>
                <tr>
                  <td 
          height="28" colspan="2" valign="top" nowrap="nowrap"  bgcolor="#DFDFDF" class="navbar_selected"><img src="images/black_icon/32x32/picture.png" width="32" height="32" hspace="3" vspace="3" align="absmiddle" />เพิ่มไฟล์รูปภาพ </td>
                </tr>
                <tr>
                  <td height="40" bgcolor="#f0f0f0" >&nbsp;</td>
                  <td align="left" bgcolor="#f0f0f0" ><span class="error">หากท่านต้องการเพิ่มไฟล์รูปภาพ / เอกสาร&nbsp; ทำได้โดยกดปุ่ม Browse เพื่อทำการเลือกไฟล์ภาพ / เอกสาร จากนั้นกดปุ่มเพิ่มรูปภาพ/ไฟล์&nbsp;&nbsp; โดยระบบสามารถเพิ่มไฟล์ได้ไม่จำกัด&nbsp; และรูปภาพควรมีขนาดไม่เกิน  กว้าง 800 สูง 600 pixel 
                    (รองรับไฟล์&nbsp; .jpg &nbsp; .gif &nbsp; ); ขนาดไฟล์ไม่เกิน 2 เมกกะไบต์</span></td>
                </tr>
                <tr>
                  <td width="19" height="50" bgcolor="#f0f0f0" ><label></label></td>
                  <td width="765" align="left" bgcolor="#f0f0f0" >เลือกไฟล์
                    <input name="uploadfile" type="file" id="uploadfile" />
                   
                   <!-- คำบรรยายรูปภาพ 
                    <input name="title_img" type="text" id="title_img" size="60" maxlength="100" />
                    <br /> -->
                      <input name="Button2" type="button" value=" เพิ่มรูปภาพ" onclick="document.form1.action2.value='addpic';document.form1.submit()" /></td>
                </tr>
                <tr>
                  <td height="5" bgcolor="#f0f0f0" ></td>
                  <td bgcolor="#f0f0f0" ></td>
                </tr>
                <tr>
                  <td height="5" colspan="2" align="left" bgcolor="#FFFFFF" ><!-- ////////////// -->
                      <table width="" border="0" cellpadding="0" cellspacing="0" bgcolor="">
                        <tr>
                          <td><?php if($_POST['currentID']){ ?>
                              <table width="" border="0" cellpadding="5" cellspacing="5">
                                <tr>
                                  <?php 
            $col
=2;$n=1;$xx=1;
            
$n_width=268;$n_height=185;
            
$n_width2=130;$n_height2=130;
            
$max_x =200;
            
$max_y =200;
                while(
$pic mysql_fetch_assoc($resultPic)){
                    
                           echo 
"<td bgcolor='#F8F8F8' nowarp height=25  align ='center' valign='bottom'> "
                        
                        
$info =  pathinfo($path_product."/".$pic['pic_name']);
                        
//echo $info[extension];
                        
$info[extension]=strtolower($info[extension]);
                        if((
$info[extension]=='pjpeg')  || ($info[extension]=='gif')  ||  ($info[extension]=='png')  ||  ($info[extension]=='x-png') || ($info[extension]=='jpeg') || ($info[extension]=='jpg')){
                                     if(!
file_exists($path_photo."/thb/".$path_product.$pic['pic_name'])){ 
                                        list(
$width$height$type$attr) = getimagesize($path_product.$pic['pic_name']);
                                        
create_thub($path_product."/",$pic['pic_name'],$n_width,$n_height);
                                        
create_thub2($path_product."/",$pic['pic_name'],$n_width2,$n_height2);
                                     }        
                                    echo 
"<a href='".$path_product."/".$pic['pic_name']."'  target='_blank'>";
                                    echo  
"<img src='".$path_product."/thb/".$pic['pic_name']."' border =0>";
                                    echo  
"</a>";
                                    echo 
"<br> "?>
                                      <!--<input type="text" size="30" name="title[<?php echo $pic['id']?>]" value="<?php echo $pic['title_img']?>" /><br />
                                      <input name="Ebidbt<?php echo $pic['id']?>" type="button" value="แก้ไข" onclick="editText('<?php echo $pic['id']?>')" /> -->
                                   <?php  echo "<br> ";
                        }else{
                                echo 
"<a href='".$path_product."/".$pic['pic_name']."'  target='_blank'>";
                                echo 
"<img src='images/PNG/folder.png'/><br>";
                                echo  
$pic['oldFilename'];    
                                echo  
"</a>";
                                echo 
"<br> ";
                                echo  
$pic['title_img'];
                                
//echo "<br> ";
                            
}
                            echo 
"<a href=# onclick=removePic('".$pic['pic_name']."'); >";
                            echo 
"<img src='images/black_icon/16x16/round_delete.png' border=0 align =absmiddle hspace='5' vspace='5' />&nbsp;ลบ";
                           echo 
"</a></td> ";
                    if(
$n==$col){ echo "</tr>\n"$n=0;};    
                     
$n++; $xx++;
                }
            
?>
                                </tr>
                            </table>
                      
                              <table width="" border="0" cellpadding="5" cellspacing="5">
                                <tr> </tr>
                            </table></td>
                        </tr>
                      </table>
                    <?php }?>
                      <!-- ////////////// -->                  </td>
                </tr>
                
              </tbody>
            </table>
            
              <br />
              <?php }?></td>
          </tr>
          
          
          
      </table></td>
  </tr>
              <?php if($_POST['currentID']){?>
                  </tr>
                <tr>
                  <td height="5" bgcolor="#f0f0f0" class="NAV_URL"></td>
                  <td bgcolor="#f0f0f0" class="NAV_URL"></td>
                </tr>
                <tr>
                  <td height="15" colspan="2" bgcolor="#FFFFFF" class="NAV_URL"><table width="99%" border="0" cellspacing="2" cellpadding="2">
                    <tr>
                      <td colspan="2" align="left" bgcolor="#DFDFDF"><span class="txt10-black"><img src="images/black_icon/32x32/movie.png" width="32" height="32" hspace="3" vspace="3" align="absmiddle" />เพิ่มไฟล์วีดีโอ youtube</span></td>
                    </tr>
                    <tr>
                      <td width="21%" align="right">
                        <input name="dataID" type="hidden" id="dataID" />
                        <input name="action2" type="hidden" id="action2" />
                        <input name="RemoveFile" type="hidden" id="RemoveFile"/>
                        <input name="page" type="hidden" id="page" /></td>
                      <td width="79%" align="left" class="txt-8-red"><input type="file" name="uploadfile3" id="uploadfile3" />
                        <br />
                      .flv , .swf  , .mp4  ขนาดไฟล์ไม่เกิน 8 เมกกะไบต์<br /></td>
                    </tr>
                    <tr>
                      <td align="right" class="txt10-black"><strong>ไฟล์ลิงค์ Youtube<br />
                      </strong></td>
                      <td align="left"><label>
                        <input name="youtubeCode" type="text" id="youtubeCode" value="" size="50" />
                      <a href="#" onclick="windowOpener(750, 750, 'abs', 'howtopostclip.php')">วิธีใช้งาน</a> </label></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td><input type="button" name="button2" id="button2" value="เพิ่มวีดีโอ" onclick="form1.action2.value='addclip';document.form1.submit()" /></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td align="left">&nbsp;</td>
                    </tr>
                  </table></td>
                  </tr>
                <tr>
                  <td height="5" bgcolor="#f0f0f0" class="NAV_URL"></td>
                  <td bgcolor="#f0f0f0" class="NAV_URL"></td>
                </tr>
                <tr>
                  <td height="25" colspan="2" bgcolor="#f0f0f0" class="NAV_URL"><table width="100%" border="0" align="center">
                    <tr>
                      <?php
               $n
=1;$col=2;$x=1;
            while(
$clip=mysql_fetch_assoc($resultClip)){ 
   
?>
                      <td><table width="190" border="0" cellspacing="2" cellpadding="0">
                        <tr>
                          <td width="200" align="center" bgcolor="#CCCCCC"><p>
                            <?php if($clip['youtubeCode']){ ?>
                            <iframe width="200" height="150" src="https://www.youtube.com/embed/<?php echo $clip['youtubeCode']?>" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
                            <?php }else if($clip['fileName']){             
                           
$info =  pathinfo($path_product."/".$clip['fileName']);
                        
$info[extension]=strtolower($info[extension]);
                        
$width="300";$height="200";
                        
//echo $info[extension];
                         
switch     ($info[extension]){
                              case 
"flv";
                                      include(
'showFlv.php');
                                    break;
                              case 
"swf";
                                      include(
'showSwf.php');                              
                                    break;
                             case 
"wmv";
                                      include(
'showWmv.php');                              
                                    break;
                             case 
"mp4";
                                      include(
'showMp4.php');                              
                                    break;                                    
                        }
                        
$x++;
           }
           
?>
                          </p></td>
                        </tr>
                        <tr>
                          <td align="center"><a href="#"  title="ลบ <?php echo $clip['Title']?>" onclick="deleteThisClip('<?php echo $clip['id']?>','<?php echo $clip['fileName']?>')"><img src="images/black_icon/16x16/trash.png" width="16" height="16" hspace="5" vspace="5" border="0" align="absmiddle" /><?php echo $clip['Title']?></a></td>
                        </tr>
                      </table></td>
                      <?php if($n==$col){ echo "</tr><tr>"$n=0;}?>
                      <?php $n++;}?>
                    </tr>
                  </table>
                  </td>
                  </tr>
                <tr>
                <?php }?>
</table>

       <!--//8888888888888888888888888888 -->      
       </td>
     </tr>
      </table></td>
  </tr>
  </table>
 
</form>
</body>
</html>