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

首頁 > 編程 > ASP > 正文

CDN應用的ASP網站如何獲取用戶真實IP

2024-05-04 11:06:52
字體:
來源:轉載
供稿:網友
寫了下asp取真實IP的代碼,搭環境測試無代理、一級或多級代理的情況,可以正常獲取

function checkip(checkstring)'用正則判斷IP是否合法
dim re1
set re1=new RegExp
re1.pattern="^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$"
re1.global=false
re1.Ignorecase=false
checkip=re1.test(checkstring)
set re1=nothing
end function


function get_cli_ip()'取真實IP函數,先 HTTP_CLIENT_IP 再 HTTP_X_FORWARDED_FOR 再 REMOTE_ADDR
dim client_ip
if checkip(Request.ServerVariables("HTTP_CLIENT_IP"))=true then
get_cli_ip = checkip(Request.ServerVariables("HTTP_CLIENT_IP"))
else
MyArray = split(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),",")
if ubound(MyArray)>=0 then
client_ip = trim(MyArray(0))
if checkip(client_ip)=true then
get_cli_ip = client_ip
exit function
end if
end if
get_cli_ip = Request.ServerVariables("REMOTE_ADDR")
end if
end function

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 西青区| 无锡市| 神池县| 汽车| 江安县| 栖霞市| 普定县| 历史| 屏边| 互助| 科技| 邵东县| 岐山县| 洱源县| 河津市| 惠来县| 太仆寺旗| 穆棱市| 鄂尔多斯市| 德保县| 安庆市| 阿拉善盟| 梧州市| 苗栗县| 离岛区| 昌江| 抚松县| 余姚市| 朝阳县| 额济纳旗| 阿克苏市| 刚察县| 宿迁市| 镇原县| 华安县| 陆川县| 郸城县| 宁陵县| 蚌埠市| 隆回县| 稷山县|