1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GeoIP script problem

Discussion in 'PHP & Perl' started by west13, May 18, 2013.

  1. west13

    west13 Junior Member

    Joined:
    May 31, 2012
    Messages:
    173
    Likes Received:
    63
    I'm trying to use a geo ip script but I get this error:

    Code:
    [B]Fatal error[COLOR=#000000][FONT=Times New Roman]: [/FONT][/COLOR][/B][COLOR=#000000][FONT=Times New Roman]Cannot redeclare geoip_country_code_by_name() in[/FONT][/COLOR][B][B]/home/west13/public_html/geoip.inc[COLOR=#000000][FONT=Times New Roman] on line [/FONT][/COLOR][B]347
    
    [/B][/B][/B]
    I am sure is something from my host and I have to modify something but nothing I tried worked. Does anyone has some advice on how to make the script working..

    I'm loking to redirect some cpa links based on country IP.
     
  2. Izzma

    Izzma Regular Member

    Joined:
    Jan 29, 2012
    Messages:
    293
    Likes Received:
    197
    Location:
    Canada
    Hey,

    Your problem is somewhere in your script you have already called out to function geoip_country_code_by_name().

    Find out where the function is initially being called out and make the adjustments accordingly. You will have to figure this one out for yourself.
     
    Last edited: May 18, 2013
  3. west13

    west13 Junior Member

    Joined:
    May 31, 2012
    Messages:
    173
    Likes Received:
    63
    I'm really a noob on php. I actually tryed 3 different geoip script and none were working..I got different errors, thats why I think is somehow related to my host...maybe
     
  4. plajndek

    plajndek Newbie

    Joined:
    Jun 20, 2012
    Messages:
    44
    Likes Received:
    11
    Location:
    Depend on IP
    You can try geoplugin. It's quite easy to use. Example.

    This will give you full country name, if you want only country code just replace geoplugin_countryName with geoplugin_countryCode.

    Note: I'm not allowed to post links, replace 'GEOPLUGIN LINK' with valid url.
     
  5. innozemec

    innozemec Jr. VIP Jr. VIP

    Joined:
    Aug 19, 2011
    Messages:
    5,288
    Likes Received:
    1,799
    Location:
    www.Indexification.com
    Home Page:
    You probably include the same file twice that have same function name and thats why you are getting the error.. definitely it is not a host issue
     
  6. west13

    west13 Junior Member

    Joined:
    May 31, 2012
    Messages:
    173
    Likes Received:
    63
    I fixed it.... http://code.google.com/p/slimstat/issues/detail?id=1

    I had to change some code..The thing is that I found a fix on another site but I think a { was missing and got another error so that's why I was puzzled...But works now and I think this fix might help others...
     
  7. royserpa

    royserpa Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 28, 2011
    Messages:
    4,641
    Likes Received:
    3,491
    Gender:
    Male
    Occupation:
    Negative Options aka Rebills!
    Location:
    Royserpa
    Home Page:
    Geoplugin?! Never heard of it. Will check it out as maxmind's is kinda glitchy at times