This patch fixes
lookupIp() function, which causes join page to hang when resolving IP to country text. The patch requires ip2nation country database.
File to edit: /includes/functions.php
Find following piece of code:
function lookupIp($ip) {
// http://www.webservicex.net/geoipservice.asmx/GetGeoIP?IPAddress=
if($ip == "") return false;
$script = "http://www.webservicex.net/geoipservice.asmx/GetGeoIP";
$params = "?IPAddress=".$ip;
$r=@file_get_contents($script.$params);
if(strpos($r, "No Record Found") === false && ($r != false)) {
// if(true) {
$result = html_entity_decode($r);
$start = strpos($result,"<CountryName>")+13;
$end = strpos($result,"</CountryName>");
$co = strtolower(substr($result,$start, ($end-$start)));
if($co != "reserved" && $start && $end) return $co;
else return false;
}
else {
return false;
}
}
Replace above code with new
lookupIp() function:
function lookupIp($ip) {
global $Db1;
return $Db1->querySingle("SELECT c.country FROM ip2nationCountries as c
LEFT JOIN ip2nation as i ON c.code = i.country
WHERE i.ip < INET_ATON('". mysql_real_escape_string($ip) ."')
ORDER BY i.ip DESC
LIMIT 1",'country');
}
Do you want a professional to install the patch for you? Contact me for installation service, only $4.90, via helpdesk at
http://polarwebservices.com/helpdesk.php and I will install the patch for you including ip2nation, if your site does not have it.