呵呵
我自己在网站找到这些文件了
还是网络比较好
这里是我成长的地方,怎么最近这么冷啊!
我就把我搜集的代码贴到这里,大家共享吧!
当前在线<%=Application("ActiveUsers")%>人
<%response.write"1231"%>
<%
Private Function getIP()
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
getIP = Trim(Mid(strIPAddr, 1, 30))
End Function
ip=getIP()
response.write"<br>您的IP地址为:"& ip
%>
<%
'第三种方法:在appVersion/UserAgent或Request.ServerVariables("Http_User_Agent")
'=之中截取固定的字符串,把有关浏览器和操作系统的字符串截取出并显示=
'=显然问题在于,如果某一天Microsoft把浏览器版本的格式改变了,那么此方法会出错
'=格式:浏览器版本-左数第31个字符起3个字符,系统版本-左数第44个字符起6个字符
Response.Write Request.ServerVariables("Http_User_Agent")&"<p>"
Function Browser2(Info)
Info=Request.ServerVariables("Http_User_Agent")
If InStr(Info,"MSIE")>0 Then '判断当前浏览器是否是"Microsoft IE"类型
Version=Mid(Info,31,3)
IE="Internet Explorer"
Response.Write "您的浏览器是:"&IE&" "&Version&"<p>"
Else
Response.Write "您的浏览器是:未知的浏览器"
End if
End Function
Function System2(Info)
Info=Request.ServerVariables("Http_User_Agent")
If InStr(Info,"Windows")>0 Then '判断当前操作系统是否是"Windows"平台
Version=Mid(Info,44,6)
Plat="Windows"
'下面还要进行判断版本,以供显示具体的平台
If InStr(Version,"NT 5.1")>0 Then
Plat="Windows XP"
ElseIf InStr(Version,"NT 5.0")>0 Then
Plat="Windows 2000"
ElseIf InStr(Version,"NT 4")>0 Then
Plat="Windows NT"
ElseIf InStr(Version,"98")>0 Then
Plat="Windows 98"
ElseIf InStr(Version,"Me")>0 Then
Plat="Windows Me"
ElseIf InStr(Version,"95")>0 Then
Plat="Windows 95"
Else
Plat="未知的操作系统!"
End if
Response.Write "您的操作系统是:"&Plat&"<p>"
Else
Response.Write "您的操作系统是:未知的操作系统"
End if
End Function
Call Browser2(Info)
Call System2(Info)
%>
<%
'=其次:用Request.ServerVariables("Http_User_Agent")=
Response.Write Request.ServerVariables("Http_User_Agent")&"<p>"
Function Browser(Info)
Info=Request.ServerVariables("Http_User_Agent") '在这里初始化了Info,在实际应用中可以作为其他变量赋值
If InStr(Info,"MSIE 6")>0 Then
Browser="Internet Explorer 6.0"
ElseIf InStr(Info,"MSIE 5.5")>0 Then
Browser="Internet Explorer 5.5"
ElseIf InStr(Info,"MSIE 5.0")>0 Then
Browser="Internet Explorer 5.0"
ElseIf InStr(Info,"MSIE 4")>0 Then
Browser="Internet Explorer 4.0"
Else
Browser="未知的浏览器!"
End if
Response.Write "您的浏览器是:"&Browser&"<p>"
End Function
Function System(Info)
Info=Request.ServerVariables("Http_User_Agent")
If InStr(Info,"NT 5.1")>0 Then
System="Windows XP"
ElseIf InStr(Info,"NT 5.0")>0 Then
System="Windows 2000"
ElseIf InStr(Info,"NT 4")>0 Then
System="Windows NT"
ElseIf InStr(Info,"98")>0 Then
System="Windows 98"
ElseIf InStr(Info,"Me")>0 Then
System="Windows Me"
ElseIf InStr(Info,"95")>0 Then
System="Windows 95"
Else
System="未知的操作系统!"
End if
Response.Write "您的操作系统是:"&System&"<p>"
End Function
Call Browser(Info)
Call System(Info)
%>
以下是global.asa文件的内容:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
Application("ActiveUsers") = 0
End Sub
Sub Session_OnStart
Session.Timeout = 20
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.UnLock
End Sub
</SCRIPT>
望大家以后不要吝啬啊!
呵呵
My QQ=34139754
本人做网站优化,有需要的可以和我联系
[此贴子已经被作者于2007-7-31 22:00:53编辑过]