国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

asp 根據(jù)IP地址自動(dòng)判斷轉(zhuǎn)向分站的代碼

2024-05-04 11:09:05
字體:
供稿:網(wǎng)友
根據(jù)IP地址自動(dòng)判斷轉(zhuǎn)向分站的代碼 這個(gè)是一個(gè)不錯(cuò)的解決之道,可以緩解服務(wù)器壓力過大等一些問題
 
 
 
Function getIpvalue(clientIP)'得到客戶端的IP轉(zhuǎn)換成長(zhǎng)整型,返回值getIpvalue 
On Error Resume Next 
Dim strIp, array_Ip 
strIp=0 
array_Ip = Split(clientIP,".") 
If UBound(array_Ip)<>3 Then 
getIpvalue=0 
Exit Function 
End If 
For i=0 To 3 
strIp=strIp+(CInt(array_Ip(i))*(256^(3-i))) 
Next 
getIpvalue=strIp 
If Err Then getIpvalue=0 
End Function 
clientIP=request.ServerVariables("REMOTE_HOST") 
IpValue=getIpvalue(clientIP) 
strSql="select top 1 City from [Ipaddress] where "&IpValue&" 
between Ip1 and Ip2" 
Set RsIp=conn.execute(strSql) 
If RsIp.bof and RsIp.eof then 
UrlCity="未知" 
Else 
UrlCity=RsIp.Fields.Item("City").Value 
End If 
if instr(UrlCity,"廣州")<>0 then 
response.Redirect("http://www.survivalescaperooms.com") 
end if 
if instr(UrlCity,"深圳")<>0 then 
response.Redirect("http://js.vevb.com") 
end if 
if instr(UrlCity,"上海")<>0 then 
response.Redirect("http://tool.vevb.com") 
end if 
所用到的IP數(shù)據(jù)庫可以去網(wǎng)上down一個(gè)回來
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 兴化市| 社旗县| 宜丰县| 灵宝市| 千阳县| 秦安县| 兰坪| 安乡县| 河间市| 文昌市| 双鸭山市| 祥云县| 若尔盖县| 奎屯市| 五台县| 五大连池市| 利辛县| 建昌县| 昔阳县| 中超| 高邮市| 辽中县| 甘肃省| 九龙县| 邵阳县| 石家庄市| 新晃| 瑞金市| 息烽县| 凤冈县| 会理县| 泾阳县| 都兰县| 塔河县| 平遥县| 奇台县| 唐河县| 垫江县| 南岸区| 珲春市| 阳信县|