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 Mark Forums Read
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 12-30-2013, 05:55 AM   #1
Oracle Porn
Affiliate
 
Oracle Porn's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Icq: 94-399-723
Posts: 24,433
Show content if country with mod_geoip by maxmind

Anyone has a code that can show banner a for all countries except for example, germany, I want to show banner b. I have maxmind's geoip installed on my server but can't find a code that will show everyone banner A except one country to see banner B.
__________________


Oracle Porn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 05:58 AM   #2
Klen
 
Klen's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
I have it.
Klen is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 05:59 AM   #3
Oracle Porn
Affiliate
 
Oracle Porn's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Icq: 94-399-723
Posts: 24,433
Can you post it or do you just want to show the size or your e-penis?
__________________


Oracle Porn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 06:17 AM   #4
Klen
 
Klen's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
Quote:
Originally Posted by Oracle Porn View Post
Can you post it or do you just want to show the size or your e-penis?
That is correct my e-penis is hugeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.
PHP Code:
if ($country_code==DE){ echo '<img src="Debanner.jpg"></img>';}
else
{echo 
'<img src="allbanner.jpg"></img>';} 
Better way:
PHP Code:
 <?php

    $country 
getenv(GEOIP_COUNTRY_NAME);
    
$country_code getenv(GEOIP_COUNTRY_CODE);


switch (
$country_code) {
        case 
'US':
        echo 
'<img src="Usbanner.jpg"></img>';
            
        case 
'DE':
        echo 
'<img src="Debanner.jpg"></img>';
        
        default:
         echo 
'<img src="Other.jpg"></img>';
            
            
    }
?>

Last edited by Klen; 12-30-2013 at 06:23 AM.. Reason: Beacuse my e-penis is huge
Klen is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 06:46 AM   #5
AHarper
Confirmed User
 
Industry Role:
Join Date: Jul 2010
Posts: 846
Thanks for sharing (as replacement for the like button)
AHarper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 07:10 AM   #6
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
bookmarked
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 07:22 AM   #7
Barry-xlovecam
It's 42
 
Industry Role:
Join Date: Jun 2010
Location: Global
Posts: 18,083
Another approach is to:
my $lang = "$ENV{'HTTP_ACCEPT_LANGUAGE'}";

that would envelope the browser language.
First of all: it is faster than a Max-Mind Geo-IP lookup -- there is no database overhead.
Secondly as an example, if you are in Montreal and using a French-Canadian language browser your HTTP_ACCEPT_LANGUAGE would be :
Accept-Language: fr-CA;q=0.5
Using Geo-IP you would assume Canada and offer the default English language version which would be in error. Say your surfer is an American travelling in Italy using a hotel wireless with an Italian IP but with his laptop's en-US language browser?

Well, you see my point ...

http://en.wikipedia.org/wiki/Content_negotiation

http://www.w3.org/International/ques...-http-and-lang
Barry-xlovecam is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 07:31 AM   #8
Constantine
Confirmed User
 
Constantine's Avatar
 
Industry Role:
Join Date: Jan 2008
Posts: 156
Another graceful way to do the same:

PHP Code:
<?php

    $banner
['default'] = 'default-banner.jpg';

    
$banner['AU'] = 'au-banner.jpg';
    
$banner['DE'] = 'de-banner.jpg';
    
$banner['US'] = 'us-banner.jpg';


    
$country_code getenv(GEOIP_COUNTRY_CODE);

    if (isset(
$banner[$country_code]))
    {
        
$banner['default'] = $banner[$country_code];
    }

    echo (
'<img src="' $banner['default'] . '" alt=""/>');
?>
__________________
. . .


. . .
Constantine is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 07:34 AM   #9
Constantine
Confirmed User
 
Constantine's Avatar
 
Industry Role:
Join Date: Jan 2008
Posts: 156
Sure, you can get visitor's country_code from various sources.
__________________
. . .


. . .
Constantine is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 09:43 AM   #10
Oracle Porn
Affiliate
 
Oracle Porn's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Icq: 94-399-723
Posts: 24,433
thanks everyone
__________________


Oracle Porn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 10:03 AM   #11
Oracle Porn
Affiliate
 
Oracle Porn's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Icq: 94-399-723
Posts: 24,433
Quote:
Originally Posted by KlenTelaris View Post
That is correct my e-penis is hugeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.
PHP Code:
if ($country_code==DE){ echo '<img src="Debanner.jpg"></img>';}
else
{echo 
'<img src="allbanner.jpg"></img>';} 
Better way:
PHP Code:
 <?php

    $country 
