朱祁钰和杭:request.servervariables
一,获得网页来访者IP地址的代码是:
您的IP是: <% =Request.ServerVariables("REMOTE_ADDR") %>
二,获得操作系统版本的代码是:
<% response.Write operationsystem & "<br>" & browser
function operationsystem() '操作系统版本
agent = Request.ServerVariables("HTTP_USER_AGENT")
if Instr(agent,"NT 5.2")>0 then
SystemVer="Windows Server 2003"
elseif Instr(agent,"NT 5.1")>0 then
SystemVer="Windows XP"
elseif Instr(agent,"NT 5")>0 then
SystemVer="Windows 2000"
elseif Instr(agent,"NT 4")>0 then
SystemVer="Windows NT4"
elseif Instr(agent,"4.9")>0 then
SystemVer="Windows ME"
elseif Instr(agent,"98")>0 then
SystemVer="Windows 98"
elseif Instr(agent,"95")>0 then
SystemVer="Windows 95"
else
SystemVer="未知"
end if
operationsystem="您的操作系统是: " & SystemVer
end function %>
三,获得浏览器版本的代码是:
<% function browser() '浏览器版本
agent = Request.ServerVariables("HTTP_USER_AGENT")
if Instr(agent,"MSIE 6.0")>0 then
browserVer="Internet Explorer 6.0"
elseif Instr(agent,"MSIE 5.5")>0 then
browserVer="Internet Explorer 5.5"
elseif Instr(agent,"MSIE 5.01")>0 then
browserVer="Internet Explorer 5.01"
elseif Instr(agent,"MSIE 5.0")>0 then
browserVer="Internet Explorer 5.00"
elseif Instr(agent,"MSIE 4.0")>0 then
browserVer="Internet Explorer 4.0"
else
browserVer="未知"
end if
browser="您的浏览器版本: " & browserVer
if Instr(agent,"TencentTraveler")>0 then '检查是否正在使用腾讯TT
browser=browser&" |目前正使用TencentTraveler"
end if
end function %>