![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Too lazy to wipe my ass
Industry Role:
Join Date: Aug 2002
Location: A Public Bathroom
Posts: 38,644
|
Geo IP Question...
How easy / simple / complicated would it be to do the following...
Surfer clicks text link: If surfers in Europe, they see Europe page If surfers in America, they see USA page If surfer is 'somewhere else' the see the 'somewhere else' page' Simple enough on paper but how simple to set up and how would I go about it? What would I need to do to make this happen, or is it a big complicated expensive deal? Doesn't need to be TOTALLY accurate... Just pretty much so... Just looking for some theoretical information.. Thanks ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
|
http://www.maxmind.com/app/ip-location
They have a free version of their location DB if you want free. Just find the code example of your choice on their site and you're off and running.
__________________
Your post count means nothing. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Too lazy to wipe my ass
Industry Role:
Join Date: Aug 2002
Location: A Public Bathroom
Posts: 38,644
|
Thanks, will look into them
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Now choke yourself!
Industry Role:
Join Date: Apr 2006
Posts: 12,085
|
GrouchAdmin's "How to do GeoIP the proper way with minimal overhead" example
MaxMind's mod_geoip directly inserted into your webserver would be the easiest for external/programmable GeoIP support. It'd make more sense to check the browser's language(s) of choice, than force a user of a region into a language they don't want. Let Apache handle the language, itself, then just display the runtime code (if that's what you want to do) independently with mod_geoip. First, setup your supported languages, and priority in Apache: Code:
AddLanguage en .en AddLanguage fr .fr AddLanguage es .es AddLanguage de .de Code:
LanguagePriority en fr es de Now, GeoIP's database for the country name database part, which almost mimmics the above, but uses a different format, ISO3166: Here's some tiny little throwaway GeoIP code. It displays those tiny flags in my sig. It has very little overhead with mod_geoip, marginal with the runtime PHP library. This is an old version without eTags (caching) support. It'd be smarter to cache these into RAM than to continually read them from the disk, if you have the choice. You may use this code, if you want. Code:
<?php // Simple little example utlity to display a small flag based upon GeoIP data. // by GrouchyAdmin <grouchy/at/grouchyadmin/dot/com> // // This example supports both mod_geoip, and the external PHP API. // If mod_geoip is installed: $country = ""; // Do we have apache_note()? if (function_exists('apache_note')) $country = strtolower(apache_note("GEOIP_COUNTRY_CODE")); if (empty($country)) { // external MaxMind PHP support include("./geoip.inc"); $gi = geoip_open("./GeoIP.dat", GEOIP_STANDARD); $country = strtolower(geoip_country_code_by_addr($gi, $_SERVER["REMOTE_ADDR" ])); geoip_close($gi); if ($country) { header ("Pragma: no-cache"); header("Expires: Mon, 26 Jul 1999 04:20:00 GMT"); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); header("Content-type: image/gif"); if (file_exists('./'.$country.'.gif')) { readfile('./'.$country.'.gif'); } else { // Generic 'empty' country banner. readfile("./00.gif"); } } } ?> ![]()
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Too lazy to wipe my ass
Industry Role:
Join Date: Aug 2002
Location: A Public Bathroom
Posts: 38,644
|
Hey Grouch, Thanks for the reply, however it may be more technical than I need or (truthfully) understand...
Here's what I want in a simpler way of explaining it... The text link that gets clicked, is a link to a dating site... Not an AFF or similar, ie a porn type site, with phony profiles etc... Im talking a REAL DATING SITE. Mainstream... Match.com or similar... My Idea was that if they were in Europe and clicked, they would get a European based dating site... If the surfer was in America, they get a USA based dating site... And, as an afterthought, if they were somewhere else ie China... I could just throw them somewhere else... Its NOT about languages. Its just about getting a European person to a euro landing page and an American to a USA landing page... Thats all really... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Now choke yourself!
Industry Role:
Join Date: Apr 2006
Posts: 12,085
|
Quote:
either.
__________________
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Jun 2003
Location: Vegas
Posts: 3,243
|
Yea.. this is something I have been looking at also..
how is the load on the server.. do you normally use the php mod, or perl, or what? Load on the server is not much? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Now choke yourself!
Industry Role:
Join Date: Apr 2006
Posts: 12,085
|
mod_geoip in Apache itself is going to be much faster and not have the 'recompile/load/fireoff' which is going to be slower even with a metacaching PHP service. I use that, where I can, and the PHP library where I have to. The Perl library is just about the same as the "Pure PHP" library. The load is marginal.
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |