Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Is there a way to block a country?
Old 05-21-2012, 09:31 PM Is there a way to block a country?
Extreme Talker

Posts: 219
Trades: 0
I seem to be getting spam via my registration page, even with a CAPTCHA image. Is there a (simple) way to block a country from seeing my site?
Like China or Russia?

I'm actually only interested in the USA market, can some code only make my site available to the USA?

Thanks for any insight.
chrisj is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-22-2012, 06:30 AM Re: Is there a way to block a country?
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Do you have access to the server firewall configuration?

And/or are you running on Apache on Linux?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?

Last edited by chrishirst; 05-22-2012 at 06:31 AM..
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-22-2012, 01:21 PM Re: Is there a way to block a country?
Extreme Talker

Posts: 219
Trades: 0
Thanks for your reply

Apache on Linux
chrisj is offline
Reply With Quote
View Public Profile
 
Old 05-22-2012, 04:09 PM Re: Is there a way to block a country?
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use .htaccess in that case.

http://www.javascriptkit.com/howto/htaccess5.shtml

country IP list are available from -> http://software77.net/geo-ip/


Using iptables is far better but if you don't have that level of access there is no choice. Using PHP will actually add load to the server that will very likely cause performance degredation.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-09-2012, 07:56 AM Re: Is there a way to block a country?
Banned

Posts: 2
Trades: 0
I think .htaccess is the best option for your problem....
Danish21 is offline
Reply With Quote
View Public Profile
 
Old 07-09-2012, 12:51 PM Re: Is there a way to block a country?
Physicsguy's Avatar
404 - Title not found

Posts: 1,060
Name: Scott Kaye
Location: Ontario
Trades: 0
Quote:
Originally Posted by Danish21 View Post
I think .htaccess is the best option for your problem....
It's been answered. However, for people googling for this thread, I remember something Chrishirst said a while ago that I've done ever since:

Always leave an empty field in your form, and make it hidden. Bots that fill out forms will always enter something into every field, so name it something like 'confirm_email', so maybe the bot will recognize it as a required email field, and enter an email. However, on your processing page, deny entry if that field's value isn't null. Only people who modified the HTML (probably looking for security holes) or bots would have entered something in that field, so ignore it.

BASICALLY:
Code:
Form:
<input type="hidden" name="confirm_email" />
OR if the bot recognizes the type="hidden":
<input type="text" style="display:none" name="confirm_email" />

Processing:
if ( $_GET|POST['confirm_email']!=null ) exit();
You can also try 'skill-testing' questions. The question Valve uses on their Steam forums is 'What is Gordon Freeman's last name?'. Obviously 'Freeman', but a bot would have a much harder time figuring that out.
__________________

Please login or register to view this content. Registration is FREE

Last edited by Physicsguy; 07-09-2012 at 12:54 PM..
Physicsguy is offline
Reply With Quote
View Public Profile Visit Physicsguy's homepage!
 
Old 07-11-2012, 08:15 AM Re: Is there a way to block a country?
vectorialpx's Avatar
Ultra Talker

Posts: 261
Name: octavian
Location: Bucharest
Trades: 0
Blocking an entire country is a bad solution. I shouldn't be excluded if I am a manager located in US but visiting China. I have to be welcome anytime, anyplace, anyhow - in fact, this is the advantage of the internet.

Like Physicsguy said, you have to be creative and to add some protection to your form(s) like:
- adding a token once per session and sending it everytime
- rename your fields on the fly ( like 'fld' . md5(TOKEN) ) every session
- add a smart captcha
- add email smart validation (confirmation link on the mail will need required captcha)
__________________

Please login or register to view this content. Registration is FREE
(database and files management)
vectorialpx is offline
Reply With Quote
View Public Profile Visit vectorialpx's homepage!
 
Old 07-16-2012, 11:07 AM Re: Is there a way to block a country?
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Because traffic from that country is either useless, potentially fraudulent or is mainly "crackers" and spammers.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-16-2012, 11:21 AM Re: Is there a way to block a country?
King Spam Talker

Posts: 1,091
Name: Paul W
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Because traffic from that country is either useless, potentially fraudulent or is mainly "crackers" and spammers.
Indeed

A more legitimate reason might be for something like a football match broadcast live on the internet but the rights owners want it blocked in countries where they've sold TV rights.
__________________
Great music:
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
PaulW is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Is there a way to block a country?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32885 seconds with 11 queries