Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 21-01-2011, 08:36 AM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
Block IP nước ngoài cho website, Vbulletin
Block IP nước ngoài cho website, Vbulletin

Thực sự là rất đau đầu khi 4rum của mình mỗi ngày có hơn chục thằng ở nước ngoài cứ nhảy vô spam link quảng cáo, aff, xxx ... :cooltq: Ban nó reg nick mới, block ip nó thì fake, không hơi sức đâu mà cứ đi deny từng IP. :sweat:
Nhưng với bài viết dưới đây vấn đề đó sẽ được giải quyết :cute_smiley69:

Bài viết này sẽ hướng dẫn các bạn sử dụng trong 4rum vBB được sử dụng khá phổ biến, và đặc biệt có ích cho các bản null, các code mã nguồn khác tương tự, nếu bạn cho chút ít vốn liếng về php :teacup11:

Cách 1:

Đầu tiên down 2 file này về up lên thư mục nào đó ví dụ thư mục banip chẳng hạn.

http://quantrinet.com/forum/banip/geoip.dat

http://quantrinet.com/forum/banip/geoip.inc




File đầu tiên phải giải nén ra rồi mới up lên nhá!

Típ theo tạo một file php (banip.php chẳng hạn) như sau rồi up lên thư mục banip luôn cho dễ quản lý:
Mã PHP:

 <?php

$ip 
getenv"REMOTE_ADDR" ); // Check IP đang truy cập

if( isset( $ip ) )
{

$path "banip"// tên của thư mục con nơi chứ 2 files trên

require( "$path/geoip.inc" );
$gi geoip_open"$path/GeoIP.dat"GEOIP_STANDARD );
$country_code geoip_country_code_by_addr$gi$ip );
$country_name geoip_country_name_by_addr$gi$ip );
//Ban tất cả IP trừ VN
if( $country_code != "VN" )
{
header"location: ./error.html" ); // Dẫn nó tới trang lỗi,hoặc anh em muốn dẫn nó đi đâu cũng đc
//end if

//end if

?>


Chỗ màu đỏ có thể thay đổi nếu muốn

Rồi, giờ edit file global.php: thêm vào dưới dòng <?php trong file global.php đoạn mã này:

Mã PHP:

   
require_once('./banip/banip.php'); 



Tip theo tạo một file error.html để báo lỗi up lên cùng thư mục chính của 4rum, thỉnh thoảng vào down lại 2 file trên để cập nhật các chú IP mới!


Cách 2: Tạo file .htaccess

Mã PHP:

Deny from all
Allow from 2_số_đầu_của_các_IP_vn 


VD
Mã:

Mã PHP:

