根据IP跳转到用户所在城市的实现步骤
根据IP跳转到用户所在城市自动识别IP,并跳转到来访问者所在的城市
先去下一个最新的纯真IP数据库,然后按如下操作:1.运行纯真QQIP数据库里带的ShowIP.exe,点解压,输入文件名,比如IP.txt,确定,就得到一个TXT文件。
2.打开ACCESS,工具-自定义,命令选项卡,把导入选项拖动到上面的工具栏。
3.建库,建一个表,四个字段
Startip 类型:文本 (相关城市的IP段信息)
Endip 类型:文本 (相关城市的IP段信息)
Country 类型:文本 (相关城市名称)
ReUrl 类型:文本 (你想要跳转的城市路径如:北京 http://bj.abc.com)
4.点导入按钮,文件类型选文本文件,找到刚才导出的IP.txt文件,导入到刚才建的表里~
运算将真实IP转换为数字,比如北京的IP段是 : 1.1.0.0 -- 1.1.0.255
Startip: 1*256*256*256+1*256*256+0*256+0 = 16842752 (这个数字才是最终要放到数据库里)
Endip: 1*256*256*256+1*256*256+0*256+255 = 16843007 (这个数字才是最终要放到数据库里的)
可用程序批量处理,如果不会,而且没时间(像我一样)你就直接去下个动网的IP库,它是已经处理好了的,下面是程序部分:
user_ip = Request.ServerVariables("REMOTE_ADDR") ''取得访问者IP
userip_ary=split(user_ip,".")
tmp_userip=userip_ary(0)*256*256*256+userip_ary(1)*256*256+userip_ary(2)*256+userip_ary(3) '' 按规定转换IP为数字
‘从数据库找出用户IP属于的城市
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from ip where Startip="&tmp_userip
rs.open sql,conn,1,1
if rs.eof then
response.redirect "index.asp" '如果没有该城市或是IP无法识别则转到首页,也可以指定页面
else
response.redirect rs("ReUrl") '如果有转到指定页面
end if
rs.close
set rs=nothing
将上面的程序放到你的虚拟主机默认访问首页里!或是其它的页面里(当然你同样要在虚拟主机控制面板里设置默认首先访问的是这个文件) OK

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











1. Black/white list IP restricted access configuration nginx There are several ways to configure black and white lists. Here are only two commonly used methods. 1. The first method: allow, denydeny and allow instructions belong to ngx_http_access_module. nginx loads this module by default, so it can be used directly. This method is the simplest and most direct. The setting is similar to the firewall iptable. How to use: Add directly to the configuration file: #Whitelist settings, followed by allow is accessible IPlocation/{allow123.13.123.12;allow23.53.32.1/100;denyall;}#Blacklist settings,

IP and mac binding refers to associating a specific IP address with a specific MAC address, so that only the device using the MAC address can use the IP address for network communication. Binding ip and mac can prevent the IP address of the bound host from being spoofed. Prerequisites: 1. The MAC address is unique and cannot be spoofed; it can only be bound to hosts on the network directly connected to the router (that is, The host's gateway is on the router).

How to implement page jump after PHP form submission [Introduction] In web development, form submission is a common functional requirement. After the user fills out the form and clicks the submit button, the form data usually needs to be sent to the server for processing, and the user is redirected to another page after processing. This article will introduce how to use PHP to implement page jump after form submission. [Step 1: HTML Form] First, we need to write a page containing a form in an HTML page so that users can fill in the data that needs to be submitted.

1. Set the directory whitelist: There is no restriction on the specified request path. If there is no restriction on the request path to the api directory, it can be written as server{location/app{proxy_passhttp://192.168.1.111:8095/app ;limit_connconn20;limit_rate500k;limit_reqzone=fooburst=5nodelay;}location/app/api{proxy_passhttp://192.168.1.111:8095/app/api}}#Because nginx will give priority to accurate matching

How to check the IP address on WeChat: 1. Log in to the computer version of WeChat, right-click the taskbar at the bottom of the screen, and click "Task Manager"; 2. When the task manager pops up, click "Details" in the lower left corner; 3. Task management Enter the "Performance" option of the browser and click "Open Resource Monitor"; 4. Select "Network" and check the WeChat process "Wechat.exe"; 5. Click "TCP Connection" below to monitor the WeChat network IP related situation. Sending a message and getting a reply will reveal the other person's IP address.

Concept: uv (uniquevisitor): unique visitor, each independent Internet computer (based on cookies) is regarded as a visitor, and the number of visitors who visit your website within a day (00:00-24:00). Visits to the same cookie within a day are only counted once PV (pageview): visits, that is, page views or clicks, each visit to the website by the user is recorded once. When a user visits the same page multiple times, the total number of visits is counted. Independent IP: The same IP address is only counted once within 00:00-24:00. Friends who do website optimization are most concerned about this. Let me first state the environment. This run nginx version 1.7, the backend tomcat runs dynamic

Solution to wifi showing no IP allocation: 1. Restart the device and router, turn off the Wi-Fi connection on the device, turn off the device, turn off the router, wait a few minutes, then reopen the router to connect to wifi; 2. Check the router settings and restart DHCP, make sure the DHCP function is enabled; 3. Reset network settings, which will delete all saved WiFi networks and passwords. Please make sure they are backed up before performing this operation; 4. Update the router firmware, log in to the router management interface, and find the firmware Update options and follow the prompts.

PHP login jump value transfer method: 1. POST value transfer, use the HTML "form" form jump method to post value transfer; 2. GET transfer value, use the <a> tag to jump to xxx.php , obtain the passed value through "$_GET['id']"; 3. SESSION passes the value. Once saved in SESSION, other pages can be obtained through SESSION.
