db = $this->load->database('regional', true); $this->db = $this->load->database('onedev', true); } function is_exists($table, $field, $value) { $this->db->where($field,$value); $qry = $this->db->get($table); if (! $qry) { echo json_encode(array("status" => "ERR", "message" => "Cek exists $table $field $value". print_r($this->db->error(),true) )); exit; } if (! empty($qry->result_array())) { return true; } return false; } function download() { $this->decompress(); $md5 = $this->sys_input["md5"]; $param = $this->sys_input["param"]; $j_param = json_encode($param); $l_md5 = md5($j_param); if ($md5 != $l_md5 ) { echo json_encode(array("status" => "ERR", "message" => "MD5 $md5 <> $l_md5")); exit; } $mou = $param["mou"]; $sql = "INSERT INTO m_moudelete ( M_MouDeleteMouNumber, M_MouDeleteM_MouID, M_MouDeleteCreated ) VALUES( '{$mou['M_MouDeleteMouNumber']}', '{$mou['M_MouDeleteM_MouNewID']}', NOW() )"; $qry = $this->db->query($sql); if (! $qry ) { echo json_encode(array("status" => "ERR", "message" => "Insert Mou Delete : " . print_r($this->db->error(),true) )); exit; } echo json_encode( array("status" => "OK" , "message" => "" , "mouID" => $mou["M_MouID"])); } function decompress() { $zparam = file_get_contents("php://input"); $param = gzinflate($zparam); $this->sys_input = json_decode($param,true); } }