���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/vidoe.top/lib/ip2country/ |
<?Php /** * This class generates the country name and its flag from its IP address * * * @author Rochak Chauhan */ class CountryFromIP { private $CountryIPDatabase = 'lib/ip2country/CountryIPDatabase.txt'; private $ip = ''; /** * Function to validate IP ( please modify it according to your needs) * * @param $ip - string * * @return boolean */ public function ValdateIP($ip) { $ipArray = explode(',',$ip); if(count($ipArray) != 4) { echo "<font color='red' size='3'> <b>ERROR: </b> Invalid IP</font>"; return false; } else { return true; } } /** * Function to return Country name from the IPDatabase * * @param $ip string * * @return string - name of the country, false otherwise */ public function GetCountryName($ip) { $this->ip = $ip; $ip = sprintf("%u", ip2long($ip)); $csvArray = file($this->CountryIPDatabase); for($i=0; $i<count($csvArray); $i++) { $arrayOfLine = explode(',', $csvArray[$i]); if($ip >= $arrayOfLine[0] && $ip <= $arrayOfLine[1] ) { return $countryName = $arrayOfLine[2]; } } return false; } /** * Function to return local path to Country's flag * * @param $ip - string * * @return string - local path to flag image */ public function ReturnFlagPath() { if($countryName = trim(ucwords(strtolower($this->GetCountryName($this->ip))) )) { $countryName = str_replace(' ','%20',$countryName); return "flag/$countryName.gif"; } else { return false; } } } ?>