| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/pundarikanail.com-bk/wadmin/controllers/ |
Upload File : |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Chinhsach extends MX_Controller
{
var $filename = '';
public function __construct()
{
parent::__construct();
$this->load->helper('file') ;
//$this->filename = ROOT_SITE.'cache/gioithieu.php';
/*$this->permit_library->check_permit();
$this->session->set_userdata(array('Url'=>uri_string())); */
}
function index()
{
$data['title'] = 'Giới thiệu';
$filename = ROOT_SITE.'cache/gioithieu.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/index');
}
else
{
$this->filename = ROOT_SITE.'cache/gioithieu.php';
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'chinhsach/edit';
$this->load->view("layout/skin",$data);
}
}
function vanchuyen()
{
$data['title'] = 'Thông tin vận chuyển';
$filename = ROOT_SITE.'cache/vanchuyen.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/vanchuyen');
}
else
{
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'edit';
$this->load->view("layout/skin",$data);
}
}
function thanhtoan()
{
$data['title'] = 'Thông tin vận chuyển';
$filename = ROOT_SITE.'cache/thanhtoan.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/thanhtoan');
}
else
{
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'edit';
$this->load->view("layout/skin",$data);
}
}
function dathang()
{
$data['title'] = 'Hướng dẫn đặt hàng';
$filename = ROOT_SITE.'cache/dathang.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/dathang');
}
else
{
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'edit';
$this->load->view("layout/skin",$data);
}
}
function faq()
{
$data['title'] = 'Câu hỏi thường gặp';
$filename = ROOT_SITE.'cache/faq.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/faq');
}
else
{
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'edit';
$this->load->view("layout/skin",$data);
}
}
function tuyendung()
{
$data['title'] = 'Thông tin tuyển dung';
$filename = ROOT_SITE.'cache/tuyendung.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/tuyendung');
}
else
{
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'edit';
$this->load->view("layout/skin",$data);
}
}
function hoptac()
{
$data['title'] = 'Thông tin hợp tác';
$filename = ROOT_SITE.'cache/hoptac.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/hoptac');
}
else
{
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'edit';
$this->load->view("layout/skin",$data);
}
}
function doitra()
{
$data['title'] = 'Chính sách đổi trả';
$filename = ROOT_SITE.'cache/doitra.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/doitra');
}
else
{
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'edit';
$this->load->view("layout/skin",$data);
}
}
function baohanh()
{
$data['title'] = 'Chính sách đổi trả';
$filename = ROOT_SITE.'cache/baohanh.php';
if(isset($_POST['bt_submit']))
{
$this->createfile($filename) ;
redirect('chinhsach/baohanh');
}
else
{
$json = read_file($filename);
$data['rs'] = $this->checkvalue($json);
$data['page'] = 'edit';
$this->load->view("layout/skin",$data);
}
}
function createfile($filename)
{
//upload hinh anh
$img = $this->input->post("lb_image");
if($img)
{
$img_name = get_img_name($img);
if(file_exists(ROOT_IMG.'chinhsach/'.$img_name))
{
unlink(ROOT_IMG.'chinhsach/'.$img_name);
}
//fn_resize_image(ROOT_IMG.$img,ROOT_IMG.'chinhsach/'.$img_name, 800, 940);
$this->resize(ROOT_IMG.$img,ROOT_IMG.'chinhsach/'.$img_name,800);
$data["lb_image"] = $img_name;
}
else $data['lb_image'] = "";
$data['lb_subject'] = $this->input->post('lb_subject');
$data['lb_content'] = $this->input->post('lb_content');
$data['bl_active'] = (int) $this->input->post('bl_active');
$str = json_encode($data);
write_file($filename, $str);
}
private function resize($src, $desc, $width)
{
$this->load->library('ResizeImg');
$this->resizeimg->load($src);
$this->resizeimg->resizeToWidth($width);
$this->resizeimg->save($desc);
}
private function checkvalue($json)
{
$rs = json_decode($json);
$obj = new stdClass();
$obj->lb_image = isset($rs->lb_image)? $rs->lb_image : '';
$obj->lb_subject = isset($rs->lb_subject)? $rs->lb_subject : '';
$obj->lb_content = isset($rs->lb_content)? $rs->lb_content : '';
$obj->bl_active = isset($rs->bl_active)? $rs->bl_active : 0;
return $obj;
}
}
?>