403Webshell
Server IP : 103.48.194.25  /  Your IP : 216.73.216.74
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 : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/hocthongminh.net-bk/public_html/site/components/sanpham/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hocthongminh.net-bk/public_html/site/components/sanpham/controllers/sanpham.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Sanpham extends MX_Controller 
{
	
	function __construct() 
	{
		parent::__construct(); 
		$this->load->helper('common') ;
		$this->load->model('sanpham_model','sanpham');
		//$this->load->library('breadcrumb');
		
		//$this->load->model('home_model','home');
		/*$this->load->model('payment_model','payment');
		$this->load->model('viewcart_model','viewcart'); 
		$this->load->model('customer_model','customer');*/
	}
	
	public function index($catid=1,$start=0)
	{
		$data['rs_cat'] = $rs_cat = $this->sanpham->get_detail_catid($catid);
		
		$display = 25;
		/*$config['base_url'] 	= site.'cua-hang/'.$catid;
		$data['num'] 			= $this->sanpham->count_list_product($catid);
		$config['total_rows'] 	= $data['num'];
		$config['per_page'] 	= $display;
		$config['uri_segment'] 	= 3;
		$config['num_links'] 	= 3;
		$this->pagination->initialize($config);
		$data['pagination'] 	= $this->pagination->create_links();*/
		
		$data['list_cat'] = $this->sanpham->get_hot_cat($display,$start,$catid);
		
		//$data['list_cate'] = $this->sanpham->get_category();
		
		$cfg = get_cauhinh();
		$data['metatitle'] 	= $cfg->site_title;
		$data['metadesc']	= strip_tags($cfg->site_des);
		$data['metakey'] 	= $cfg->site_keyword;
		$data['metaimg'] 	= '';	//$row->metatitle;
		$data['canonical'] 	= $rs_cat? site.'danh-muc/'.alias($rs_cat->cat_name).'-'.$rs_cat->catid.".html" : site."cua-hang.html";
		
		$data['title'] = 'Cửa hàng đồ gia dụng';
		$data['start'] = (int) $start;
		
		$data['page'] = "index" ;
		$this->load->view('skin', $data);
	
	}
	
	public function category($alias='',$start=0)
	{
		$catid = get_id_from_alias($alias);
		$data['rs_cat'] = $rs_cat = $this->sanpham->get_detail_catid($catid); 
		
		if(empty($rs_cat)) redirect();
		
		$display = 25;
		$config['base_url'] 	= site.'danh-muc/'.$alias;
		$data['num'] 			= $this->sanpham->count_product_category($catid);
		$config['total_rows'] 	= $data['num'];
		$config['per_page'] 	= $display;
		$config['uri_segment'] 	= 3;
		$config['num_links'] 	= 5;
		$this->pagination->initialize($config);
		$data['pagination'] 	= $this->pagination->create_links();
		
		$data['list'] = $this->sanpham->get_product_category($catid,$display,$start);
		//$data['list_banner'] = $this->sanpham->get_bn_category();
		//$data['list_cate'] = $this->sanpham->get_category();
		
		$data['metatitle'] 	= $rs_cat->metatitle? $rs_cat->metatitle : $rs_cat->cat_name;
		$data['metadesc']	= $rs_cat->metadesc? $rs_cat->metadesc : $data['metatitle'];
		$data['metakey'] 	= $rs_cat->metakey? $rs_cat->metakey : $data['metatitle'];
		$data['metaimg'] 	= urlimg.'category/'.$rs_cat->cat_image;
		$data['canonical'] 	= site.'danh-muc/'.alias($rs_cat->cat_name).'-'.$rs_cat->catid.".html";
		
		$data['start'] = (int) $start ; 
		
		$data['page'] = "category" ;
		$this->load->view('skin', $data);
	}	

	public function detail($alias='')
	{
		$proid = get_id_from_alias($alias); 
		$data['rs'] = $rs = $this->sanpham->get_id($proid) ;
		
		if(empty($rs))
		{
			$data['rs'] = $rs = $this->sanpham->get_product_random();
		}
		
		$data['title'] = $rs->pro_name ;
		$data['list_img'] = $this->sanpham->get_product_img($proid) ; 	//trit($data['list_img']);
		$data['rs_cat'] = $rs_cat = $this->sanpham->get_detail_catid($rs->catid) ;
		//$data['rs_fac'] = $rs_fac = $this->sanpham->get_factory_detail($rs->factory_id) ;
		
		//SEO
		$page = 0;
		$data['metatitle'] 	= $rs->metatitle? $rs->metatitle : $rs->pro_name;
		$data['metadesc']	= $rs->metadesc? strip_tags($rs->metadesc) : str_limit(strip_tags($rs->pro_desc),160);
		$data['metakey'] 	= $rs->metakey;
		$data['metaimg'] 	= urlimg."products/800/".$rs->proimg;
		$data['canonical'] 	= site."san-pham/".alias($rs->pro_name).'-'.$proid.".html";
		
		$data['list_pro'] = $this->sanpham->get_hot_product(10,0) ;
		$data['list_relate'] = $this->sanpham->get_list_product(20,0,$rs->catid);
		
		$data['product'] = map_product($rs);
		
		$this->sanpham->update_view($rs->proid);
		
		$data['page'] = 'detail';
		$this->load->view('skin',$data);
	}
	
	public function viewcart()
	{
		/*$ses_login = get_ses_login() ;
		if(!empty($ses_login)) redirect('profile/shopping') ;*/
	
		$data['cart'] = get_ses_cart(); //trit($data['cart']);
		
		
		$data['title'] = 'Xem đơn hàng' ;
		$data['page'] = 'sanpham/viewcart';
		$this->load->view('skin', $data);
	}
	
	public function thanhtoan()
	{
		$data['title'] = 'Thanh toán' ;
		
		$data['cart'] = get_ses_cart();
		
		$data['page'] = 'sanpham/thanhtoan';
		$this->load->view('skin', $data);
	}
	
	function sendcart()
	{
		//error_reporting(E_ALL);
		$ses_cart = get_ses_cart(); 
		if($ses_cart)
		{
			$cusid = 0;
			//Lay thong tin khách hàng
			$pass 	= $this->getRandomString(8) ;
			$req 	= $this->_frm_customer($pass);
			if($req['cusmail'])
			{
				$rs_cus = $this->sanpham->chkemail($req['cusmail']);
				if($rs_cus) 
					$cusid = $rs_cus->cusid ;
				else 
					$cusid = $this->sanpham->save('customer',$req);
			}
			
			// Lưu thông tin đơn hàng
			$req_cart 	= $this->_frm_cart($cusid); 
			$cartid 	= $this->sanpham->save("cart",$req_cart);
			
			// Đơn hàng chi tiết
			$items 	= $ses_cart['items'];
			$total 	= $ses_cart['total_price'];
			foreach($items as $cart):
				$req2 = $this->_frm_cart_detail($cusid,$cartid,$cart); 
				$this->sanpham->save_cart($req2);
			endforeach;
		
			//cập nhật total và code
			if($cartid)
			{
				$data_cart['cart_code'] = mk_code("DH",$cartid,6);
				$this->sanpham->save("cart",$data_cart,'cart_id',$cartid);
			}
	
			// goi mailo	
			$this->load->helper('mail');
			$data['total']   = $total;
			$data['cart_id'] = $cartid;
			$data['ses_product'] = $ses_cart['items'];
			$data['cusname'] = $this->input->post('cusname');
			$data['address'] = $this->input->post('address');
			$data['phone'] 	 = $this->input->post('phone');
			$data['email'] = $this->input->post('cusmail');
			
			$subject = 'Don hang tai '.domain;
			$content = $this->load->view("mail_to_customer",$data,true);
			
			if($data['cusmail']) sendmail($data['cusname'].'|'.$data['cusmail'],'','', $subject, $content);
			//sendmail("HuynhGia Trading|info@huynhgiatrading.com","",domain."|tritigi@gmail.com",$subject,$content);
			sendmail("May photocopy|ketoan@huynhgiatrading.com", "","Nguyen Trieu thang|sysdoanhnghiep@gmail.com", 'Dat hang tai huynhgiatrading.com', $content) ;
			
			$_SESSION['cart'] = array();
			redirect('dat-hang-thanh-cong');
			
			/*$payment_type = $this->input->post('payment_type');
			if($payment_type)
				redirect('thanh-cong/'.$payment_type.'/'.$data_cart['cart_code']);
			else
				redirect('thanh-cong/'.$payment_type.'/'.$data_cart['cart_code']);*/
		}
		else
			redirect();
	}
	
	function _frm_cart($cusid='')
	{
		$data['cusid'] 	 = $cusid ;
		$data['cusname'] = $this->input->post('cusname');
		$data['address'] = $this->input->post('address');
		$data['email']   = $this->input->post('cusmail');
		$data['phone']   = $this->input->post('phone');
		$data['cusnote'] = $this->input->post('note');
		
		/*$data['town_id'] = (int)$this->input->post('town_id');
		$data['district_id'] = (int)$this->input->post('district_id') ;
		$data['ward_id'] = (int)$this->input->post('ward_id') ;
		$data['area_id'] = (int)$this->input->post('area_id') ;*/
		
		$data['is_payment'] = 0;
		$data['is_delete'] 	= 0;
		$data['status'] 	= 1;
		
		$data['total'] = (float)$this->input->post('total_price');
		
		$data['dt_create'] = date('Y-m-d H:i:s');
		$data['dt_modify'] = date('Y-m-d H:i:s');
		
		return $data ;
	}
	
	function _frm_cart_detail($cusid,$cart_id,$cart)
	{
		$data['cusid'] 		= $cusid ;
		$data['cart_id'] 	= $cart_id ;
		
		$data['proid'] 		= $cart->id ;
		$data['pro_name'] 	= $cart->name ;
		$data['pro_img'] 	= $cart->image ;
		$data['pro_price'] 	= (float) $cart->price ;
		$data['nb_order'] 	= (int) $cart->quantity ;
		$data['subtotal'] 	= (float) $cart->quantity * to_number($cart->price) ;
		
		$data['dt_create'] 	= date('Y-m-d H:i:s') ;
		$data['dt_modify'] 	= date('Y-m-d H:i:s') ;
		$data['bl_active'] 	= 1 ;
		
		return $data ;
	}
	
	function _frm_customer($pass='')
	{
		$data['cuspass'] = md5($pass);
		$data['cusname'] = $this->input->post('cusname') ;
		$data['cusmail'] = trim($this->input->post('cusmail')) ;
		$data['address'] = $this->input->post('address') ;
		$data['cusphone'] = $this->input->post('phone') ;
		$data['town_id'] = $this->input->post('town_id') ;
		/*$data['district_id'] = $this->input->post('district_id') ;
		$data['ward_id'] = $this->input->post('ward_id') ;
		$data['area_id'] = $this->input->post('area_id') ;*/
		$data['dt_create'] = date('Y-m-d H:i:s') ;
		$data['bl_active'] = 1 ;
		
		return $data ;
	}
	
	function getRandomString($length = 6) 
	{
        $validCharacters = "abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ+-*#&@!?";
        $validCharNumber = strlen($validCharacters);
        $result = "";
        for ($i = 0; $i<$length; $i++) 
		{
            $index = mt_rand(0, $validCharNumber - 1);
            $result .= $validCharacters[$index];
        }
        return $result;
    }
	
	function thanhcong()
	{
		$data['title'] = 'Đặt hàng thành công' ;
		$data['cont'] = 'Cảm ơn bạn đã mua hàng tại website. Chúng tôi sẽ liên hệ trong thời gian sớm nhất';
		
		$data['page'] = 'sanpham/thanhcong';
		$this->load->view('skin_cart', $data);
	}
	
	function confirm($list_oid='')
	{
		if($list_oid)
		{
			$arr_oid = explode("-",$list_oid) ;
			foreach ($arr_oid as $oid):
				$data['status'] = 1 ;
				$oid = $this->sanpham->save('cart',$data,'cart_id',$oid);
			endforeach;
		}
		
		$data['title'] = 'Xác nhận đơn hàng thành công' ;
		$data['cont'] = 'Cảm ơn bạn đã mua hàng tại website. Chúng tôi sẽ liên hệ trong thời gian sớm nhất';
		$data['page'] = 'sanpham/thanhcong';
		$this->load->view('skin', $data);
	}
	
	public function search()
	{
		$data['title'] = 'Tìm kiếm' ;
		$keyword = $this->uri->segment(3) ;
		
		$data['start'] 			= (int) $this->uri->segment(4) ; 
		$config['base_url'] 	= base_url().'sanpham/search/'.(int)$this->uri->segment(3);  
		$data['num'] 			= $this->sanpham->count_search($keyword);
		$config['total_rows'] 	= $data['num'];
		$config['per_page'] 	= 20;
		$config['uri_segment'] 	= 4;
		$config['num_links'] 	= 3 ;
		$this->pagination->initialize($config);   
		$data['pagination'] 	= $this->pagination->create_links();
		
		$data['list'] = $this->sanpham->get_search($keyword, $config['per_page'],$data['start']);
		
		$data['page'] = 'home/product';
		$this->load->view('skin_product', $data);
	}
	
	function filter()
	{
		
	}
}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit