ASP判断操作系统的代码

以下是Asp判断客户端操作系统源码,支持自定义关键词,支持“<img”方式调用:

<%
Function GetSysVer() '获取系统类型(可以判断:29种操作系统(包括手机))
GetSysVer="Other Unknown"
TheInfo = UCase(Request.ServerVariables("HTTP_USER_AGENT"))
if Instr(TheInfo,UCase("x11"))>0 or Instr(TheInfo,UCase("Unix"))>0 then GetSysVer="Unix"
if Instr(TheInfo,UCase("Sunos"))>0 or Instr(TheInfo,UCase("SUN OS"))>0 then GetSysVer="SUN OS"
if Instr(TheInfo,UCase("PowerPC"))>0 or Instr(TheInfo,UCase("PPC"))>0 then GetSysVer="PowerPC"
if Instr(TheInfo,UCase("Macintosh"))>0 then GetSysVer="Mac"
if Instr(TheInfo,UCase("Mac OSX"))>0 then GetSysVer="MacOSX"
if Instr(TheInfo,UCase("FreeBSD"))>0 then GetSysVer="FreeBSD"
if Instr(TheInfo,UCase("Linux"))>0 then GetSysVer="Linux"
if Instr(TheInfo,UCase("Palmsource"))>0 or Instr(TheInfo,UCase("PalmOS"))>0 then GetSysVer="PalmOS"
if Instr(TheInfo,UCase("WAP"))>0 then GetSysVer="WAP Mobile Phone"
if Instr(TheInfo,UCase("Win98"))>0 then GetSysVer="Win 98"
if Instr(TheInfo,UCase("NOKIAN"))>0 then GetSysVer="NOKIAN(诺基亚手机)"
if Instr(TheInfo,UCase("Media Center"))>0 then GetSysVer="Windows XP Media Center PC"
if Instr(TheInfo,UCase("Windows"))>0 then
GetSysVer="Windows Series"
if Instr(TheInfo,UCase("Windows CE"))>0 then GetSysVer="Windows CE"
if Instr(TheInfo,UCase("Windows 95"))>0 then GetSysVer="Windows 95"
if Instr(TheInfo,UCase("Windows 98"))>0 then GetSysVer="Windows 98"
if Instr(TheInfo,UCase("Windows 2000"))>0 then GetSysVer="Windows 2000"
if Instr(TheInfo,UCase("Windows XP"))>0 then GetSysVer="Windows XP"
if Instr(TheInfo,UCase("Windows NT"))>0 then
GetSysVer="Windows NT Series"
if Instr(TheInfo,UCase("Windows NT 4.0"))>0 then GetSysVer="Windows 9x/98/95"
if Instr(TheInfo,UCase("Windows NT 5.0"))>0 then GetSysVer="Windows 2000"
if Instr(TheInfo,UCase("Windows NT 5.1"))>0 then GetSysVer="Windows XP"
if Instr(TheInfo,UCase("Windows NT 5.2"))>0 then GetSysVer="Windows Server 2003"
if Instr(TheInfo,UCase("Windows NT 6.0"))>0 then GetSysVer="Windows Vista/Windows Server 2008"
if Instr(TheInfo,UCase("Windows NT 6.1"))>0 then GetSysVer="Windows Server 2008 R2/Windows 7 Series"
end if
end if
if Instr(TheInfo,UCase("Tablet PC"))>0 then GetSysVer=GetSysVer & "-Tablet PC(平板电脑)"
if Instr(TheInfo,UCase("Jakarta Commons"))>0 then GetSysVer=GetSysVer & "-Jakarta Commons-HttpClient"
if Instr(TheInfo,UCase("bsalsa.com"))>0 then GetSysVer=GetSysVer & "-[BOT]bsalsa.com(搜索引型)"
End Function
Response.Write GetSysVer
%>

原文地址:
http://www.yuzhiguo.com/articleview.asp?id=515

Related Posts