getenv(GEOIP_COUNTRY_NAME);
    
$country_code getenv(GEOIP_COUNTRY_CODE);


switch (
$country_code) {
        case 
'US':
        echo 
'<img src="Usbanner.jpg"></img>';
            
        case 
'DE':
        echo 
'<img src="Debanner.jpg"></img>';
        
        default:
         echo 
'<img src="Other.jpg"></img>';
            
            
    }
?>
this doesn't seem to work for me....

Quote:
Originally Posted by Constantine View Post
Another graceful way to do the same:

PHP Code:
<?php

    $banner
['default'] = 'default-banner.jpg';

    
$banner['AU'] = 'au-banner.jpg';
    
$banner['DE'] = 'de-banner.jpg';
    
$banner['US'] = 'us-banner.jpg';


    
$country_code getenv(GEOIP_COUNTRY_CODE);

    if (isset(
$banner[$country_code]))
    {
        
$banner['default'] = $banner[$country_code];
    }

    echo (
'<img src="' $banner['default'] . '" alt=""/>');
?>

this works, but how do I show nothing for some countries?
__________________


Oracle Porn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 11:38 AM   #12
Klen
 
Klen's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
Quote:
Originally Posted by Oracle Porn View Post
this doesn't seem to work for me....
Just tested it and works fine,tho i did forgot to add break;
PHP Code:
 <?php

    $country 
getenv(GEOIP_COUNTRY_NAME);
    
$country_code getenv(GEOIP_COUNTRY_CODE);

echo 
$country_code;
switch (
$country_code) {
        case 
'UK':
        echo 
'<img src="Ukbanner.jpg"></img>';
        break;
        case 
'DE':
        echo 
'<img src="Debanner.jpg"></img>';
        break;
        case 
'US':
        echo 
'<img src="Usbanner.jpg"></img>';
        break;
        default:
         echo 
'<img src="Other.jpg"></img>';
         break;
            
    }

?>
Here is an article where you can check do you have everything installed fine:
http://www.tecmint.com/install-mod_g...centos-6-35-8/

Last edited by Klen; 12-30-2013 at 11:47 AM..
Klen is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-30-2013, 12:43 PM   #13
Oracle Porn
Affiliate
 
Oracle Porn's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Icq: 94-399-723
Posts: 24,433
Quote:
Originally Posted by KlenTelaris View Post
Just tested it and works fine,tho i did forgot to add break;
PHP Code:
 <?php

    $country 
getenv(GEOIP_COUNTRY_NAME);
    
$country_code getenv(GEOIP_COUNTRY_CODE);

echo 
$country_code;
switch (
$country_code) {
        case 
'UK':
        echo 
'<img src="Ukbanner.jpg"></img>';
        break;
        case 
'DE':
        echo 
'<img src="Debanner.jpg"></img>';
        break;
        case 
'US':
        echo 
'<img src="Usbanner.jpg"></img>';
        break;
        default:
         echo 
'<img src="Other.jpg"></img>';
         break;
            
    }

?>
Here is an article where you can check do you have everything installed fine:
http://www.tecmint.com/install-mod_g...centos-6-35-8/
this works great, thanks.
__________________


Oracle Porn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2013, 05:36 AM   #14
Constantine
Confirmed User
 
Constantine's Avatar
 
Industry Role:
Join Date: Jan 2008
Posts: 156
Quote:
Originally Posted by Oracle Porn View Post
this works, but how do I show nothing for some countries?
No problem, try this one:

PHP Code:
<?php

    $banner
['default'] = '<img src="default-banner.jpg" alt=""/>';

    
$banner['AU'] = '<img src="au-banner.jpg" alt=""/>';
    
$banner['DE'] = '<img src="de-banner.jpg" alt=""/>';
    
$banner['US'] = '<img src="us-banner.jpg" alt=""/>';


    
$country_code getenv(GEOIP_COUNTRY_CODE);

    echo (isset(
$banner[$country_code]))
        ? 
$banner[$country_code] : $banner['default'];
?>

And if you wanna to show "nothing" for specified country just add:

PHP Code:
$banner['BE'] = ''
__________________
. . .


. . .

Last edited by Constantine; 12-31-2013 at 05:49 AM.. Reason: just because
Constantine 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
Thread Tools



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.