Server IP : 119.59.102.212 / Your IP : 3.149.249.184 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/public_html/coremain/module/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(); } check_status(); echo"<table width='98%' border='0' cellpadding='0' cellspacing='0'>"; echo" <tr >"; echo" <td><div class='c_header'>รูปภาพ</div></td>"; echo" </tr>"; echo" <tr>"; echo" <td><div class='c_body'>"; session_start(); //include("../../function.php"); //admin_web_activity("index.php"); echo"<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>"; include("../../../$_SESSION[webname]/connect.php"); echo "<title>แก้ไขรูปภาพ</title>"; $sqltm="select * from main_themes where status='1'"; $resulttm=mysql_query($sqltm); $datatm=mysql_fetch_array($resulttm); echo "<body bgcolor='$datatm[navigrator]'>"; import_request_variables('pG', 'p_'); if($p_update_pic!="") { $update_pic=trim($p_update_pic); } if($p_id_record!="") { $id_record=trim($p_id_record); } $userfile1_name=trim($_FILES['userfile1']['name']); if($p_explain!="") { $explain=trim($p_explain); } if($p_post_pic!="") { $post_pic=trim($p_post_pic); } if($p_id_update!="") { $id_update=trim($p_id_update); } if($p_g_type!="") { $g_type=trim($p_g_type); } if($p_yearthai1!="") { $yearthai1=trim($p_yearthai1); } if($userfile1_name!=""){ $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>"; include('coremain/fieldset_bottom.php'); include('coremain/footer.php'); exit; } } //************** ตรวจสอบว่า มีการ Upload File หรือไม************่ if($userfile1_name!="") { // กำหนดชื่อไฟล์ที่ upload ใหม่ ทั้งนี้เพื่อให้ ไฟล์ไม่ซ้ำกัน $str = "23456789abcdefghijkmnpqrstuvwxyz"; $pic = substr(str_shuffle($str), 0, 5); // ลบไฟล์เก่าออกก่อน $sql1="select pic from cms_gallery_record where id_record='$id_record'"; $result1=mysql_query($sql1); $data1=mysql_fetch_row($result1); if($data1[0]!="") { unlink("../../../$_SESSION[webname]/mainfile/gallery/pic/$data1[0]"); } // ชื่อไฟล์ $strings=substr($userfile1_name,-4); $name1="uppic$pic$strings"; $dlink="../../../$_SESSION[webname]/mainfile/gallery/pic/".$name1; $temp_name=$_FILES['userfile1']['tmp_name']; if (is_uploaded_file($_FILES['userfile1']['tmp_name'])) { if(!move_uploaded_file($temp_name,$dlink)){ } } } if($post_pic=="1"){ $sql="select pic from `cms_gallery_record` where id_record='$id_record'"; $result=mysql_query($sql); $data=mysql_fetch_row($result); if($userfile1_name=="") { $name1=$data[0]; } $sql="UPDATE `cms_gallery_record` SET `pic`='$name1', `explain` = '$explain' WHERE `id_record` ='$id_record'"; $result=mysql_query($sql); ?> <script language="JavaScript"> window.opener.location.href='../../../index.php?link1=gallery&id_record=<?echo $id_topic?>&link=gallery_update&g_type=<?echo $g_type?>&yearthai1=<?echo $yearthai1?>&id_update=<?echo $id_update?>'; window.close(); </script> <?php } echo "<fieldset><legend>แก้ไขรูปภาพ</legend>"; if($update_pic=="1") { $sql="SELECT * FROM `cms_gallery_record` WHERE id_record='$id_record'"; $result=mysql_query($sql); $data = mysql_fetch_array($result); echo "<form action='gallery_edit_pic.php?id_record=$id_record&id_update=$id_update&year_thai=$yearthai1&g_type=$g_type' method='post' enctype='multipart/form-data' name='add'>"; echo "<table width='540' border='0' align='center' cellpadding='1' cellspacing='3'>"; echo " <tr>"; echo " <td width=30%><div align='left'><strong>แก้ไขรูปภาพ</strong></div></td><td width=70%><div align='left'><input name='userfile1' type='file' size='35'> <img src='../../../coremain/image/bu.gif' border='0' title='รูปควรมีขนาดประมาณ 400*300 Pixel' onmouseover=this.style.cursor='hand'></td> "; echo " </tr>"; echo " <tr>"; echo " <td width=30%><div align='left'><strong>คำอธิบายรูป</strong></div></td><td width=70%><div align='left'><input name='explain' type='text' size='35' value=$data[explain]></td> "; echo " </tr>"; echo "<tr>"; echo " <td width=25%><div align='left'></div></td> "; echo "<INPUT TYPE='hidden' name='post_pic' value='1'>"; echo " <td width=70%><div align='left'> "; echo " <input type='submit' name='Submit' value=' แก้ไข ' onmouseover=this.style.cursor='hand'>"; echo " <input type='submit' name='Submit2' value='ปิดหน้านี้' onclick='window.close()'></td> "; echo "</tr>"; echo "</table>"; echo "</form> "; } echo" </div></td>"; echo" </tr>"; echo" <tr>"; echo" <td><div class='c_footer'></div></td>"; echo" </tr>"; echo "</table>"; ?>