Is there any way to update a wap site's ip to country flag to capture most if not all ips to suit the mini country flags? like the most recent files to capture them
ip to country
Collapse
X
-
Last edited by something else; 04.07.18, 11:18.
-
I have a code already, but the problem is it does not identify a flag for certain IPs. This is my code
function iptocountry($ip) {
$numbers = preg_split( "/\./", $ip);
include("ip_files/".$numbers[0].".php");
$code=($numbers[0] * 16777216) +($numbers[1] * 65536) + ($numbers[2] * 256) +($numbers[3]);
foreach($ranges as $key => $value){
if($key<=$code){
if($ranges[$key][0]>=$code) {$two_letter_country_code=$ranges[$key][1];break;}
} } if ($two_letter_country_code=="") {$two_letter_country_code="unknown";}
return $two_letter_country_code;
}
Comment
-
Easier way:
PHP Code:<?php $ip = $_SERVER['REMOTE_ADDR']; $geo = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip)); $city = $geo['geoplugin_city']; $region = $geo['geoplugin_region']; $country = $geo['geoplugin_countryName']; echo 'City: '.$city.', Region: '.$region.', Country: '.$country.'<br/>'; /* geoplugin_request geoplugin_status geoplugin_credit geoplugin_city geoplugin_region geoplugin_areaCode geoplugin_dmaCode geoplugin_countryCode geoplugin_countryName geoplugin_continentCode geoplugin_latitude geoplugin_longitude geoplugin_regionName geoplugin_currencyCode geoplugin_currencySymbol geoplugin_currencySymbol_UTF8 geoplugin_currencyConverter */ ?>Last edited by something else; 06.07.18, 11:26.
Comment
-
With your function it would be:
PHP Code:function iptocountry($ip) { $geo = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip)); return $geo['geoplugin_countryCode']; }Last edited by something else; 08.07.18, 10:56.
Comment
-
Ok, thanks alot bro! Is there anyway to increase the regular 512 or 1024 kb upload limit in class.upload file? I've tried everything, I've even tried to change it to 2000kb or 2048 kb at it still doesn't show images uploaded that's larger than 1024 kb. something elseLast edited by tupac; 19.07.18, 02:43.
Comment
-
I'm not to sure what the question/problem is but at a guess I would say either you are hitting your allowed upload limit on your server, which can be changed via:
.htaccess
orCode:php_value memory_limit 30M php_value upload_max_filesize 30M php_value post_max_size 100M
php.ini
However I think that you may also be using GD Library in your class.upload file?Code:memory_limit = 30M upload_max_filesize = 30M post_max_size = 100M
In which case you are probably running out of memory (See above how to increase memory imit)
However that being said some hosts don't allow the above to be altered.
If you find that you can't adjust the above and you are working with GD Library then you may want to look at imageMagick as an alternative as this does not count against your memory limit.
To view your limits make a script with the following code in:
randomName.php
(Note: keep this file hidden/deleted after use as it is useful to hackers)PHP Code:<?php phpinfo(); ?>Last edited by something else; 10.07.18, 22:57.
Comment
Comment