403Webshell
Server IP : 127.0.0.1  /  Your IP : 192.168.99.1
Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9
System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64
User : Administrator ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /wamp/www/sipapbd_2017_perubahan/application/modules/pemda/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /wamp/www/sipapbd_2017_perubahan/application/modules/pemda/controllers/pemda.php
<?php

class Pemda extends Admin_Controller {
  var $real_path;

  public function __construct()
  {
    parent::__construct();
    $this->load->helper('path');
    $this->real_path = dirname( realpath(SELF) )."/assets/img/temp/";
    $this->modul_name = 'pemda';
    $this->modul_display = 'Data Pemda';
    $this->view_form = 'pemda_form';
    $this->load->model('pemda_model', 'data_model');
  }

  public function index()
  {
    $data = array();
    $data['modul'] = $this->modul_name;
    $data['modul_display'] = $this->modul_display;
    $data['data'] = $this->data_model->get_data_pemda();
    $data['main_content'] = $this->view_form;
    $this->load->view('layout/template_admin', $data);
  }

  public function proses()
  {
    $response = (object) NULL;
    $success = $this->data_model->update_data();

    if($success){
      $response->isSuccess = TRUE;
      $response->logo_url = get_logo();
      $response->message = 'Data berhasil diperbaharui';
      $response->sql = $this->db->queries;
    }
    else
    {
      $response->isSuccess = FALSE;
      $response->logo_url = get_logo();
      $response->message = 'Data gagal diperbaharui';
      $response->error = $this->data_model->last_error_message;
      $response->sql = $this->db->queries;
    }

    echo json_encode($response);
  }

  function icon()
  {
    $response = (object) NULL;
    $logo_file = LOCAL_APP_DIR.'/'.APP_LOGO_PATH;

    if (file_exists($logo_file)) {
      unlink($logo_file);

      $success = $this->data_model->update_icon();
      if($success){
        $response->isSuccess = TRUE;
      }
      else
      {
        $response->isSuccess = FALSE;
        $response->error = $this->data_model->last_error_message;
        $response->sql = $this->db->queries;
      }
    }
    else{
      $response->isSuccess = TRUE;
    }
    echo json_encode($response);
  }

  function img_save_to_file()
  {
    $allowedExts = array("gif", "jpeg", "jpg", "png", "GIF", "JPEG", "JPG", "PNG");
    $temp = explode(".", $_FILES["img"]["name"]);
    $extension = end($temp);

    if (in_array($extension, $allowedExts))
    {
      if ($_FILES["img"]["error"] > 0)
      {
        $response = array(
          "status" => 'error',
          "message" => 'ERROR Return Code: '. $_FILES["img"]["error"],
        );
        echo "Return Code: " . $_FILES["img"]["error"] . "<br>";
      }
      else
      {

        $filename = $_FILES["img"]["tmp_name"];
        list($width, $height) = getimagesize( $filename );

        move_uploaded_file($filename,  $this->real_path . $_FILES["img"]["name"]);

        $response = array(
          "status" => 'success',
          "url" => base_url().'assets/img/temp/'.$_FILES["img"]["name"],
          "filename" => $_FILES["img"]["name"],
          "width" => $width,
          "height" => $height
        );
      }
    }
    else
    {
      $response = array(
        "status" => 'error',
        "message" => 'Format file tidak di dukung.',
      );
    }

    print json_encode($response);
  }

  function img_crop_to_file()
  {
    $imgUrl = $_POST['imgUrl'];
    $imgInitW = $_POST['imgInitW'];
    $imgInitH = $_POST['imgInitH'];
    $imgW = $_POST['imgW'];
    $imgH = $_POST['imgH'];
    $imgY1 = $_POST['imgY1'];
    $imgX1 = $_POST['imgX1'];
    $cropW = $_POST['cropW'];
    $cropH = $_POST['cropH'];
    $angle = $_POST['rotation'];

    $jpeg_quality = 100;

    $temp_name = "croppedImg_".rand();
    $output_filename = $this->real_path.$temp_name;

    $what = getimagesize($imgUrl);
    switch(strtolower($what['mime']))
    {
      case 'image/png':
        $img_r = imagecreatefrompng($imgUrl);
        $source_image = imagecreatefrompng($imgUrl);
        $type = '.png';
        break;
      case 'image/jpeg':
        $img_r = imagecreatefromjpeg($imgUrl);
        $source_image = imagecreatefromjpeg($imgUrl);
        $type = '.jpeg';
        break;
      case 'image/gif':
        $img_r = imagecreatefromgif($imgUrl);
        $source_image = imagecreatefromgif($imgUrl);
        $type = '.gif';
        break;
      default: die('image type not supported');
    }

    // resize the original image to size of editor
    $resizedImage = imagecreatetruecolor($imgW, $imgH);
    imagecopyresampled($resizedImage, $source_image, 0, 0, 0, 0, $imgW, $imgH, $imgInitW, $imgInitH);
    // rotate the rezized image
    $rotated_image = imagerotate($resizedImage, -$angle, 0);
    // find new width & height of rotated image
    $rotated_width = imagesx($rotated_image);
    $rotated_height = imagesy($rotated_image);
    // diff between rotated & original sizes
    $dx = $rotated_width - $imgW;
    $dy = $rotated_height - $imgH;
    // crop rotated image to fit into original rezized rectangle
    $cropped_rotated_image = imagecreatetruecolor($imgW, $imgH);
    imagecolortransparent($cropped_rotated_image, imagecolorallocate($cropped_rotated_image, 0, 0, 0));
    imagecopyresampled($cropped_rotated_image, $rotated_image, 0, 0, $dx / 2, $dy / 2, $imgW, $imgH, $imgW, $imgH);
    // crop image into selected area
    $final_image = imagecreatetruecolor($cropW, $cropH);
    imagecolortransparent($final_image, imagecolorallocate($final_image, 0, 0, 0));
    imagecopyresampled($final_image, $cropped_rotated_image, 0, 0, $imgX1, $imgY1, $cropW, $cropH, $cropW, $cropH);
    // finally output png image
    imagejpeg($final_image, $output_filename.$type, $jpeg_quality);
    $response = Array(
	    "status" => 'success',
	    "url" => base_url().'assets/img/temp/'.$temp_name.$type
    );

    print json_encode($response);
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit