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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-26-2008, 01:18 PM   #1
CurrentlySober
Too lazy to wipe my ass
 
CurrentlySober's Avatar
 
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
__________________


👁️ 👍️ 💩
CurrentlySober is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2008, 01:26 PM   #2
psili
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.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2008, 01:57 PM   #3
CurrentlySober
Too lazy to wipe my ass
 
CurrentlySober's Avatar
 
Industry Role:
Join Date: Aug 2002
Location: A Public Bathroom
Posts: 38,644
Thanks, will look into them
__________________


👁️ 👍️ 💩
CurrentlySober is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2008, 02:16 PM   #4
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
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
Then, set your defaults you want to support in order of priority:
Code:
LanguagePriority en fr es de
Create multiple pages with the different languages embedded. "index.html" would be removed, and you would have "index.html.en", "index.html.fr", "index.html.es", and "index.html.de" (This also works for .php, .shtml, etc.)

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");
      }
    }
  }
?>
I hope this has been helpful. Stop forcing me to read Spanish when I'm in Latin America; I have to read it all of the damn time, there!
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2008, 03:13 PM   #5
CurrentlySober
Too lazy to wipe my ass
 
CurrentlySober's Avatar
 
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...
__________________


👁️ 👍️ 💩
CurrentlySober is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2008, 03:15 PM   #6
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Quote:
Originally Posted by ThatGuyInTheCorner View Post
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...
Then you could likely bribe someone to modify the script above to redirect to a new site instead of printing a GIF. (if country = DE (German), then.. etc. Shouldn't be too difficult to have implemented for you,
either.
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2008, 04:13 PM   #7
Catalyst
Confirmed User
 
Catalyst's Avatar
 
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?
Catalyst is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2008, 04:15 PM   #8
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Quote:
Originally Posted by Catalyst View Post
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?
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.
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.