48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
class Rpt_img_background extends MY_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
function index() {}
|
|
function project_from_t_orderheader($id)
|
|
{
|
|
$sql = "";
|
|
$qry = $this->db->query($sql, [$id]);
|
|
if (!$qry) {
|
|
}
|
|
return 0;
|
|
}
|
|
function project($id, $code)
|
|
{
|
|
|
|
$img = APPPATH . "../../one-ui/BackgroundWesterindoPrimaya.png";
|
|
$referer = $this->input->server('HTTP_REFERER');
|
|
//di gunakan untuk mencari project berdasarkan code
|
|
//code ini di hardcode dari rpt untuk menentukan id itu jenis apa
|
|
switch ($code) {
|
|
|
|
default:
|
|
//T_OrderHeaderID
|
|
$project_id = $this->project_from_t_orderheader($id);
|
|
break;
|
|
}
|
|
// echo "img : $img";
|
|
// if (file_exists($img)) {
|
|
// echo " file exists";
|
|
// } else {
|
|
// echo " file not exists";
|
|
// }
|
|
if ($project_id == 0) {
|
|
$img = APPPATH . "../../one-ui/BackgroundWesterindoPrimaya.png";
|
|
}
|
|
file_put_contents("/xtmp/referer-rpt.log", "referer : $referer | code : $code |\n");
|
|
file_put_contents("/xtmp/referer-rpt.log", print_r($_SERVER, true), FILE_APPEND);
|
|
Header("Content-Type: image/png");
|
|
|
|
echo file_get_contents($img);
|
|
exit;
|
|
}
|
|
}
|