Chat room in the chat room, processing user disconnection is a thorn hand problem, especially on the free site, if blindly rely on Global.asa, when the trigger
Session_onend,application_onend, is an uncertain number, in the design, reasonable arrangement will bring unexpected benefits.
So what's the easiest way to deal with user disconnection?
After testing, the author has the following methods:
Chat room with N application ("User" & N) to save the user name, and then use Application ("Timebegin") to save each user's logon time, with
When the user log in with the session ("Timerbegin") to save the logon time (timer), set the refresh time in the speech area of n seconds, each refresh will be session
("Timebegin"), while determining whether timer-application ("User" &session (UserID)) is >n seconds, and if so, the user does not
Automatic refresh means that the application ("user" &n) can be set to a null value and then prompted that the user has exited.
Part of the code:
Total = Application ("allpeople") ' Number of chats
Aryhuman = Split (Total, ";")
For i = LBound (Aryhuman) To UBound (Aryhuman)-1
If Application ("User" & i) = "online" Then
if int (timer)-Int (Application ("Timebegin" & i)) > Then
Application ("User" & I) = ""
temp = Aryhuman (i)
Aryname = Split (temp, ",")
Hrefname = aryname (0)
for j = LBound (Aryhuman) To UBound (Aryhuman)-1
If Application ("User" & j) = "Online" Then
Application ("Content" & j) = "<font color= #000000 >" Announcements "" &hrefname& "</FONT>" & "<font Color= #F08000
> "&" Disconnection ... "&" </font><font color = #000000 class=p9> "&" < "& Time () &" ></f Ont><br> "& Application
("Content" & j)
End If
Next
End If
End If
Next
%>