hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : block IP
Reply

Forum Jump

block IP

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 05-04-2006, 12:19 AM
Saryooo Saryooo is offline
Web Hosting Master
 
Join Date: Nov 2003
Location: Online
Posts: 1,209

block IP


I want when any member (from blocked country or IP) login to member area he autometically logout.

Any help or script for this?



Sponsored Links
  #2  
Old 05-04-2006, 01:18 AM
Energizer Bunny Energizer Bunny is offline
-=*/E=-
 
Join Date: Sep 2005
Location: In canada
Posts: 3,206
Logout from where , which member area are you talking about, lots of member areas exists.

  #3  
Old 05-04-2006, 01:42 AM
Domainitor Domainitor is offline
Web Hosting Evangelist
 
Join Date: Jun 2005
Posts: 531
If you know the IP block you're trying to prevent from accessing your system(s), why let them log in in the first place? You may want to consider not allowing the log in when it's from the IP blocks that you're sensitive to....

Sponsored Links
  #4  
Old 05-04-2006, 11:44 AM
mikey1090 mikey1090 is offline
Web Hosting Evangelist
 
Join Date: Feb 2006
Location: Lancashire, UK
Posts: 472
IP blocks seem useles, most people with broadband get a different ip each time they connect, and there are ways to change your ip

  #5  
Old 05-04-2006, 12:11 PM
Saryooo Saryooo is offline
Web Hosting Master
 
Join Date: Nov 2003
Location: Online
Posts: 1,209
well it my self made login area, visitors only able to browse site if they register first. But I want to block two countries visitors.


Last edited by Saryooo; 05-04-2006 at 12:16 PM.
  #6  
Old 05-04-2006, 01:17 PM
orbitz orbitz is offline
Web Hosting Master
 
Join Date: Mar 2004
Posts: 1,301
again, don't let them register in the first place
for finding a ip belonging to a country, you might want to search around.
the basic is something like this:

$baniplist = array('ip1', 'ip2', 'ip3');
so if(!in_array($this_ip, $baniplist) {
//register page
}
else{
// redirect user to somewhere
}

Note: you don't want to ban a whole ip, just use the first few numbers that indicates the country where the user comes from


Last edited by orbitz; 05-04-2006 at 01:22 PM.
  #7  
Old 05-04-2006, 01:48 PM
Akash.Kava Akash.Kava is offline
Web Hosting Guru
 
Join Date: Apr 2006
Posts: 296
But why do you let them register? at time of signup itself you can block by the country.

__________________
- Akash Kava
My Blog
Web Atoms JS

  #8  
Old 05-05-2006, 01:40 PM
scorpion79 scorpion79 is offline
New Member
 
Join Date: Apr 2006
Posts: 3
how can I bock by country?

  #9  
Old 05-05-2006, 01:57 PM
Saryooo Saryooo is offline
Web Hosting Master
 
Join Date: Nov 2003
Location: Online
Posts: 1,209
how i can block country to register.

  #10  
Old 05-05-2006, 02:48 PM
Domainitor Domainitor is offline
Web Hosting Evangelist
 
Join Date: Jun 2005
Posts: 531
What we do is every month we pick up the IP block allocations from the appropriate regional NIC, then parse the file into a more useable format. We have a daemon process that loads the file and holds it in memory. Our applications send messages to the daemon; the 'request' comprises the IP address and the reply is the two-letter country code that the IP is allocated to.

Here are the ftp addresses for the various regional NICs:
North America: ftp.arin.net/pub/stats/arin/delegated-arin-latest
Europe: ftp.ripe.net/ripe/stats/delegated-ripencc-latest
Asia Pacific: ftp.apnic.net/public/apnic/stats/delegated-apnic-latest
Latin America: ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-latest
Africa: ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-latest

Records are delimited with vertical pipes (the '|' symbol).

The first record is a timestamp. The next two (or three) identify the kinds of data in the file (asn are Autonomous System Numbers, ipv4 and ipv6 are self-explanatory). Then comes the meaningful stuff.....

The third field of each record identifies the type of data. You probably don't care about the 'asn' records (unless you want to filter in your gateway routers). The ipv4 and ipv6 records look like this (this is data from afrinic):

afrinic:EG:ipv4:217.20.224.0:4096:20000925:allocated

The first field identifies afrinic as the source. The second field indicates that this allocation is for Egypt. The third field indicates that it's a Version 4 IP Address. The fourth field tells you the start of the block and the fifth field tells you how many IP Addresses are in the block. Next comes the date in YYYYMMDD format that the block was allocated. And finally, the last field is either 'assigned' or 'allocated' to indicate the status; we treat both equally.

So the example above means that IP Addresses 217.20.224.0 through 217.20.239.255 (that's 4096 IP addresses) were allocated to Egypt on 25-Sep-2000.

It isn't trivial, but it's pretty straightforward.... Hope that helps.

  #11  
Old 05-24-2006, 01:42 PM
jbzepol jbzepol is offline
New Member
 
Join Date: May 2006
Posts: 4
Although I'm just a newbie, and if I understand your question correctly, I think you may be able to acheive what you need by modifying the .htaccess file.

  #12  
Old 05-24-2006, 01:44 PM
jbzepol jbzepol is offline
New Member
 
Join Date: May 2006
Posts: 4
Sorry..here's the appropriate code:

<Limit GET>
order deny,allow
deny from 12.345.6789.ABCD
</Limit>

Reply

Related posts from TheWhir.com
Title Type Date Posted
Web & PHP Conference 2013 Web Hosting Events 2013-09-17 14:48:22
Liquid Web Updates Block Storage, Adding Scale, Cross Mounting Web Hosting News 2012-12-14 16:17:44
Liquid Web Block Storage Offering Provides Flexible, Affordable Storage Option Web Hosting News 2012-11-20 15:03:47
Rackspace Launches OpenStack-Powered Cloud Block Storage Solution Web Hosting News 2012-10-23 10:16:40
OpenStack Adds Networking, Block Storage to Sixth Release Folsom Web Hosting News 2012-09-28 10:55:29


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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 Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?