Deny from all
Allow from 193.
Allow from 213.
Allow from 74.208.104.90
Allow from 58.186
.
Allow from 58.187.
Allow from 61.28.224.0/19
Allow from 65.110.39.190
Allow from 65.110.39.191
Allow from 65.110.39.192
Allow from 65.110.39.193
Allow from 65.110.39.194
Allow from 65.110.39.195
Allow from 65.110.39.196
Allow from 65.110.39.197
Allow from 65.110.39.198
Allow from 65.110.39.199
Allow from 69.13.190.127
Allow from 69.13.190.128
Allow from 69.13.190.129
Allow from 69.13.190.130
Allow from 69.13.190.131
Allow from 69.13.190.132
Allow from 69.13.190.133
Allow from 69.13.190.134
Allow from 69.13.190.135
Allow from 74.50.8.240
Allow from 72.249.68
.
Allow from 116.68.128.0/21
Allow from 116.96
.
Allow from 116.97.
Allow from 116.98.
Allow from 116.99.
Allow from 116.100.
Allow from 116.101.
Allow from 116.102.
Allow from 116.103.
Allow from 116.104.
Allow from 116.105.
Allow from 116.106.
Allow from 116.107.
Allow from 116.108.
Allow from 116.109.
Allow from 116.110.
Allow from 116.111.
Allow from 116.118.0.0/17
Allow from 116.193.64.0
/20
Allow from 117.0
.
Allow from 117.1.
Allow from 117.2.
Allow from 117.3.
Allow from 117.4.
Allow from 117.5.
Allow from 117.6.
Allow from 117.7.
Allow from 117.103.192.0/18
Allow from 117.122.0.0
/17
Allow from 118.68
.
Allow from 118.69.
Allow from 118.70.
Allow from 118.71.
Allow from 118.102.0.0/21
Allow from 122.201.8.0
/21
Allow from 123.16.0.0
/12
Allow from 123.20.0
.
Allow from 125.212.128.0/17
Allow from 125.214.0.0
/18
Allow from 125.234
.
Allow from 125.235.
Allow from 134.159.99.
Allow from 134.159.138.
Allow from 202.6.2.
Allow from 202.6.96.
Allow from 202.6.97.
Allow from 202.47.142.
Allow from 202.60.104.0/21
Allow from 202.78.224.0
/21
Allow from 202.79.232.0
/21
Allow from 202.87.212.0
/22
Allow from 202.92.4.0
/22
Allow from 202.93.156.0
/22
Allow from 202.134.16.0
/21
Allow from 202.151.160.0
/20
Allow from 202.151.170
.
Allow from 202.151.172.
Allow from 202.160.124.0/23
Allow from 202.172.4.0
/23
Allow from 202.174.156.128
/26
Allow from 203.77.178
.
Allow from 203.99.248.0/22
Allow from 203.113.128.0
/18
Allow from 203.119.8.0
/22
Allow from 203.119.36.0
/22
Allow from 203.119.44.0
/22
Allow from 203.128.240.0
/22
Allow from 203.160.0.0
/23
Allow from 203.160.96.0
/21
Allow from 203.161.0.0
/22
Allow from 203.162
.
Allow from 203.171.16.0/20
Allow from 203.176.160.0
/21
Allow from 203.190.160.0
/20
Allow from 203.191.8.0
/21
Allow from 203.191.48.0
/21
Allow from 203.210.128.0
/17
Allow from 206.49.194.32
/25
Allow from 206.49.194.128
/26
Allow from 206.49.194.193
/27
Allow from 206.49.196.0
/26
Allow from 206.49.196.128
/27
Allow from 207.58.144.216
Allow from 207.58.144.217
Allow from 207.58.144.218
Allow from 207.58.144.219
Allow from 207.58.144.220
Allow from 207.58.144.221
Allow from 207.58.144.222
Allow from 207.58.144.223
Allow from 209.200.226.5
Allow from 209.200.226.6
Allow from 209.200.226.7
Allow from 209.200.226.8
Allow from 209.200.226.9
Allow from 209.200.226.10
Allow from 209.200.226.11
Allow from 209.200.226.12
Allow from 210.86.224.0
/20
Allow from 210.245.0.0
/17
Allow from 210.86.238
.
Allow from 218.100.10.
Allow from 218.100.14.
Allow from 220.231.64.0/18
Allow from 221.121.0.0
/18
Allow from 221.132.0.0
/18
Allow from 221.133.0.0
/19
Allow from 222.252.0.0
/14
Allow from 222.253
.
Allow from 66.249.
Allow from 64.208.172.176
Allow from 58.186.0.0
/16
Allow from 58.187.0.0
/16
Allow from 118.68.0.0
/16
Allow from 118.69.0.0
/16
Allow from 118.70.0.0
/16
Allow from 118.71.0.0
/16
Allow from 210.245.0.0
/19
Allow from 210.245.32.0
/19
Allow from 210.245.64.0
/18
Allow from 123.16.0.0
/16
Allow from 123.17.0.0
/16
Allow from 123.18.0.0
/16
Allow from 123.19.0.0
/16
Allow from 123.20.0.0
/16
Allow from 123.21.0.0
/16
Allow from 123.22.0.0
/16
Allow from 123.23.0.0
/16
Allow from 123.24.0.0
/16
Allow from 123.25.0.0
/16
Allow from 123.26.0.0
/16
Allow from 123.27.0.0
/16
Allow from 123.28.0.0
/16
Allow from 123.29.0.0
/16
Allow from 123.30.0.0
/16
Allow from 123.31.0.0
/16
Allow from 203.160.0.0
/23
Allow from 203.162.0.0
/21
Allow from 203.162.8.0
/21
Allow from 203.162.16.0
/20
Allow from 203.162.32.0
/20
Allow from 203.162.48.0
/22
Allow from 203.162.52.0
/23
Allow from 203.162.54.0
/24
Allow from 203.162.55.0
/23
Allow from 203.162.58.0
/23
Allow from 203.162.60.0
/22
Allow from 203.162.64.0
/23
Allow from 203.162.66.0
/24
Allow from 203.162.68.0
/22
Allow from 203.162.72.0
/21
Allow from 203.162.80.0
/23
Allow from 203.162.82.0
/23
Allow from 203.162.84.0
/23
Allow from 203.162.86.0
/24
Allow from 203.162.88.0
/21
Allow from 203.162.96.0
/19
Allow from 203.162.128.0
/20
Allow from 203.162.144.0
/19
Allow from 203.162.176.0
/20
Allow from 203.162.192.0
/18
Allow from 203.210.128.0
/20
Allow from 203.210.144.0
/20
Allow from 203.210.160.0
/21
Allow from 203.210.180.0
/22
Allow from 203.210.192.0
/18
Allow from 221.132.0.0
/18
Allow from 222.252.0.0
/16
Allow from 222.253.0.0
/16
Allow from 222.254.0.0
/16
Allow from 222.255.0.0
/16
Allow from 119.15.160.0
/20
Allow from 119.15.176.0
/20
Allow from 119.17.192.0
/19
Allow from 119.17.224.0
/19
Allow from 202.151.160.0
/21
Allow from 202.151.168.0
/21
Allow from 210.86.224.0
/21
Allow from 210.86.232.0
/21
Allow from 117.0.0.0
/16
Allow from 117.1.0.0
/16
Allow from 117.2.0.0
/16
Allow from 117.3.0.0
/16
Allow from 117.4.0.0
/16
Allow from 117.5.0.0
/16
Allow from 117.6.0.0
/16
Allow from 117.7.0.0
/16
Allow from 125.234.0.0
/16
Allow from 125.235.0.0
/16
Allow from 203.113.128.0
/19
Allow from 203.113.160.0
/19
Allow from 220.231.64.0
/18
Allow from 116.118.0.0
/17
Allow from 221.121.0.0
/18
Allow from 221.133.0.0
/19
Allow from 202.60.104.0
/21
Allow from 202.6.96.0
/23
Allow from 203.99.248.0
/22
Allow from 202.6.2.0
/24
Allow from 203.176.160.0
/21
Allow from 116.193.64.0
/20
Allow from 120.72.80.0
/21
Allow from 120.72.96.0
/19
Allow from 202.78.224.0
/21
Allow from 118.102.0.0
/21
Allow from 120.138.64.0
/20
Allow from 122.201.8.0
/23
Allow from 122.201.10.0
/24
Allow from 122.201.11.0
/24
Allow from 122.201.12.0
/22
Allow from 202.47.142.0
/24
Allow from 202.191.56.0
/22
Allow from 203.191.8.0
/21
Allow from 203.77.178.0
/24
Allow from 202.79.232.0
/21
Allow from 202.172.4.0
/23
Allow from 116.68.128.0
/21
Allow from 117.103.192.0
/18
Allow from 202.134.16.0
/21
Allow from 203.171.16.0
/20
Allow from 202.87.212.0
/22
Allow from 61.28.224.0
/19
Allow from 119.18.184.0
/21
Allow from 119.82.128.0
/20
Allow from 203.160.96.0
/21
Allow from 119.18.128.0
/20
Allow from 203.191.48.0
/21
Allow from 202.92.4.0
/22
Allow from 203.128.240.0
/21
Allow from 202.160.124.0
/23
Allow from 120.50.184.0
/21
Allow from 203.189.28.0
/22
Allow from 202.93.156.0
/22 


