| 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/thegioimaycongnghiep.vn/public_html/webadmin/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ajax extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ajax_model','ajax');
$this->load->helper('img');
$this->load->helper('status');
}
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 getalias()
{
$name = $this->input->post('name');
echo strtolower($this->string_library->stringchange($name));
}
function uploader()
{
$proid = (int) $this->uri->segment(3);
$session_info = $this->session->userdata('session_id');
$size=$_FILES['uploadfile']['size'];
if($size>504857600)
{
echo "File_biger";
unlink($_FILES['uploadfile']['tmp_name']);
}
$extension = strtolower(pathinfo($_FILES['uploadfile']['name'], PATHINFO_EXTENSION));
$name = alias(pathinfo($_FILES['uploadfile']['name'], PATHINFO_FILENAME));
if($extension =='jpeg'){
$extension = 'jpg';
}
$datepath = create_dir();
$filename = $name.'-'.time().'.'.$extension;
$fullpath = ROOT_IMG.$datepath.$filename ;
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $fullpath))
{
if($filename!='')
{
//fn_resize_image('../uploads/images/'.$filename,'../uploads/products/200/'.$filename,600,600);
//fn_resize_image('../uploads/images/'.$filename,'../uploads/products/100/'.$filename,200,200);
$this->resize($fullpath,ROOT_IMG.'products/800/'.$filename,800);
$this->resize($fullpath,ROOT_IMG.'products/100/'.$filename,100);
}
$id_img = $this->ajax->add_img($filename, $proid, $extension, $session_info);
//$link = urlimg.$datepath.$filename;
echo $id_img.','.$filename;
} else {
echo 'Error';
}
}
function resize($src, $desc, $width)
{
$this->load->library('ResizeImg');
$this->resizeimg->load($src);
$this->resizeimg->resizeToWidth($width);
$this->resizeimg->save($desc);
}
}
?>