Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Changing website homepage image based on ip address?

Options
  • 08-07-2011 2:15pm
    #1
    Registered Users Posts: 124 ✭✭


    Hi,

    I am designing a website at the moment and am just wondering if it is possible to change an image on my homepage based on the IP address of the person visiting the website?

    The image will be approx 960px in width by 360px in height and will be above the fold. We would like to have approximately 4 - 5 different images. So if a person with an Irish IP address logs on we would like the image to reflect Ireland. If a person with a Scottish IP address logs on then we would like the image to reflect Scotland. Same for England and maybe one or two more locations.

    Is this possible? Any help would be appreciated. Thanks


Comments

  • Registered Users Posts: 437 ✭✭t1mm


    Using PHP, its possible to access the client's computer like this:
    $_SERVER['REMOTE_ADDR']
    

    However, as far as I can see you're not interested in the address itself, but where it originates. This is called "Geolocation", and there are various services available, a quick Google and I found this one:

    http://www.geoio.com/

    You will probably have to write some code to change the html of the page based on the location of the IP address too.


  • Registered Users Posts: 124 ✭✭Mike_Eile


    Thanks for that T1mm. I'll have a look at the Geolocation over the weekend and see what the best way to implement it is. The website is being built in asp.net.

    Thanks again


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    http://www.maxmind.com/ has sample code which might help you


  • Closed Accounts Posts: 3 mahack3r


    There are web services available to determine locale from IP, if these are too slow you can use a local database. Don't overlook the locale information in the http headers, you can simply determine the user's preferred language and sometimes their region from these.

    See: http://www.w3.org/International/questions/qa-accept-lang-locales


Advertisement