Author |
Topic |
eauxvives
Junior Member
Bhutan
145 Posts |
Posted - 15 November 2001 : 10:46:34
|
Hi all. Many of you use the active users mod and many use pipey's flash chat application, so I guess quite a few of you (like me) use both active users and pipey flash. I have looked for a way to dispay the persons on line on pipey chat in the active users page, so I thought I would share it with you. I only have one chatroom (room1), but I guess this can be easily adapted to multiple rooms, though I haven't tried it. Also please keep in mind that I am not an ASP expert, so every suggestion to improve this is welcomed.
1) edit inc_activeusers2.asp to add the following line immediately before the last <%end if%>: <!--#INCLUDE FILE="online.asp" --> 2) create a new file, called online.asp, containing the following code <% dim vUserCount, vchatusers, vUser, vresult vUserCount = Application("UserCount1") '# of users for room1 vchatusers = Application("ChatUsers1") 'name of users for room1 For vUser = 0 To vUserCount - 1 vresult = vresult & vChatUsers(vUser) if vuser < vUserCount - 1 then vresult = vresult & ", " ' adds a comma before the next name end if next %>
<tr> <td align="center" bgcolor="<% =strForumCellColor %>" valign="middle"><IMG SRC="icon_chat.gif" border="0"> </td> <td valign=top bgcolor="<% =strForumCellColor %>" colspan="<% if (strShowModerators = "1") or (mlev = 4 or mlev = 3) then Response.Write("7") else Response.Write("5")%>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strForumLinkFontColor %>" size="+1">
<B> <a href="/path_to/chatroom.asp')")Chat users</B></A> (<% response.write vUserCount%>) </FONT><BR> <font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>" color="<% =strForumLinkFontColor %>"> <% if vusercount = 0 then response.write ("The chatroom is empty") else Response.Write vResult end if %> </td> </tr>
You can see an example on my site at http://www.eauxvives.org/forum. It's in french, though. I have also modified the inc_top.asp to show the number of users on line if there are some.
Edited by - eauxvives on 15 November 2001 10:52:52 |
|
BLK - Jetta
Starting Member
23 Posts |
Posted - 15 November 2001 : 16:46:08
|
I get it to show up under the active users but I cannot get the # of users to EVER update. It shows 1 user and the name, and has for about 3 hours now, even though there have been up to 4 people in at a time and stayed there to help me test.....
Thanks!
|
|
|
eauxvives
Junior Member
Bhutan
145 Posts |
Posted - 16 November 2001 : 03:25:54
|
quote:
I get it to show up under the active users but I cannot get the # of users to EVER update. It shows 1 user and the name, and has for about 3 hours now, even though there have been up to 4 people in at a time and stayed there to help me test.....
Thanks!
did you reload the page?
|
|
|
BLK - Jetta
Starting Member
23 Posts |
Posted - 16 November 2001 : 09:47:14
|
Yes, several times. This morning when I opened the forum, it had updated with "no users" which is correct. I logged onto chat and opened the forum from another computer... no update. I think it is only checking one time, and not refreshing itself. I unfortunatley am not ASP savvy. I am using Pipey's new version 1.7a if that helps. Thanks!
P.S. I had to edit this line to make the TXT appear...
quote: <B> <a href="/path_to/chatroom.asp')")Chat users</B></A>
I changed it to
<B> <a href="/forum/chat/chatroom.asp">Chat users</B></A>
Edited by - BLK - Jetta on 16 November 2001 09:51:15 |
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
|
BLK - Jetta
Starting Member
23 Posts |
Posted - 16 November 2001 : 09:53:17
|
quote:
Is your other computer on the same network? If so it would be outputting the same IP/IP range, therefore not updateing it
---- -Eric (da_stimulator) Stims Snitz Test area Snitz Mod Resource PHP Script Center -Quality PHP Scripts
sonsof***es - YES - it is on the same network. I am designing it for our company's intranet, so all of the computers will be on the same network... the "Active Users" MOD stays updated though....
|
|
|
BLK - Jetta
Starting Member
23 Posts |
|
samyot
Junior Member
Canada
242 Posts |
Posted - 16 November 2001 : 15:58:19
|
How do you incorporate the stuff from the chat global.asa if I already have the active user stuff in it? This is what I have now:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart Application("ActiveUsers") = 0 Application("TodaysDate") = Date End Sub
Sub Session_OnStart If Application("VisitorsToday") = "" then Application("VisitorsToday") = 0 end if Session.Timeout = 10 ' minutes Session("Start") = Now Application.Lock Application("ActiveUsers") = Application("ActiveUsers") + 1 if Application("TodaysDate") = Date then Application("VisitorsToday") = Application("VisitorsToday") + 1 else Application("TodaysDate") = Date Application("VisitorsToday") = 1 end if Application.UnLock session.Timeout = 25 End Sub
Sub Session_OnEnd ' Decrease the active visitors count when the session ends. Application.Lock Application("ActiveUsers") = Application("ActiveUsers") - 1 Application.UnLock End Sub
</SCRIPT>
I want to add:
<SCRIPT LANGUAGE=VBScript RUNAT=Server> Sub Session_OnStart 'Set session variable for virtual-directory test Session("ChatInitialised")=True End Sub
Sub Session_OnEnd Dim vChatName, vChatUsers, vChatMoods, vUserCount Dim vRoomNo Dim m, n vRoomNo = Session("RoomNo") vChatName = "" & Session("ChatName") If vChatName <> "" Then Application.Lock vUserCount = CLng(Application("UserCount" & vRoomNo)) If vUserCount < 2 Then vChatUsers = "" vChatMoods = "" vUserCount = 0 Else vChatUsers = Application("ChatUsers" & vRoomNo) vChatMoods = Application("ChatMoods" & vRoomNo) For n = 0 To vUserCount - 1 If vChatUsers(n) = vChatName Then For m = n To vUserCount - 2 vChatUsers(m) = vChatUsers(m+1) vChatMoods(m) = vChatMoods(m+1) Next vUserCount = vUserCount - 1 Redim Preserve vChatUsers(vUserCount) Redim Preserve vChatMoods(vUserCount) Exit For End If Next End If Application("ChatUsers" & vRoomNo) = vChatUsers Application("ChatMoods" & vRoomNo) = vChatMoods Application("UserCount" & vRoomNo) = vUserCount AddLineToChat vRoomNo, "**" & vChatName & " has left (timed out)**" Session("ChatName") = "" If vUserCount = 0 Then Application("ChatLines" & vRoomNo) = "" Application("ChatLineCount" & vRoomNo) = 0 Application("ChatMaxLines" & vRoomNo) = 0 End If Application.Unlock End If End Sub
Sub AddLineToChat (ByVal vRoomNo, ByVal vNewLine)
Dim vCurrentLine, vChatLines, vMaxLines
vCurrentLine = Application("ChatLineCount" & vRoomNo) vChatLines = Application("ChatLines" & vRoomNo) vMaxLines = Application("ChatMaxLines" & vRoomNo) vCurrentLine = vCurrentLine + 1 If vCurrentLine > vMaxLines Then vMaxLines = vMaxLines + 500 If vCurrentLine = 1 Then Redim vChatLines(vMaxLines) Else Redim Preserve vChatLines(vMaxLines) End If Application("ChatMaxLines" & vRoomNo) = vMaxLines End If vChatLines(vCurrentLine - 1) = vNewLine Application("ChatLines" & vRoomNo) = vChatLines Application("ChatLineCount" & vRoomNo) = vCurrentLine End Sub </SCRIPT>
Sylvain Amyot FORUM:http://support.mytechsupport.ca HOME:http://mytechsupport.ca
|
|
|
eauxvives
Junior Member
Bhutan
145 Posts |
Posted - 19 November 2001 : 05:11:53
|
quote:
I get it to show up under the active users but I cannot get the # of users to EVER update. It shows 1 user and the name, and has for about 3 hours now, even though there have been up to 4 people in at a time and stayed there to help me test.....
Thanks!
I don't know what your problem is.. can you do a simple test , which is make an asp page than contains only one line: response.write Application("UserCount1") when I do this, I get the number of online users. what about you?
|
|
|
samyot
Junior Member
Canada
242 Posts |
Posted - 20 November 2001 : 09:18:43
|
quote:
How do you incorporate the stuff from the chat global.asa if I already have the active user stuff in it? This is what I have now:
...
Does anybody have an answer for me? Look two posts up for sample global.asa
Thanks...
Sylvain Amyot FORUM:http://support.mytechsupport.ca HOME:http://mytechsupport.ca
|
|
|
Extra Sports
Average Member
USA
644 Posts |
Posted - 20 November 2001 : 22:02:00
|
GOOD one, I'll try it as soon as my host fixes something wrong with our servers. |
|
|
SimonT
Junior Member
United Kingdom
202 Posts |
Posted - 21 November 2001 : 20:06:18
|
Errr forgot to say a while back I integrated the chat script in to my forum so that the forum user id is taken in to the chat room so only members can get in to the chat room if any one wants the code email me will post a few screen shots of it later this week when i have more time. |
|
|
retro
Junior Member
123 Posts |
Posted - 23 November 2001 : 00:00:42
|
Okay...I followed the steps and now have the table displaying just fine, but I never get the information to update. My inc_online.asp looks like this:
<% dim vUserCount, vchatusers, vUser, vresult vUserCount = Application("UserCount1") '# of users for room1 vchatusers = Application("ChatUsers1") 'name of users for room1 For vUser = 0 To vUserCount - 1 vresult = vresult & vChatUsers(vUser) if vuser < vUserCount - 1 then vresult = vresult & ", " ' adds a comma before the next name end if next %>
<tr> <td align="center" bgcolor="<% =strForumCellColor %>" valign="middle"><IMG SRC="../forum/icon_chat.gif" border="0"> </td> <td valign=top bgcolor="<% =strForumCellColor %>" colspan=" <% if (strShowModerators = "1") or (mlev = 4 or mlev = 3) then Response.Write("7") else Response.Write("5")%>"><font face="<% =strDefaultFontFace %> " size="<% =strDefaultFontSize %>" color="<% =strForumLinkFontColor %>" size="+1">
<B><a href="http://www.unitedbikers.com/chat_check.asp")<acronym title="Members in the chatroom...">Members in the chatroom</B></A> (<% response.write vUserCount%>) </FONT><BR><font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>" color="<% =strForumLinkFontColor %>"> <% if vusercount = 0 then response.write ("The chatroom is empty") else Response.Write vResult end if %>
For some reason is shows all the text, but leaves the number of chat users empty i.e. "Number of users in the chat room ()". Does it matter where the inc_online.asp is located?? How does it know what application and room to count?? I know my ignorance is showing...but I like this mod <G>!
Any help is appreciated. BTW...you can enter the chat at
Thanks!
Sean
Edited by - Retro on 10 May 2002 17:02:24 |
|
|
retro
Junior Member
123 Posts |
Posted - 23 November 2001 : 14:21:32
|
Edited by - Retro on 10 May 2002 17:03:06 |
|
|
retro
Junior Member
123 Posts |
Posted - 23 November 2001 : 16:38:10
|
Okay...The problem has something to do with the fact that Pipey Chat requires a virtual directory to work properly. If I call this file:
The mod works just fine. This file is accessing the file via the virtual directory "chat"
If, however, I access the file via:
The mod fails. This is calling the file directly from the folder name. I want to reiterate, these are the same file, one is just being accessed via a virtual directory.
Any ideas on how to overcome this problem? I have tried placing the online2.asp in both my chatfiles and forum directories with no luck. I have also tried having the INCLUDE statement use the virtual path and it gives and error that the file cannot be found.
I even tried using this command for the include but it still doesn't work:
<!--#INCLUDE VIRTUAL="/chat/online2.asp"-->
Any help? I'm close and would love to have this mod.
Thanks again!
Sean
Edited by - Retro on 10 May 2002 17:04:18 |
|
|
Topic |
|