Data Ip việt nam nè :cute_smiley69:

Mã PHP:

 58.186.0.0 
58.187.255.255
61.28.224.0 
61.28.255.255
65.110.39.190 
65.110.39.199
69.13.190.127 
69.13.190.135
72.249.68.0 
72.249.68.255
116.68.128.0 
116.68.135.255
116.96.0.0 
116.111.255.255
116.118.0.0 
116.118.127.255
116.193.64.0 
116.193.79.255
117.0.0.0 
117.7.255.255
117.103.192.0 
117.103.255.255
117.122.0.0 
117.122.127.255
118.68.0.0 
118.71.255.255
118.102.0.0 
118.102.7.255
119.15.160.0 
119.15.191.255
119.17.192.0 
119.17.255.255
119.18.128.0 
119.18.143.255
119.18.184.0 
119.18.191.255
119.82.128.0 
119.82.143.255
120.50.184.0 
120.50.191.255
120.72.80.0 
120.72.87.255
120.72.96.0 
120.72.127.255
120.138.64.0 
120.138.79.255
122.201.8.0 
122.201.15.255
123.16.0.0 
123.31.255.255
125.212.128.0 
125.212.255.255
125.214.0.0 
125.214.63.255
125.234.0.0 
125.235.255.255
134.159.138.0 
134.159.138.255
169.211.5.0 
169.211.5.255
202.6.2.0 
202.6.2.255
202.6.96.0 
202.6.97.255
202.47.142.0 
202.47.142.255
202.60.104.0 
202.60.111.255
202.78.224.0 
202.78.231.255
202.79.232.0 
202.79.239.255
202.87.212.0 
202.87.215.255
202.92.4.0 
202.92.7.255
202.93.156.0 
202.93.159.255
202.134.16.0 
202.134.23.255
202.151.160.0 
202.151.175.255
202.160.124.0 
202.160.125.255
202.172.4.0 
202.172.5.255
202.174.156.128 
202.174.156.191
202.191.56.0 
202.191.59.255
203.77.178.0 
203.77.178.255
203.99.248.0 
203.99.251.255
203.113.128.0 
203.113.191.255
203.119.8.0 
203.119.11.255
203.119.36.0 
203.119.39.255
203.119.44.0 
203.119.47.255
203.128.240.0 
203.128.247.255
203.160.0.0 
203.160.1.255
203.160.96.0 
203.160.103.255
203.161.0.0 
203.161.3.255
203.162.0.0 
203.162.255.255
203.171.16.0 
203.171.31.255
203.176.160.0 
203.176.167.255
203.189.28.0 
203.189.31.255
203.190.160.0 
203.190.175.255
203.191.8.0 
203.191.15.255
203.191.48.0 
203.191.55.255
203.210.128.0 
203.210.255.255
206.49.194.32 
206.49.194.111
206.49.194.128 
206.49.194.223
206.49.196.0 
206.49.196.63
206.49.196.128 
206.49.196.159
207.58.144.216 
207.58.144.223
209.200.226.5 
209.200.226.12
210.86.224.0 
210.86.239.255
210.245.0.0 
210.245.127.255
218.100.10.0 
218.100.10.255
218.100.14.0 
218.100.14.255
220.231.64.0 
220.231.127.255
221.121.0.0 
221.121.63.255
221.132.0.0 
221.132.63.255
221.133.0.0 
221.133.31.255
222.252.0.0 
222.255.255.255
252.0.0.83 
53.0.0.85 






