How PHP prohibits access to an IP or IP address segment
This article mainly introduces the PHP prohibit IP or IP address segment access method, involving the server variable $_server, file and string operation skills, with a cert
Php ip address and IP address segment access restriction code. Read the php ip address and IP address segment access restriction code. several functions have been written, and the IP ad
Php code for restricting access from a single IP address and ip address segment
I will share two pieces of php code that limits IP address access. There are two examples of code: restrict access from a single IP address and restrict access from an
The code is as follows
Copy Code
"Get the address of the visitorIp=request.servervariables ("REMOTE_ADDR")' The allowed IP address segment is 10.0.0.0~10.68.63.255allowip1= "10.0.0.0"Allowip2= "10.68.10.71"Response.writecheckip (IP,ALLOWIP1,ALLOWIP2)Functioncheckip (IP,ALLOWIP1,ALLOWIP2)Dimcheck (4)Che
Idea: Convert two IP to a number to compare, the small one slowly add one, until become the big that IP converted number, this one of the number is converted to IP address that is the IP segment all the IP.1 //
Iptables Shielded IP
The code is as follows
Copy Code
Iptables-i input-s 202.77.176.106-j DROP
An entire paragraph, the order from 192.0.0.1 to 192.255.255.254.
The code is as follows
Copy Code
Iptables-i input-s 192.0.0.0/8-j DROP
Prohibit IP paragraph when to see the amount of clearance, do not bar their own
Copy Code code as follows:
"Get the address of the visitor
Ip=request.servervariables ("REMOTE_ADDR")
' The allowed IP address segment is 10.0.0.0~10.68.63.255
allowip1= "10.0.0.0"
Allowip2= "10.68.10.71"
Response.writecheckip (IP,ALLOWIP1,ALLOWIP2)
Functioncheckip (IP
Share the PHP implementation of the IP access restrictions of two pieces of code, divided into a limited number of single IP access and restrict access to the IP segment of the two code, the need for a friend reference.
Add IP Access Restrictions
Common linux practicesIptables reference rules The code is as follows:Copy code Iptables-I INPUT-p tcp-dport 80-m-mac-soruce $ MAC-j DROPIptables-I INPUT-p tcp-dport 80-s $ IP-j DROP IP address-based Method 1,First, create the following configuration file and place it under the nginx conf directory, and name it blocksip. conf:Add the following code: The code is as follows:Copy code # Shielding soso
How to make the VMware IP on the same network segment as the native IPoriginal May 08, 2017 17:28:56
1287
First verify that the native IPYou can see the information:Native ip:192.168.1.162Gateway: 192.168.1.1DNS server: 192.168.1.1There are two types of virtual machine network adapters: VMnet1 and VMnet8.
View Virtual Machine network adapter
This article describes the PHP ban on an IP or IP address section of the method of access to share for everyone to reference. The specific analysis is as follows:
Because I haven't studied Apache and Nginx, I've written a small program that can disable the address in PHP.Only when used:
Can
Disable individual IP as follows:
Ban.dat files are a
PHP restricts IP segment access, prevents IP from submitting the form's code
Recently, the small series found that there is a Yunnan netizen often in help the home to publish some rubbish information comment, because www.bkjia.com system dedecms frame, systems itself does not prohibit the IP function, every day see th
If in our VPS, the server needs to be for an IP or an IP segment shielding, directly can be added in the Nginx and Apache rules, such use is often useful, such as not to allow a User IP address access or spider crawling information, or even some collection, mirror IP address
(allow2 (2)> cint (ipstr (2) then
Checkip = true
Endif
Endfunction
%>
Add the following code to your ASP page to test the effect:Copy codeThe Code is as follows: 'The set of blocked IP addresses (segments). The asterisk is a wildcard and is usually stored in the configuration file.Const BadIPGroup = "192.168.1. * | 202. 68. *. * | *. 12.55.34 | 185. *. 96.24 | 127. *. 0.1 | 192.168.0.1"If IsForbidIP (BadIPGroup) = True ThenResponse. Write (GetIP "Ac
PHP prohibits an IP or IP address segment access method, Phpip
The example of this article describes the PHP block IP or IP address segment access method, shared for everyone for reference. The specific analysis is as follows:
Be
Recently the company's website is frequently accessed by competitors with crawlers, so we have to prohibit these crawler access, we can through the Nginx command to achieveMethod One: The IP is sealed directly on the LB machine1. Add the IP or IP port to be shielded in the blocksip.conf file$ sudo vim/etc/nginx/blocksip.confdeny 180.168.74.26;deny 91.212.45.0/24;
address is the same, the network interface will be automatically down, that is, onboot = No.[Root @ test network-Scripts] # service network restart// After the configuration is complete, restart the network service to connect to the new network segment.[Root @ test network-Scripts] # route-nKernel IP routing tableDestination gateway genmask flags metric ref useIface172.16.1.0 0.0.0.0 255.255.255.0 u 0 0 0E
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.