Server IP : 103.233.192.212 / Your IP : 3.144.103.205 Web Server : Apache/2 System : Linux sv1.inde.co.th 3.10.0-1160.36.2.el7.x86_64 #1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64 User : sumpatuan ( 1058) PHP Version : 5.5.38 Disable Function : symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,putenv,passthru,escapeshellarg,escapeshellcmd,pcntl_exec,proc_get_status,proc_nice,proc_terminate,pclose,ini_alter,virtual,openlog,ini_restore MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/sumpatuan/domains/sumpatuan.go.th/public_html/admin/top/action/ |
Upload File : |
<?php require_once('session_backend_administrator.php'); header('Content-Type: text/html; charset=UTF-8'); date_default_timezone_set("Asia/Bangkok"); $datetime = date('d/m/Y H.i'); //// function Transparency BG function setTransparency($new_image,$image_source){ $transparencyIndex = imagecolortransparent($image_source); $transparencyColor = array('red' => 255, 'green' => 255, 'blue' => 255); if ($transparencyIndex >= 0) { $transparencyColor = imagecolorsforindex($image_source, $transparencyIndex); } $transparencyIndex = imagecolorallocate($new_image, $transparencyColor['red'], $transparencyColor['green'], $transparencyColor['blue']); imagefill($new_image, 0, 0, $transparencyIndex); imagecolortransparent($new_image, $transparencyIndex); } if($STT_login=="admin_login_true"){ $total_filedoc = count($_FILES['uploadFile']['name']); if($total_filedoc==0){ echo "<SCRIPT type='text/javascript'> alert('กรุณาเลือกไฟล์ที่ต้องการอัพโหลด'); window.location.replace(document.referrer); </SCRIPT>"; exit; }else{ $id_tbdata_filedoc = $con_db_administrator->real_escape_string($_POST['id_data_filedoc']); $tbdata_filedoc = $con_db_administrator->real_escape_string($_POST['tb_data_filedoc']); $dt_addfile = date('YmdHis'); for($i=0;$i<$total_filedoc;$i++){ $filedoc = $_FILES["uploadFile"]["tmp_name"][$i]; $oldname_filedoc = trim($_FILES['uploadFile']['name'][$i]); $type_filedoc = pathinfo($_FILES['uploadFile']['name'][$i],PATHINFO_EXTENSION); $newname_filedoc = "FILET".$id_tbdata_filedoc."_".$dt_addfile."_".$i.".".$type_filedoc; $keep_filedoc = "../../../doc/t/"; $move_filedoc = $keep_filedoc.$newname_filedoc; $path_filedoc = "doc/t/".$newname_filedoc; $width=900; if( exif_imagetype($filedoc) == IMAGETYPE_JPEG ) { $size=GetimageSize($filedoc); if($size[0]>=$width){ $height=round($width*$size[1]/$size[0]); $filedoc_orig = ImageCreateFromJPEG($filedoc); $photoX = ImagesX($filedoc_orig); $photoY = ImagesY($filedoc_orig); $filedoc_fin = ImageCreateTrueColor($width, $height); setTransparency($filedoc_fin,$filedoc_orig); ImageCopyResampled($filedoc_fin, $filedoc_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY); ImageJPEG($filedoc_fin, $move_filedoc); ImageDestroy($filedoc_orig); ImageDestroy($filedoc_fin); }else{ move_uploaded_file($_FILES['uploadFile']['tmp_name'][$i],$move_filedoc); } }elseif( exif_imagetype($filedoc) == IMAGETYPE_PNG ){ $size=GetimageSize($filedoc); if($size[0]>=$width){ $height=round($width*$size[1]/$size[0]); $filedoc_orig = ImageCreateFromPNG($filedoc); $photoX = ImagesX($filedoc_orig); $photoY = ImagesY($filedoc_orig); $filedoc_fin = ImageCreateTrueColor($width, $height); setTransparency($filedoc_fin,$filedoc_orig); ImageCopyResampled($filedoc_fin, $filedoc_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY); imagepng($filedoc_fin, $move_filedoc); ImageDestroy($filedoc_orig); ImageDestroy($filedoc_fin); }else{ move_uploaded_file($_FILES['uploadFile']['tmp_name'][$i],$move_filedoc); } }elseif( exif_imagetype($filedoc) == IMAGETYPE_GIF ){ $size=GetimageSize($filedoc); if($size[0]>=$width){ $height=round($width*$size[1]/$size[0]); $filedoc_orig = ImageCreateFromGIF($filedoc); $photoX = ImagesX($filedoc_orig); $photoY = ImagesY($filedoc_orig); $filedoc_fin = ImageCreateTrueColor($width, $height); setTransparency($filedoc_fin,$filedoc_orig); ImageCopyResampled($filedoc_fin, $filedoc_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY); imagegif($filedoc_fin,$move_filedoc); ImageDestroy($filedoc_orig); ImageDestroy($filedoc_fin); }else{ move_uploaded_file($_FILES['uploadFile']['tmp_name'][$i],$move_filedoc); } }else{ move_uploaded_file($_FILES['uploadFile']['tmp_name'][$i],$move_filedoc); } $insert_filedoc = " INSERT INTO `data_filedoc_top`(`name_filedoc_top`, `type_filedoc_top`, `path_filedoc_top`, `id_tbdata_filedoc_top`, `tbdata_filedoc_top`) VALUES ('$oldname_filedoc', '$type_filedoc', '$path_filedoc', '$id_tbdata_filedoc', '$tbdata_filedoc') "; $action_filedoc = $con_db_administrator->query($insert_filedoc); if(!$action_filedoc){ echo "<SCRIPT type='text/javascript'> alert('เพิ่มข้อมูลไม่สำเร็จ กรุณาลองใหม่อีกครั้ง [insert_filedoc]'); window.location.replace(document.referrer); </SCRIPT>"; exit; } } echo "<SCRIPT type='text/javascript'> alert('เพิ่มข้อมูลใหม่ สำเร็จ'); window.location.replace(document.referrer); </SCRIPT>"; exit; } }else{ echo "<SCRIPT type='text/javascript'> alert('กรุณาเข้าสู่ระบบ'); window.location.replace('../../index'); </SCRIPT>"; exit; } mysqli_close($con_db_administrator); ?>