<% Option Explicit %> <% Dim ChatID Dim requestedUsername ChatID = Request("ChatID") requestedUsername = Server.HTMLEncode( Request("username") ) ' do not show login screen if a valid session exists If (ChatID <> "") Then Response.Redirect "chat.asp?ChatID=" & ChatID Response.End End If Dim mode, x, errorMessage mode = Request("mode") If ( (mode = "userLogin") ) Then If ( Len(Request("username")) < 1 ) Then errorMessage = "You have to enter a username before starting to chat" Else ' Check if this user exist already requestedUsername = Left(requestedUsername, 20) If (Not FindUser(requestedUsername) AND (InStr(requestedUsername, "|") = 0)) Then ' we have a new chat user thus we need to create a new ' id for him/her ChatID = CStr(Timer) ' safe enough for now Application.Lock Application.StaticObjects.Item("ASPChat").Add ChatID, requestedUsername Application.StaticObjects.Item("ASPChatTime").Add ChatID, CStr(Now()) ' tell all other users about this new user For x = MESSAGES To 2 Step -1 Application("chatline_" & x) = Application("chatline_" & x-1) Next Application("chatline_1") = " " & requestedUsername & " logged on at " & now & "" Application.Unlock ' redirect to new frame window and create a new session, ' if user has enabled session Response.Redirect "Chat.asp?ChatID=" & ChatID Response.End Else errorMessage = "Sorry, but the name you chose is already in use. Please choose another." End If End If End If 'color for the text NDC chart '#ffffff" %> ASPChat On·Line <% ' %>
<% Dim arUserNames, arUserIDs, i, chatName if Application.StaticObjects.Count > 0 then arUserIDs = Application.StaticObjects.Item("ASPChat").Keys arUserNames = Application.StaticObjects.Item("ASPChat").Items For i = 0 To Application.StaticObjects.Item("ASPChat").Count-1 If (ChatID = arUserIDs(i)) Then chatName = "" & arUserNames(i) & "" Else chatName = arUserNames(i) End If If ( i MOD 2 ) Then Response.Write "" Else Response.Write "" End If Response.Write " " Response.Write " " Response.Write "" Next End if if Application.StaticObjects.Count > 0 then If (Application.StaticObjects.Item("ASPChat").Count = 0) Then %> <% End If End if %>

 

 NDC Chat

Chat Name 
 

             
Current chatusers (max.<%=USERS%>):
" & chatName & " 
No users currently logged in.