It turns out that you need to turn IP into decimal.
Copy the Code code as follows:
$ip = $_server[' remote_addr ');echo ' Your IP: '. $ip. '';$ip _arr = Explode (".", $ip);$ip = 0;foreach ($ip _arr as $i = + $s) {$ip + = $s *pow (256,3-$i);}echo '
This article describes how to query ip address locations in php. it is a very common practical technique for pure ip database, for more information about how to query ip addresses in php, see the following example. Share it with you for your
The pure version of IP data files can be used to optimize the query method, improve the format conversion efficiency, reduce the number of file reads, and quickly query IP addresses online. Greatly reduce the number of file reads, which should be
Php queries the region (pure ip database) based on the ip address ). Pure ip library download? PhpclassIpLocation {*** @ varresource pointer * private $ fp; *** offset address of the first IP record * @ varint * private $ firstip; * ** download the
Questions:I am a cainiao network. Our company has set up a local area network, and now we have set up an office around 12 kilometers away from the company. Now we need to add a new computer to access the company's local area network to share the
SummaryIn CDN system, IP address library plays an important role in traffic scheduling and network service quality monitoring, this paper mainly introduces the function and content of IP address library and the method of generating and evaluating IP
Get IP Address
Copy CodeThe code is as follows:
function GetIP () {
if ($_server["http_x_forwarded_for"])
$ip = $_server["Http_x_forwarded_for"];
else if ($_server["HTTP_CLIENT_IP"])
$ip = $_server["Http_client_ip"];
else if ($_server["REMOTE_ADDR"
"The IP address is a 32-bit IP address, which is divided into four segments. Each segment has eight digits, which are expressed in decimal numbers. The value range of each segment is 0 ~ 255. segments and segments are separated by periods ."
As a
Get IP Address
Copy Code code as follows:
function GetIP () {
if ($_server["http_x_forwarded_for"])
$ip = $_server["Http_x_forwarded_for"];
else if ($_server["HTTP_CLIENT_IP"])
$ip = $_server["Http_client_ip"];
else if
This task was taken over from Mr. Mi (the blog of MI Xinjiang. The purpose is to add restrictions to the examination system to prevent students from logging on outside of the examination in the LAN.
It sounds easy to filter IP addresses. The final
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.