Pages: [1]   Go Down
  Print  
Author Topic: Fix for hanging join page  (Read 876 times)
Jutaky
Newbie
*
Offline Offline

Posts: 2


View Profile WWW
« on: August 24, 2011, 12:34:35 PM »

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:
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:
Code:
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.
Logged

PolarWebServices.com - Quality over quantity hosting service and scripts support

-- Jutaky // Entrepreneur, hosting provider and a PHP programmer
Upgrade to an SDR 3
damage11
Jr. Member
**
Offline Offline

Posts: 90


View Profile
« Reply #1 on: August 24, 2011, 06:53:44 PM »

It did not work for me?
Logged

757jterrell
Administrator
Hero Member
*****
Offline Offline

Posts: 1637



View Profile WWW
« Reply #2 on: August 24, 2011, 07:25:18 PM »

What version of the script do you have?  you must have the ip2nation database, which is included in the SDR 1,2, and 3 series.  

This fix is now included in the

SDR 3, Sept 1,2011 update
SDR 2, Sept 1, 2011 update.

For SDR Basics, you have 2 options, you can contact one of the resellers or jutaky to have the ip2nation database installed, or you can follow the steps below to remove the country from being added on the join file.  The SDR Basic Sept 1, 2011 update will have the ip2nation database added.

Here is the fix for the SDR Basics to remove the country:

go to your members/join.php file, and remove the following line of code, line 102;

$co = lookupIp($vip);

and line 168:

country='$co',
« Last Edit: August 24, 2011, 07:40:23 PM by 757jterrell » Logged

damage11
Jr. Member
**
Offline Offline

Posts: 90


View Profile
« Reply #3 on: August 25, 2011, 07:24:22 PM »

I have a Sdr2 script?
Logged

Addons
Full Member
***
Offline Offline

Posts: 158


View Profile
« Reply #4 on: September 03, 2011, 11:53:18 PM »

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:
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:
Code:
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.

If i upgrade it, it will affect any gptmaster addon ? http://auroraadmintraining.info/index.php/topic,643.0.html

bcz i m using gptmaster country show up in join page...
plz let me know
thanks
Logged

757jterrell
Administrator
Hero Member
*****
Offline Offline

Posts: 1637



View Profile WWW
« Reply #5 on: September 12, 2011, 09:06:30 PM »

You would have to check to see where the ip is checked, it you are using a country database different than ip2nation, than you will need to reference those files instead.
Logged

amidamaru34
Jr. Member
**
Offline Offline

Posts: 59


View Profile
« Reply #6 on: September 18, 2011, 09:16:48 PM »

so should i fix the script like the first post ??

I have SDR 3 script

« Last Edit: September 18, 2011, 09:22:41 PM by amidamaru34 » Logged
757jterrell
Administrator
Hero Member
*****
Offline Offline

Posts: 1637



View Profile WWW
« Reply #7 on: September 18, 2011, 09:37:52 PM »

so should i fix the script like the first post ??

I have SDR 3 script



Depends on your update date, all Sept 1, 2011 updates of the scripts have this fix already added.
Logged

Mr__Bill
Newbie
*
Offline Offline

Posts: 13



View Profile WWW
« Reply #8 on: November 12, 2011, 08:29:39 PM »

I have an MRV5.5 updated script. New signups  are having problems with the signup page, saying they are getting sent to another page while registering or just can  not enter info in the boxes. Tried to copy the join.php file from my other site (upgraded the same) but it still does not work right. Will this fix work for me as well?
 Launched last week and if nobody can sign up, losing perspective members daily. HELP!!
Logged

Mr__Bill
Newbie
*
Offline Offline

Posts: 13



View Profile WWW
« Reply #9 on: November 12, 2011, 08:54:02 PM »

Never mind, the upgraded functions.php file is encoded. I'll have to contact the installer.
Logged

Get a SDR 3 NOW at http://ptcfactory.info

The best and most up to date Aurora script in the market!!
Pages: [1]   Go Up
  Print  
 
Jump to: