ACTIVE SERVER PAGE > Global.asa
µî·ÏÀÏ : 2017-07-04 18:25
Á¶È¸¼ö : 52,459
<script language="VBScript" runat="Server">
Sub Application_OnStart
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
VisitCountFileName = "c:\inetpub\wwwroot\client\21pol\visitnum\visit.txt"
Set Out = FileObject.OpenTextFile(VisitCountFileName,1,FALSE,FALSE)
Application("visit")=Out.ReadLine
Application("VisitCountFileName")=VisitCountFileName
application("now_visit") = 0
End Sub
Sub Application_OnEnd
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set Out = FileObject.CreateTextFile(Application("VisitCountFileName"),TRUE,FALSE)
Application.Lock Out.WriteLine(Application("visit"))
Application.UnLock
End sub Sub
Session_OnStart
Application.lock
Application("visit")= Application("visit")+1
Application("now_visit")= Application("now_visit")+1
Application.unlock
Session.Timeout =20
If Application("visit") MOD 1 = 0 Then
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set Out = FileObject.CreateTextFile(Application("VisitCountFileName"),TRUE,FALSE)
Application.lock Out.WriteLine(Application("visit"))
Application.unlock
End If
End Sub
Sub Session_OnEnd
Application.lock
Application("now_visit")= Application("now_visit")-1
Application.unlock
End Sub
</script>