Go Back   Cloud Computing > Support > PHP Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-11-11, 07:49
BOD Member
 
Join Date: Nov 2010
Posts: 57
Default IP blocking through PHP script

Hi

Due to the strong attack of spammers from specific region I want to block visitors from particular country. I think that there are several Ips from that country overuse my website. So what I wan to know is it possible to block country IP to avoid imbeciles spam attacks?
Reply With Quote
  #2 (permalink)  
Old 02-11-11, 07:52
BOD Member
 
Join Date: Nov 2010
Posts: 104
Default

I am not sure, but I think it is possible through PHP script. However you can also do it through cPanel control panel, which is quite easier than doing modification in web site script.
Reply With Quote
  #3 (permalink)  
Old 02-11-11, 07:57
BOD Member
 
Join Date: Nov 2010
Posts: 81
Default

Why you are not using Iptables firewall in Linux to block access to server from different IP address blocks. It is rather easier than modifying PHP script. You can use Google to get updated list of IP addresses for particular country.
Reply With Quote
  #4 (permalink)  
Old 02-11-11, 07:58
Rozanne's Avatar
BOD Member
 
Join Date: Nov 2010
Posts: 116
Default

Most probably it is the best solution to block IP range at the firewall level and if you are using CSF firewall, then there is an option where you can enter the country codes you want to block., just save and restart.
Reply With Quote
  #5 (permalink)  
Old 02-28-11, 23:57
BOD Member
 
Join Date: Feb 2011
Location: 325 WARWICK,RD MIDDLETOWN,DE,19709
Posts: 1
Send a message via Yahoo to irwin87leon
Default

For blocking any IP address you have to first create the site which can trace the IP address. Directly it is not possible to block the IP using PHP.
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 01:07.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.