Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Ip check script, help!

    Hi!

    I need a script that can run an IP check on a multinational website, which finds out what country the person are coming from and redirect the person to the right server based upon that information. Any clue, any link???

    Thanks

  • #2
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Run this script...

    PHP Code:
    <?php
    print_r
    ($_SERVER);
    ?>
    It will show you a list of all the server variables you can use (in most cases).

    (Hint, use view source to see the vars)

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.geobytes.com/ (will cost you 50$)
    http://ip-to-country.webhosting.info/ (free conversiontable for ip's to country's. to store in your db. plenty of exapmlecode to use them with php, but i's quite easy. Just need to add an extra column with the server or whatever to redirect to.)

  • #4
    New Coder
    Join Date
    Jan 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    fantastic

    this is my first visit in this forum and after 15 minutes I have an answer!

    Thank you!!!

  • #5
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: fantastic

    Originally posted by wiggywag
    this is my first visit in this forum and after 15 minutes I have an answer!

    Thank you!!!
    You're way to kind ! It was 18 minutes ... which is above average.

    Welcone here !

  • #6
    New Coder
    Join Date
    Jan 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I feel the ip check and the automatic redirection is not a good idea, especially not for an enterprise site. After the respons in some forums to this question i think the best is to make an ip check and then output a link to the national homepage where the IP comes from. If the person have logged on to his national homepage this message should not appear.

    Any suggestion how to make this script in PHP?

    This because the IP check only works 98 percent at the time, which is not good enough for a site with over 200000 visitors a day (then 4000 person will fail to get to the site!)

    Another reason, it works slow!

  • #7
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be jooking.

    I feel the ip check and the automatic redirection is not a good idea, especially not for an enterprise site. After the respons in some forums to this question i think the best is to make an ip check and then output a link to the national homepage where the IP comes from
    You obviously didn't think this through. If you do the IP check,to determine where they come from, and then get the url to their national homepage, then you already did all the lookup and processing you need to redirect them. What added value has the 'display link' over a redirect?

    Redirecting is nothing more then skipping the step where the user needs to click the link.

    This because the IP check only works 98 percent at the time, which is not good enough for a site with over 200000 visitors a day (then 4000 person will fail to get to the site!)
    So what difference does it then make if you redirect them or display a link? You will have just as much users you can't supplie the correct link to.
    So for these 2% you either redirect them to the 'default'homepage or print a list of all countrys and have them take their pick (which you also could do from the start on).
    Another reason, it works slow!
    You're not seriously thinking that echoing a page with a link on goes faster then a redirect (which is basically just sending a pageheader to the webserver). I seriously doubt that + i even think a redirect will be quicker then loading a page (with images and other content on it) + even if redirecting would be slower, 99.99% of the responsetime is due to the IP to country to countryhomepage lookup.

    The actual action you perform, based on the outcome of that lookup is completely irrelevant in terms of performance and number of incorrect matches.


    Also: you can set a persistent cookie on the client after you established his location, and store the adress to his national homepage there. And read that cookie before you start the IP-lookup. If a cookie is found, you immedeately redirect to that location. If no cookie is found, look up the ip or show a countrylist and have them take there pick + send he cookie (if they have cookies disabled, then it's their own problem that they wount be automatically redirected next time.)

  • #8
    New Coder
    Join Date
    Jan 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks again!



    I agree on the following:

    If you do the IP check,to determine where they come from, and then get the url to their national homepage, then you already did all the lookup and processing you need to redirect them. What added value has the 'display link' over a redirect?
    What I meant was to make a text like this:
    "You seem to be from Spain please click here to go to our spanish site or continue to browse this page"

    Actually I testen IP country check and found out it said I am located in Norway which is not true, I am in Denmark. I've heard that the IP Country check does not always match. This is important because, it is connected to local comercials on the website.


    What I think is a really good idea is what you mentioned, to present first time visitors a page where to select their local site which link will be automatically put as a cookie in their browser, so next time they don't have to do same procedure again but comes directly to the local site!

    Great help mate!

    Any comments???

  • #9
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Actually I testen IP country check and found out it said I am located in Norway which is not true, I am in Denmark. I've heard that the IP Country check does not always match. This is important because, it is connected to local comercials on the website.
    Hmm. It will never be 100% correct because the db can be outdated or your ISP can be inside another country or there are other ISP machines along the way that assigned an IP. It will also never be a lookup based on 'your' IP. Its's a lookup on the IP-ranges that are known to be assigned to a certain ISP, and from there on,the ISP's info is used. Only the ISP can tell you who exactly used that IP at that specific moment in time. But even then, they will not always be able to locate it like you see in the movies, and they will never give you acces to their logs for privacyreasons.
    But if you check the demopage of the first link
    http://www.geobytes.com/iplocator.htm
    then it should be quite accurate. (Whas it there that you checked ?). For my connection at hone, it's about 10 km off, but it changes during the day, so my accespoint from my ISP's last machine seems to be changing (probably depending on networkload etc)
    here at work, i get the location of our datacenter, so apparently that is where our accespoint is and we're on an internal network inbetween.

    The only way to be certain is let the user pick it himself (let him click on a map or whatever), and then the cookiething comes into play. I think the automatical redirect is most usefull if your site is in a differnt language for each country, and if you can not assume that your target-public can be adressed in one language. Then it's usefull to do a redirect and adress them in the language you expect him to use + display a link (in english or whatever) to pick another language/country or use a map (most user will understand that they are supposed to click on their country, specially if you insert 'i'm here' inside each country in the native langue )

  • #10
    New Coder
    Join Date
    Jan 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Geobyte seems to be more up2date. It detects that I'm from Denmark and not from Norway as http://ip-to-country.webhosting.info/ do.

    But it says I'm in Copenhagen which is not right, but my ADSL provider have their servers down there somewhere!

  • #11
    New Coder
    Join Date
    Jan 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I just got following e-mail from geobytes:


    Hi,


    >I need a script that can run an IP check on a multinational website, which
    >finds out what country the person are coming from and redirect the person
    >to the right server based upon that information.


    Yes, you can do this with our GeoDirection service.
    See http://www.geobytes.com/GeoDirection.htm for sample code and
    information.


    The GeoDirection service is a free service, however it is supported by
    advertising. If you wish to remove the advertising, this can be easily done
    by purchasing some Mapbytes resolutions. These Mapbytes will allow you to
    enter the url of the site on which you use GeoDirection. Any requests from
    this url will be allowed access and will not have any ads served.


    Mapbytes start from $9.95 for 10,000 resolutions. See
    http://www.geobytes.com/FAQ.htm#Mapbytes for more information on MapBytes or
    https://secure.geobytes.com/buy.htm#MapBytes to purchase MapBytes.


    Please let me know if you would like any further information.
    Thank you.


    Kind Regards
    Kaelene McElligott
    Geobytes, inc.
    http://www.geobytes.com/
    Geobytes - because everybody's somewhere!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •