首页 新闻 搜索 专区 学院

将vbscript脚本转为javascript脚本

0
悬赏园豆:50 [已关闭问题] 关闭于 2020-01-23 17:52

请帮忙将下列获取IP的vbscript脚本改成javascript脚本:

Class IPClass
Public Function getaddrIP()
Dim strIPAddr
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
Else
strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If

    getaddrIP = Trim(Mid(strIPAddr, 1, 30)) 
End Function

End Class

lzhdim的主页 lzhdim | 小虾三级 | 园豆:659
提问于:2020-01-23 17:13
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册