Server IP : 119.59.102.212 / Your IP : 18.225.254.235 Web Server : Apache/2 System : Linux narin 2.6.32-042stab142.1 #1 SMP Tue Jan 28 23:44:17 MSK 2020 x86_64 User : yangkam ( 1022) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/yangkam/domains/yangkam.go.th/private_html/coremain/module/web/gallery/ |
Upload File : |
<?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(); } $navig['gallery']="ภาพกิจกรรม"; $navig['gallery_add']="เพิ่มภาพกิจกรรม"; 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]&link1=$link1'>" ; } // #################Upload Picture##################### $userfile1_name=trim($_FILES['userfile1']['name']); if($userfile1_name!="" and $id_topic!=""){ $strings1=substr($userfile1_name,-4); if($strings1!=".gif" and $strings1!=".jpg" and $strings1!=".GIF" and $strings1!=".JPG"){ echo"<center><br>ชนิดไฟล์ไม่ถูกต้อง <br>ไฟล์ต้องมีนามสกุลเป็น .gif หรือ .jpg เท่านั้น<br><br>"; echo"<a href='javascript:history.back()'><font color='ff0000'>[แก้ไขใหม่]</font></center></a>"; exit; } } //************** ตรวจสอบว่า มีการ Upload File ที่ 1 หรือไม************่ //einstein2 include_once("coremain/module/gallery/myfunction.php"); $filenow = $_FILES['userfile1']['size']; if(1){ if($userfile1_name!="" and $id_topic!="") { // กำหนดชื่อไฟล์ที่ upload ใหม่ ทั้งนี้เพื่อให้ ไฟล์ไม่ซ้ำกัน $str = "123456789abcdefghijkmnpqrstuvwxyz"; $pic1 = substr(str_shuffle($str), 0, 9); $strings=substr($userfile1_name,-4); $strings = strtolower($strings); $name1="pic$pic1$strings"; $dlink="$_SESSION[web_name]/".$name1; /* $temp_name=$_FILES['userfile1']['tmp_name']; if (is_uploaded_file($_FILES['userfile1']['tmp_name'])) { if(!move_uploaded_file($temp_name,$dlink)){ } }*/ $hup = new upload($_FILES['userfile1']); if($hup->uploaded){ $hup->image_resize = true; $hup->image_y = 400; $hup->image_x = 640; $hup->image_ratio = true; $hup->jpeg_quality = 95; $hup->image_ratio_no_zoom_in = true; $hup->file_new_name_body = "pic{$pic1}"; $hup->Process("$_SESSION[web_name]/gallery/"); if($hup->processed){ }else{ //echo 'failed'; } $hup->image_resize = true; $hup->image_y = 100; $hup->image_x = 150; $hup->image_ratio = true; $hup->jpeg_quality = 95; $hup->image_ratio_no_zoom_in = true; $hup->file_new_name_body = "pic{$pic1}"; $hup->Process("$_SESSION[web_name]/gallery/thumb/"); if($hup->processed){ //echo 'success2'; chmod("$_SESSION[web_name]/gallery/thumb/{$name1}",0777); }else{ echo 'failed'; } } } // ########### Add ข้อมูลลงใน Record ############ if($id_topic!="" and $userfile1_name!=""){ // หาค่า id สูงสุด + 1 $sqlmax1="select max(id_record+1) from port_gallery_record"; $resultmax1=mysql_query($sqlmax1); $datamax1=mysql_fetch_row($resultmax1); if ($datamax1[0]=="") { $datamax1[0]="1"; } $sql = "INSERT INTO port_gallery_record values('$datamax1[0]','$id_topic','$name1','$explain','$en_explain','1')"; $result = mysql_query($sql) or die(mysql_error()); if($upload_pic!=""){ echo "<center><br><br>รูปได้ถูกเพิ่มแล้ว<br><br></center>"; echo "<meta http-equiv='refresh' content='2; url=index.php?mod=gallery_output&path=gallery&id_topic=$id_topic'>" ; }else if($upload_pic_ok!=""){ echo "<center><br><br>กระบวนการได้เสร็จสมบูรณ์แล้ว<br><br></center>"; echo "<meta http-equiv='refresh' content='2; url=index.php?mod=gallery&path=gallery'>" ; } } }else{ echo '<center>'; echo '<font color="red">'; echo '<h3>ไม่สามารถ upload ไฟล์ได้!</h3>'; echo 'ไฟล์ที่ท่าน upload อยู่นี้มีขนาดไฟล์ '.number_format(($filenow/1048576),2).' MB<br/>'; echo 'ซึ่งเกินพื้นที่จัดเก็บของท่าน'; echo '</font>'; echo '<p>'; echo '<button onClick="javascript:window.history.go(-1)">เลือก upload ใหม่</button>'; echo '</p>'; echo '<center>'; } //end if($id_topic!="" and $check_upload==""){ echo"<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()'>"; echo"<table width='98%' border='0' align='center' cellpadding='1' cellspacing='1'>"; echo" <tr>"; echo" <td colspan='2' align=center><b>สามารถ Upload รูปได้ครั้งละ 1 รูป พร้อมคำอธิบาย<br>โดย Upload รูปได้ไม่จำกัดจำนวน</b><br><br></td> "; echo" </tr>"; echo" <tr>"; echo" <td width='30%' align=center><img src='coremain/images/marker.gif'> <strong>Upload รูป</strong></td> "; echo" <td><input name='userfile1' type='file' size='40'> <img src='coremain/images/bu.gif' border='0' title='รูปควรมีขนาดประมาณ 400*300 Pixel' onmouseover=this.style.cursor='hand'>"; echo" </td> "; echo" </tr>"; echo" <tr>"; echo" <td align=center><img src='coremain/images/marker.gif'> <strong> คำอธิบายรูป </strong></td> "; echo" <td><input name='explain' type='text' size='40' >"; echo "<INPUT TYPE='hidden' name='check_upload' value='1'>"; echo" </td> "; echo" </tr>"; echo"<tr> "; echo" <td colspan=2 align=center><br> "; echo"<input type='submit' name='upload_pic' value='Upload อื่นรูปต่อ' onmouseover=this.style.cursor='hand'> "; echo"<input type='submit' name='upload_pic_ok' value='Upload รูปเรียบร้อย' onmouseover=this.style.cursor='hand'> "; echo"</td>"; echo" </tr>"; echo "</table>"; echo "</form>"; } fieldset_down(); ?> <script language="javascript"> function checkadd() { if(document.add.userfile1.value=="") { alert("กรุณาเลือกรูปที่จะอัพโหลด") ; document.add.userfile1.focus() ; return false ;} else return true ; } </script>