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 09-30-2010, 09:44 AM   #1
Darrell
Confirmed User
 
Join Date: Feb 2003
Location: In bed asleep
Posts: 803
How to show a geoip warning page without using htaccess?

Any tips on how to show a geoip warning page when someone visits a site without using htaccess? I don't want to use htaccess because of server load on high traffic sites.

Thanks
Darrell is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 10:21 AM   #2
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,944
http://www.maxmind.com/app/php

http://www.phpandstuff.com/articles/...ookup-with-php
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 10:28 AM   #3
BestXXXPorn
Confirmed User
 
BestXXXPorn's Avatar
 
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
Indeed, MaxMind is kinda the defacto standard for GeoIP in terms of PHP
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com
BestXXXPorn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 10:28 AM   #4
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,883
can do it with php or javascript, dozens of ways actually depending on what exactly you are trying to acomplish...
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 10:30 AM   #5
Vick!
Confirmed User
 
Industry Role:
Join Date: Nov 2005
Location: 20 00'24.00" N, 75 09'00.00 W
Posts: 6,882
MaxMind of course. That's kickass.
__________________
Affordable Quality Web Hosting
Vick! is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 10:36 AM   #6
BestXXXPorn
Confirmed User
 
BestXXXPorn's Avatar
 
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
PHP Code:
<?
    $validCountries = array('US', 'CA', '...');
    $countryCode    = geoip_country_code_by_name($_SERVER['REMOTE_ADDR']);
    
    if(!in_array($countryCode, $validCountries)) {
        header('Location: http://www.someplace.com/country_not_aloud');
        exit();
    }
?>
Real quick down and dirty if you need an example (haven't tested but it should work)... List of country codes available here: http://www.maxmind.com/app/iso3166
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com
BestXXXPorn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 10:41 AM   #7
Prasawet
Registered User
 
Join Date: Nov 2009
Posts: 62
U can use php & mysql IP database.
ip2nation.com, U can find instructions how to use, I found it 95% accurate, and U are not depend on the third party.
Prasawet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 11:57 AM   #8
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
Quote:
Originally Posted by Darrell View Post
Any tips on how to show a geoip warning page when someone visits a site without using htaccess? I don't want to use htaccess because of server load on high traffic sites.

Thanks

.htaccess is the fastesT way and lowest server load, where do you get your info from?
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 12:02 PM   #9
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by grumpy View Post
.htaccess is the fastesT way and lowest server load, where do you get your info from?
not nec. with no htaccess the page will load faster, the warning might be slower than simply using htaccess but i think his point is the page will initially load faster.

solution is to use an external file with htaccess geoip so the initial page loads faster.

i.e. instead of serving page after checking htaccess , serve page first , call htaccess from an external file such as a javascript
__________________
hatisblack at yahoo.com

Last edited by SmokeyTheBear; 09-30-2010 at 12:05 PM..
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 12:03 PM   #10
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,944
or you can do it based on he language without any lib
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 12:24 PM   #11
BestXXXPorn
Confirmed User
 
BestXXXPorn's Avatar
 
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
.htaccess should not ever be used unless you don't have control over your own web server...

In fact I'd highly recommend you don't run Apache... it's bloated and ass slow compared to newer web servers... You can't really beat nginx serving PHP via Fast-CGI. I've taken 12 box Apache deployments down to 4 nginx boxes and still had less load than all 12 boxes running Apache...
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com
BestXXXPorn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-30-2010, 03:09 PM   #12
HomerSimpson
Too lazy to set a custom title
 
HomerSimpson's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Springfield
Posts: 13,826
php + session
php or js + cookie
__________________
Make a bank with Chaturbate - the best selling webcam program
Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!!

PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:
HomerSimpson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-03-2010, 02:15 AM   #13
Darrell
Confirmed User
 
Join Date: Feb 2003
Location: In bed asleep
Posts: 803
Quote:
Originally Posted by fris View Post
or you can do it based on he language without any lib
Thanks for all the replies. Based on language is a good idea.

My sites are in English and I only want to pop a warning page for one country and based on the browser language would be fine. Also I don't want to mess up my SE rankings. Is there a really simple way to accomplish this?
Darrell is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-03-2010, 02:22 AM   #14
Darrell
Confirmed User
 
Join Date: Feb 2003
Location: In bed asleep
Posts: 803
With regards to not wanting to mess up SE rankings for showing a warning page for one specific country, would a Javascript redirect be a good idea as I don't think SE bots parse javascripts?
Darrell is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-03-2010, 08:35 AM   #15
Darrell
Confirmed User
 
Join Date: Feb 2003
Location: In bed asleep
Posts: 803
Bump for me
Darrell is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-03-2010, 08:53 AM   #16
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,944
Quote:
Originally Posted by Darrell View Post
Thanks for all the replies. Based on language is a good idea.

My sites are in English and I only want to pop a warning page for one country and based on the browser language would be fine. Also I don't want to mess up my SE rankings. Is there a really simple way to accomplish this?
Code:
<?php 
$lang = ($_SERVER['HTTP_ACCEPT_LANGUAGE']); 

if(preg_match("zh", $lang)) { 
    header("location: http://www.domain.com/china.html"); 
} else { 
    header("location: http://domain.com/"); 
} 
?>
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris 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.