Global.asa 加入以下代码:
<Script language="VBScript" runat="server">
Dim strCon
strCon="Database=tmpCounter;uid=sa;pwd=****;driver={SQL Server};server=****"
url=Request.ServerVariables("SCRIPT_NAME")
urlArray=Split(url,"/")
server_name=Request.ServerVariables("SERVER_NAME") & "/" & urlArray(1)
Application.Lock
Application("counter")=1
login_ip=Request.ServerVariables("REMOTE_ADDR")
Dim insStr
insStr="insert tcounter(login_ip,server_name,counter) values('" & login_ip & "','" & server_name & "'," & Application("counter") & ")"
Set db=server.CreateObject("ADODB.Connection")
db.open strCon
db.execute(insStr)
db.close()
Set db=Nothing
End Sub
</Script>
Sub Session_OnStart
Dim strCon
strCon="Database=tmpCounter;uid=sa;pwd=****;driver={SQL Server};server=****"
Dim server_name,url
url=Request.ServerVariables("SCRIPT_NAME")
urlArray=Split(url,"/")
server_name=Request.ServerVariables("SERVER_NAME") & "/" & urlArray(1)
Application.Lock
If Application("counter")=null Then
Application("counter")=1
Else
Application(
"counter")=Application("counter")+1End If
Application.Unlock
login_ip=Request.ServerVariables("REMOTE_ADDR")
Dim insStr
insStr="insert tcounter(login_ip,server_name,counter) values('" & login_ip & "','" & server_name & "'," & Application("counter") & ")"
Set db=server.CreateObject("ADODB.Connection")
db.open strCon
db.execute(insStr)
db.close()
Set db=Nothing
End Sub
</Script>
相关文章
暂无评论...