%PDF-1.4 404 Not Found
Sh3ll



Directory :  /var/www/vhosts/lautnusantara.com/httpdocs/web/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Current File : /var/www/vhosts/lautnusantara.com/httpdocs/web/app/Models/Dataclient_Model.php
<?php
namespace App\Models;
use CodeIgniter\Model;

class Dataclient_Model extends Model
{
	protected $table = "ssn_ip_client"; 
	
	public function get_client_ip_browser($dari=false,$ip_x=false,$agent) {
		
		$request = \config\Services::request();
		//----- get ip client ------
		$ipaddress = $request->getIPAddress();
		
		if (! $request->isValidIP($ipaddress)) {
			$ipaddress = 'IP tidak dikenali';
		} 
		
		//$request->getEnv('some_data');
		
		// if (getenv('HTTP_CLIENT_IP'))
			// $ipaddress = getenv('HTTP_CLIENT_IP');
		// else if(getenv('HTTP_X_FORWARDED_FOR'))
			// $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
		// else if(getenv('HTTP_X_FORWARDED'))
			// $ipaddress = getenv('HTTP_X_FORWARDED');
		// else if(getenv('HTTP_FORWARDED_FOR'))
			// $ipaddress = getenv('HTTP_FORWARDED_FOR');
		// else if(getenv('HTTP_FORWARDED'))
		   // $ipaddress = getenv('HTTP_FORWARDED'); 
		// else if(getenv('REMOTE_ADDR'))
			// $ipaddress = getenv('REMOTE_ADDR');
		// else
			// $ipaddress = 'IP tidak dikenali';
		
		 
		//----- get client browser ------
		
		//$agent = $this->request->getUserAgent();

		if ($agent->isBrowser()) {
			$currentAgent = $agent->getBrowser() . ' ' . $agent->getVersion();
		} elseif ($agent->isRobot()) {
			$currentAgent = $agent->getRobot();
		} elseif ($agent->isMobile()) {
			$currentAgent = $agent->getMobile();
		} else {
			$currentAgent = 'Unidentified User Agent';
		}
		
		$browser = $currentAgent;
		$os_client = $agent->getPlatform(); // Platform info (Windows, Linux, Mac, etc.)
		
		// $browser = '';
		// if(strpos($_SERVER['HTTP_USER_AGENT'], 'Netscape'))
			// $browser = 'Netscape';
		// else if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox'))
			// $browser = 'Firefox';
		// else if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome'))
			// $browser = 'Chrome';
		// else if (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera'))
			// $browser = 'Opera';
		// else if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
			// $browser = 'Internet Explorer';
		// else
			// $browser = 'Other';
		
		
		if($dari==false){
			$dari = "Home";
		}
		if($ip_x==false){
			$ip_x = ".120"; 
		}
		 
		//------ simpan data -------
		
		$tgl_jam=date('Y-m-d H:i:s'); //2002-12-20 12:02:00
		$jam=substr($tgl_jam,0,13);

		// $this->db->select('*');
		// $this->db->from('ssn_ip_client');
		// $this->db->where('TIME_TO_SEC(TIMEDIFF("'.$tgl_jam.'",jam))/60<=',30);
		// $this->db->where('ip_client',$ipaddress.$ip_x);  
		// $this->db->where('browser',$browser);
		// $result=$this->db->get()->row();
		
		$builder = $this->db->table('ssn_ip_client');
		$builder->select('*');
		$builder->where('TIME_TO_SEC(TIMEDIFF("'.$tgl_jam.'",jam))/60<=',30);
		$builder->where('ip_client',$ipaddress.$ip_x); 
		$builder->where('browser',$browser);
		
		$result=$builder->get()->getResult();
		
	   if ($result == null){
			$data = array( 
				// 'jam' 		=> datenow(),
				'browser' 	=> $browser,
				'ip_client'  => $ipaddress.$ip_x,
				'dari'		=> $dari,
				'os_client' 	=> $os_client,
				// 'created' 	=> datenow(),
		    );
			$this->db->table('ssn_ip_client')->insert($data);
		}
		
		return ;
    }
	
	
	public function get_online_user($agent) {
		$session = session();
		
		if( ! session()->get('random_id')){
			session()->set([
                        'random_id'     => TRUE
                    ]); 
            
			$request = \config\Services::request();
			//----- get ip client ------
			$ipaddress = $request->getIPAddress();
			
			if (! $request->isValidIP($ipaddress)) {
				$ipaddress = 'IP tidak dikenali';
			} 
			
			if ($agent->isBrowser()) {
				$currentAgent = $agent->getBrowser() . ' ' . $agent->getVersion();
			} elseif ($agent->isRobot()) {
				$currentAgent = $agent->getRobot();
			} elseif ($agent->isMobile()) {
				$currentAgent = $agent->getMobile();
			} else {
				$currentAgent = 'Unidentified User Agent';
			}
			 
			$browser = $currentAgent;
			$os_client = $agent->getPlatform(); // Platform info (Windows, Linux, Mac, etc.)
			
			//------ simpan data -------
			
			$data = array( 
				'browser' 	=> $browser,
				'ip_client' => $ipaddress,
				'os_client' => $os_client,
			);
			$this->db->table('ssn_online_user')->insert($data);
			
		}
		return ;
    }
	
	
}
?>



WonXd677 Sh3LL