Har en chat. Där visar jag vilka som är online. men när användaren loggar ut försvinner inte hans namn från onlinelistan. Hur ska jag göra för att namnet ska tas bort?
Koden ser ut så här:
Jag hämtar namnen med <%=Application("slot1")%>
och global.asa ser ut så här:
<script language="VBScript" runat="Server">
Sub Session_OnStart
Session.Timeout = 5
Application("visitors") = Application("visitors") + 1
End Sub
Sub Session_OnEnd
Application("visitors") = Application("visitors") - 1
APPLICATION.LOCK
If Application("slot1") = Session("user") then Application("slot1") = ""
If Application("slot2") = Session("user") then Application("slot2") = ""
If Application("slot3") = Session("user") then Application("slot3") = ""
If Application("slot4") = Session("user") then Application("slot4") = ""
If Application("slot5") = Session("user") then Application("slot5") = ""
If Application("slot6") = Session("user") then Application("slot6") = ""
If Application("slot7") = Session("user") then Application("slot7") = ""
If Application("slot8") = Session("user") then Application("slot8") = ""
If Application("slot9") = Session("user") then Application("slot9") = ""
If Application("slot10") = Session("user") then Application("slot10") = ""
If Application("slot11") = Session("user") then Application("slot11") = ""
If Application("slot12") = Session("user") then Application("slot12") = ""
If Application("slot13") = Session("user") then Application("slot13") = ""
If Application("slot14") = Session("user") then Application("slot14") = ""
If Application("slot15") = Session("user") then Application("slot15") = ""
If Application("slot16") = Session("user") then Application("slot16") = ""
If Application("slot17") = Session("user") then Application("slot17") = ""
If Application("slot18") = Session("user") then Application("slot18") = ""
If Application("slot19") = Session("user") then Application("slot19") = ""
If Application("slot20") = Session("user") then Application("slot20") = ""
APPLICATION.UNLOCK
End Sub
Sub Application_OnStart
Application("visitors") = 0
End Sub
</script>
logga ut sidan ser ut så här
<% session.abandon
response.redirect("default.asp")
%>