* Mình muốn ip
vn vào vn.html
cn chuyển tới cn.html
en chuyển tới
v.v.v. thì làm thế nào?

Để làm như vậy bạn chú ý đến đoạn code này :



Mã:
//Ban tất cả IP trừ VN
if( $country_code != "VN" )
{
header( "location: ./error.html" ); // Dẫn nó tới trang lỗi,hoặc anh em muốn dẫn nó đi đâu cũng đc
} //end if
Bạn chỉ cần tùy biến lại đôi chút là có thể làm được như bạn mong muốn :


Mã:
if( $country_code == "VN" )
{
header( "location: vn.html" ); // Dẫn nó tới trang mà bạn muốn
}
Else if( $country_code == "CN" )
{
header( "location: cn.html" ); // Dẫn nó tới trang mà bạn muốn
}
...................
//end if

Danh Sach IP Viet Nam

http://khoancatbetong.com/forum/view...hp?f=61&t=3530

http://www.vnix.vn/4-6-300-0-7-00-20041115.htm




Chuc cac ban thanh cong!



  Trả lời ngay kèm theo trích dẫn này
Tuổi 10-02-2011, 03:41 PM   #2
ZergoBoch
Newbie
 
Gia nhập: Jan 2011
Trả Lời: 9
1 футболки в твоё
thanks


Last edited by hoctinhoc; 11-02-2011 at 08:07 AM..
ZergoBoch vắng mặt   Trả lời ngay kèm theo trích dẫn này
Gửi trả lời


Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
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 Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 04:44 PM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.