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 :  D:/wamp/www/sipapbd_2017_sekolah/application/modules/pemda/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D:/wamp/www/sipapbd_2017_sekolah/application/modules/pemda/models/pemda_model.php
<?php

class Pemda_model extends CI_Model {

  var $field_pemda;
  var $data;

  function __construct()
  {
    // Call the Model constructor
    parent::__construct();

    $this->fieldmap_pemda = array(
      'nama' => 'NAMA_PEMDA',
      'lokasi' => 'LOKASI',
      'tingkat' => 'TINGKAT',
      'kode_pemda' => 'KODE_PEMDA',
      'kode_satker' => 'KODE_SATKER',
    );
  }

  function fill_data()
  {
    foreach($this->fieldmap_pemda as $key => $value){
      switch ($key){
        default : $$key = $this->input->post($key) ? $this->input->post($key) : NULL;
      }
      if(isset($$key))
        $this->data[$value] = $$key;
    }
  }

  function get_data_pemda()
  {
    $this->db->select('nama_pemda, lokasi, tingkat, logo, kode_pemda, kode_satker');
    $this->db->from('pemda');
    $result = $this->db->get()->row_array();

    return $result;
  }

  function update_data() {
    $logo_file = LOCAL_APP_DIR.'/'.APP_LOGO_PATH;

    try {
      if(!empty($_POST['image'])){
        $source = $this->real_path.$_POST['image'];
        if (!file_exists( $source )) throw new Exception("File logo tidak ditemukan.");
        if(!copy($source, $logo_file)){
          echo "Logo Gagal Dibuat";
          throw new Exception("File logo tidak bisa diproses.");
        }

        $handle=opendir($this->real_path);
        while (($file = readdir($handle))!==false) {
          chown($this->real_path.$file, 666);
          @unlink($this->real_path.$file);
        }
        closedir($handle);
      }
    }
    catch(Exception $e) {
      $this->last_error_message = $e->getMessage();
      return FALSE;
    }

    $this->fill_data();
    $this->db->trans_begin();
    $update = $this->db->update('pemda', $this->data);
    $dbh = $this->db->conn_id;

    try {
      if (file_exists($logo_file)) {
        $fd = fopen($logo_file, 'r');
        $blob = ibase_blob_import($dbh, $fd);
        fclose($fd);

        if (!is_string($blob)) {
          throw new Exception("File logo tidak bisa dibaca.");
        } else {
          $query = "UPDATE PEMDA SET LOGO = ?";
          $prepared = ibase_prepare($dbh, $query);
          if (!ibase_execute($prepared, $blob)) {
            throw new Exception("Gagal menyimpan Logo");
          }
        }
      }
    }
    catch(Exception $e) {
      $this->last_error_message = $e->getMessage();
      return FALSE;
    }

    if ($this->db->trans_status() === FALSE)
    {
      $this->last_error_id = $this->db->_error_number();
      $this->last_error_message = $this->db->_error_message();
      $this->db->trans_rollback();
      return FALSE;
    }

    $this->db->trans_commit();
    return TRUE;
  }

  function update_icon()
  {
    $this->db->trans_begin();
    try {
      $this->db->update('PEMDA', array('LOGO' => NULL));
    }
    catch(Exception $e){
      //TODO : log error to file
    }

    if ($this->db->trans_status() === FALSE)
    {
      $this->last_error_id = $this->db->_error_number();
      $this->last_error_message = $this->db->_error_message();
      $this->db->trans_rollback();
      return FALSE;
    }

    $this->db->trans_commit();
    return TRUE;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit