/home/banprang/domains/plai.go.th/public_html/coremain/module/gallery/gallery_output.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
<?php
// Status Package Module
$status_module=select_query("status_module","cms_status_module","id","18");
if(
$status_module[0]!=1)    {    
    
fieldset_no_module();
}
// Pession
if(id_top_permission("b")!=1){    
    
permission_fail();            
}

if (
$_SESSION['dbname'] != "nversion_62") {
  
$navig['gallery'] = "ภาพกิจกรรม";
  
$navig['gallery_add'] = "เพิ่มภาพกิจกรรม";
  
navigator($navig);
  echo 
"<br>";
  
bar_header("เพิ่มภาพกิจกรรม");
  
fieldset_top("ภาพกิจกรรม");
} else {
  
$navig['gallery'] = "ผลงานที่ผ่านมา";
  
navigator($navig);
  echo 
"<br>";
  
bar_header("เพิ่มผลงานที่ผ่านมา");
  
fieldset_top("ผลงานที่ผ่านมา");
}
//include_once("coremain/module/gallery/class.upload.php");
import_request_variables('pG''p_');
if(
$p_fulltexts!="")                                {        $fulltexts=trim($p_fulltexts);                    }
if(
$p_en_fulltexts!="")                                {        $en_fulltexts=trim($p_en_fulltexts);                    }
if(
$p_add_topic!="")                            {        $add_topic=trim($p_add_topic);            }
if(
$p_block!="")                                    {        $block=trim($p_block);                                 }
if(
$p_id_topic!="")                                {        $id_topic=trim($p_id_topic);                    }
if(
$p_upload_pic_ok!="")                    {        $upload_pic_ok=trim($p_upload_pic_ok);    }
if(
$p_upload_pic!="")                        {        $upload_pic=trim($p_upload_pic);                    }
if(
$p_explain!="")                                {         $explain=trim($p_explain);                                }
if(
$p_en_explain!="")                                {         $en_explain=trim($p_en_explain);                                }
if(
$p_check_upload!="")                    {         $check_upload=trim($p_check_upload);        }

if (
$add_topic == "1") {
//*******เพิ่มข้อมูลลงในฐาน*************************************************
// หาค่า id สูงสุด + 1
  
$sqlmax1 "select max(id_topic+1) from port_gallery_topic";
  
$resultmax1 mysql_query($sqlmax1);
  
$datamax1 mysql_fetch_row($resultmax1);
  if (
$datamax1[0] == "") {
    
$datamax1[0] = "1";
  }
  
$port_id $_SESSION[port][id];
  
$sql "INSERT INTO port_gallery_topic(id_topic,port_id,fulltexts,en_fulltexts,block,status) values('$datamax1[0]','$port_id','$fulltexts','$en_fulltexts','$block','1')";
  
$result mysql_query($sql) or die(mysql_error());
  echo 
"<center><br><br>ชื่อกิจกรรมได้ถูกบันทึกแล้ว<br><br>ขั้นตอนต่อไปให้เลือกรูปที่จะ Upload </center>";
  echo 
"<meta http-equiv='refresh' content='2; url=index.php?mod=gallery_output&path=gallery&id_topic=$datamax1[0]'>";
}

if (
$id_topic != "" && $check_upload == "") {
  
$sql="SELECT * FROM `port_gallery_topic`  WHERE  id_topic='$id_topic'"
  
$result=mysql_query($sql);
  
$data mysql_fetch_array($result);
?>
<!--<form  action='index.php?mod=gallery_output&path=gallery&id_topic=$id_topic' method='post' enctype='multipart/form-data' name='add' id='add' onSubmit='return checkadd()'>-->
<form id="fm_gallery" name="fm_gallery">
  <table width='98%' border='0' align='center' cellpadding='1' cellspacing='1'>
    <tr>
      <td colspan='2' align=center>
        <b><?= $data['fulltexts'?></b><br><br>
        
        <!--<input type="hidden" name="check_upload" value="1" />-->
        <input type="hidden" name="id_topic" value="<?= $id_topic ?>" />
      </td>
    </tr>
    <?php
      $option 
= array(
          
'title' => 'Upload รูป',
          
'description' => 'เลือกภาพกิจกรรม',
          
'file_type' => 'image',
          
'prefix' => 'pic',
          
'extraHTML' => array(
              
=> array('type' => 'input''text' => 'คำอธิบายรูป''name' => 'explain''style' => 'width: 100%;')
            )
      );
      
file_upload('userfile''gallery''fm_gallery''coremain/module/gallery/gallery_update_output.php'$option);
      
      
button_text('Upload รูป''submit'2'userfile''กรุณาเลือกรูปที่จะอัพโหลด !');
    
?>
  </table>
</form>
<?php
}
fieldset_down();
?>
<script language="javascript">
function checkadd() {
if(document.add.userfile1.value=="") {
alert("กรุณาเลือกรูปที่จะอัพโหลด") ;
document.add.userfile1.focus() ;
return false ;}
else 
return true ;
}
</script>