Files
BE_IBL/application/controllers/subcon/R_download_subcon.php
2026-04-15 15:23:57 +07:00

53 lines
1.6 KiB
PHP

<?php
class R_download_subcon extends MY_Controller {
function __construct()
{
parent::__construct();
$this->response = array("status" => "ERR", "message" => "");
}
function reply($compress = true) {
if ($compress) {
echo gzdeflate(json_encode($this->response));
exit;
}
echo json_encode($this->response);
}
function get_one_row($sql, $param = false)
{
list($status, $msg) = $this->get_rows($sql . " limit 0,1 ", $param);
if ($status == -1) return array($status, $msg);
if (count($msg) == 0) return array(0, array());
return array(1, $msg[0]);
}
function get_rows($sql, $param = false)
{
if ($param) {
$qry = $this->db->query($sql, $param);
} else {
$qry = $this->db->query($sql);
}
if (!$qry) {
return array(-1, $this->db->error()["message"] . "|" . $this->db->last_query());
}
return array(0, $qry->result_array());
}
function exec_query($sql, $param = false)
{
if ($param) {
$qry = $this->db->query($sql, $param);
} else {
$qry = $this->db->query($sql);
}
if (!$qry) {
return array(false, $this->db->error()["message"] . "|" . $this->db->last_query());
}
return array(true, "");
}
function get_param() {
return json_decode(file_get_contents("phpinput://"),true);
}
function index() {
$prm = $this->get_param();
print_r($prm);
}
}