Php displays ip addresses based on database ip segments

Source: Internet
Author: User
Tags php database
I now have a database ipatt with three fields ip_start (starting IP) ip_end (ending IP) ip_att (IP ending location) now $ user_ip is available. I want to implement ip_att display when ip_startip_end is in a certain ip_startip_end range. if the table contains the two tags, I want to implement 0.11.12.12 display A12.193.65.200 display B. how to compare ip addresses? now I (... php database

I now have a database ipatt with three fields ip_start (starting IP) ip_end (ending IP) ip_att (IP ending location)
$ User_ip
I want to display ip_att in a certain ip_start ip_end range.

Assume that the table contains the two
0.0.0.0 0.20.255.255
12.0.64.0 12.194.255.255 B
I want to implement
0.11.12.12 show
12.193.65.200 display B

How to compare IP addresses
I want to write a function get_ip_att ($ user_ip)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.