The script also includes a function called "Dot2LongIPv6" that converts an IPv6 address to its corresponding IP number. The script retrieves the recordset using the "mysqli_fetch_assoc" function and keeps the country information into two different variables, "$country_code" and "$country_name".įinally, the script displays an advertisement for the visitor's country using the "$country_name" variable, and exits the script using the exit function. ip2location/ip2location-io-php IP2Location.io PHP SDK to get geolocation info from. Then constructs an SQL query string to match the recordset that the IP number falls between the valid range, and executes the query using the "mysqli_query" function. unicloudvn/klbpay-php-sdkv2.0 Client library for Kien Long bank pay. SELECT ipfrom FROM ip2locationproxy WHERE '.ip.' BETWEEN ipfrom AND ipto LIMIT 1 The issue is that this is creating large server load. The script then connects to the MySQL database server using the "mysqli_connect" function and selects the "ip2location" database using the "mysqli_select_db" function. IP2Location C library enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code. Using PHP I convert the users IP to the integer value using ip2long I then use the following SQL query to determine whether the users IP is present in a range in the table. The IP address is converted to an IP number using the "Dot2LongIPv6" function, which uses the "inet_pton" function to convert the IP address to a packed binary string, and then converts that string to a binary representation of the IP number. Then it retrieves the visitor's IP address using the server variable "$_SERVER". *The script first sets the MYSQL server variables to the actual configuration of the database.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |