| 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/galaxynail.com/wadmin/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Ajax extends MX_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ajax_model','ajax');
}
function orderlast()
{
$data['list'] = $this->ajax->get_last_order();
$this->load->view('ajax/orderlast',$data);
}
function transfer_notice_last()
{
$list = $this->ajax->get_transfer_notice_last();
$data['list'] = '
<table class="admindata">
<thead>
<th>Mã ĐH</th>
<th>Tài khoản</th>
<th>Xem</th>
</thead>
';
$k=1;
foreach($list as $rs):
$data['list'] .='
<tr class="row'.$k.'">
<td><a href="'.site_url('chonmua/chitietdonhang/'.$rs->CartID).'">'.$rs->CartID.'</a></td>
<td>'.$rs->LoginName.'</td>
<td><a href="'.site_url('chonmua/notice_detail/'.$rs->TransferID).'">Xem</td>
</tr>
';
$k=1-$k;
endforeach;
$data['list'] .='</table> ';
echo json_encode($data);
}
function thongke()
{
$this->load->view('ajax/thongke');
}
function publish()
{
$status = $this->input->post('status');
$id = $this->input->post('id');
$field = $this->input->post('field');
$table = $this->input->post('table');
if($status==0){
$pub = 1;
}else{
$pub = 0;
}
$this->ajax->setActiveDeactive($table,$field,$id,$pub);
echo icon_active("'$table'","'$field'",$id,$pub);
}
function set_onoff()
{
$table = $this->input->post('table');
$id_name = $this->input->post('id_name');
$id_value = (int) $this->input->post('id_value');
$field = $this->input->post('field');
$status = (int) $this->input->post('status');
if($status){
$pub = 0;
}else{
$pub = 1;
}
$data[$field] = $pub;
$this->ajax->save_onoff($table,$data,$id_value,$id_name);
echo icon_onoff("'$table'","'$id_name'",$id_value,"'$field'",$pub);
}
function getalias()
{
$name = $this->input->post('name');
echo alias($name);
}
//upload tour images
function uploader($catid=0)
{
//chmod($uploaddir,0777);
$size = $_FILES['uploadfile']['size'];
if($size>204857600)
{
echo "file_biger";
@unlink($_FILES['uploadfile']['tmp_name']);
//exit;
}
$filename = $_FILES['uploadfile']['name'];
$extension = end(explode(".", $filename));
$file_name = alias(str_replace($extension,'',$filename));
$extension = ($extension=='jpeg')? 'jpg' : $extension;
$filename = $file_name.'-'.date("dmY").'.'.$extension;
$date_path = create_dir();
$dir = ROOT_IMG.'images/'.$date_path;
$fullname = $dir.'/'.$filename ;
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $fullname))
{
//resize_image($fullname, 728, 512);
$id_img = $this->ajax->add_img($filename,$catid,$extension,$size,$date_path);
echo $id_img.'|'.$filename.'|'.$date_path;
}
else
{
@unlink($_FILES['uploadfile']['tmp_name']);
echo 'error';
}
}
}
?>