Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 active users to main page
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bcooper
Starting Member

34 Posts

Posted - 27 June 2001 :  18:04:27  Show Profile  Send bcooper an AOL message
I am trying to get my active users to be displayed on my main index page (different directory than the forum) and cant seem to figure out how to get the member name's of people and then the guest count to be displayed. Id like it to be like AZNKnights homepage(s). Can someone help?

RDoGG™
Junior Member

USA
329 Posts

Posted - 27 June 2001 :  18:24:10  Show Profile  Visit RDoGG™'s Homepage  Send RDoGG™ an AOL message  Send RDoGG™ a Yahoo! Message
quote:

I am trying to get my active users to be displayed on my main index page (different directory than the forum) and cant seem to figure out how to get the member name's of people and then the guest count to be displayed. Id like it to be like AZNKnights homepage(s). Can someone help?





try searching for "active users" or "who's online"

it has been discussed many times before.

Go to Top of Page

bcooper
Starting Member

34 Posts

Posted - 27 June 2001 :  18:38:50  Show Profile  Send bcooper an AOL message
i already have the active users mod. but i am trying to get it on the main page (not in the forum directory). i have done a search and couldnt find anything on that topic, unless i am seriously blind and missed something.

quote:

quote:

I am trying to get my active users to be displayed on my main index page (different directory than the forum) and cant seem to figure out how to get the member name's of people and then the guest count to be displayed. Id like it to be like AZNKnights homepage(s). Can someone help?





try searching for "active users" or "who's online"

it has been discussed many times before.





Go to Top of Page

stuF
Average Member

United Kingdom
561 Posts

Posted - 27 June 2001 :  19:10:51  Show Profile  Visit stuF's Homepage
theres an addon for this mod, but you can add it by puttingthis, it wont have username, just numbers...

<td colspan="100%" bgcolor="<% =strHeadCellColor %>"><a href="active_users.asp">Active Users</a>:
<%=strOnlineMembersCount%> Members and <%=strOnlineGuestsCount%> Guests
</td><tr>

but if you search long enough, oyu`ll find the mod which will show usernames too.

Go to Top of Page

bcooper
Starting Member

34 Posts

Posted - 27 June 2001 :  19:34:01  Show Profile  Send bcooper an AOL message
Ok, I guess I need to rephrase my question LOL. My site (http://www.wcblizzard.com), is where I want to display the active users. My forum is in a different directory (http://www.wcblizzard.com/forum/default.asp). When you go to my main page, you see that I have a right colum with "Active Users" and under it is where I want that to be displayed. I would like the username of the person to be displayed, and the guest count (if theyre not logged in). I already have the active user MOD and the MOD to make it display the names, I just want it to display the users on my main page, in a different directory. Thanks, Brandon

quote:

theres an addon for this mod, but you can add it by puttingthis, it wont have username, just numbers...

<td colspan="100%" bgcolor="<% =strHeadCellColor %>"><a href="active_users.asp">Active Users</a>:
<%=strOnlineMembersCount%> Members and <%=strOnlineGuestsCount%> Guests
</td><tr>

but if you search long enough, oyu`ll find the mod which will show usernames too.





Go to Top of Page

Aznknight
Senior Member

USA
1373 Posts

Posted - 27 June 2001 :  20:08:48  Show Profile  Send Aznknight an AOL message  Send Aznknight an ICQ Message
i understand what you are asking bcooper. however, it's quite a bit of work since you don't have any of the forum variables or functions available to do what you're asking. but here's some code just for your case.

I threw it up and haven't tested it. I set it up as a function. Just paste it to the bottom of the paste you want to do this on. and call it by:

<% call displayOnlineUsers() %>


<%
function displayOnlineUsers()

strConnString = 'put your conn string here, should be similiar to the one on config.asp

dim objConnection
set objConnection = server.CreateObject("adodb.connection")
objConnection.Open strConnString

dim rsOnline, intOnlineDisplay
set rsOnline = server.CreateObject("adodb.recordset")

' get the online users
strSql ="SELECT UserID, M_BROWSE, DateCreated"
strSql = strSql & " FROM " & strMemberTablePrefix & "ONLINE WHERE USERID not like 'Guest%' order by USERID"

rsOnline.Open strSql, objConnection


intOnlineDisplay = 0
if not rsOnline.EOF then
do until rsOnline.EOF or intOnlinedisplay > 19
'Response.Write "<a href="forum/pop_profile.asp?mode=display&id=" & getMemberID(rsOnline("userID")) & """>" & rsOnline("userID") & "</a>"
Response.Write rsOnline("userID")
intOnlineDisplay = intOnlineDisplay + 1
rsOnline.MoveNext
if intonlinedisplay = 20 then
Response.Write ", <a href=" & basehref & "active_users.asp>more...</a>"
else
Response.Write ", "
end if
loop
Response.write "and "
end if

rsOnline.Close
set rsOnline =nothing

' Get Guest count for display
set rsGuests = Server.CreateObject("ADODB.Recordset")
if strDBType = "access" then
strSqL = "SELECT count(UserID) AS [Guests] "
else
strSqL = "SELECT count(UserID) Guests "
end if
strSql = strSql & "FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE Right(UserID, 5) = 'Guest' "

Set rsGuests = objConnection.Execute(strSql)
Guests = rsGuests("Guests")
strOnlineGuestsCount = rsGuests("Guests")
%>
<font color="green"><%=Guests%></font> <% if Guests=1 then %>Guest<% else %>Guests<% end if %>.</b>
<br><br>
<%
objConnection.Close
set objConnection = nothing
end function %>




- Alan
www.iamviet.com
www.calvsa.net
Snitz Resource
Go to Top of Page

bcooper
Starting Member

34 Posts

Posted - 27 June 2001 :  20:58:54  Show Profile  Send bcooper an AOL message
Alan,
I couldnt get it to work for some reason, it kept giving me tons of errors, so many I didnt copy them down and paste them here...but I know there were alot. Most of them were how it couldnt find the table ONLINE in the DB. Wouldnt that be there if I have the online users mod installed?

quote:

i understand what you are asking bcooper. however, it's quite a bit of work since you don't have any of the forum variables or functions available to do what you're asking. but here's some code just for your case.

I threw it up and haven't tested it. I set it up as a function. Just paste it to the bottom of the paste you want to do this on. and call it by:

<% call displayOnlineUsers() %>


<%
function displayOnlineUsers()

strConnString = 'put your conn string here, should be similiar to the one on config.asp

dim objConnection
set objConnection = server.CreateObject("adodb.connection")
objConnection.Open strConnString

dim rsOnline, intOnlineDisplay
set rsOnline = server.CreateObject("adodb.recordset")

' get the online users
strSql ="SELECT UserID, M_BROWSE, DateCreated"
strSql = strSql & " FROM " & strMemberTablePrefix & "ONLINE WHERE USERID not like 'Guest%' order by USERID"

rsOnline.Open strSql, objConnection


intOnlineDisplay = 0
if not rsOnline.EOF then
do until rsOnline.EOF or intOnlinedisplay > 19
'Response.Write "<a href="forum/pop_profile.asp?mode=display&id=" & getMemberID(rsOnline("userID")) & """>" & rsOnline("userID") & "</a>"
Response.Write rsOnline("userID")
intOnlineDisplay = intOnlineDisplay + 1
rsOnline.MoveNext
if intonlinedisplay = 20 then
Response.Write ", <a href=" & basehref & "active_users.asp>more...</a>"
else
Response.Write ", "
end if
loop
Response.write "and "
end if

rsOnline.Close
set rsOnline =nothing

' Get Guest count for display
set rsGuests = Server.CreateObject("ADODB.Recordset")
if strDBType = "access" then
strSqL = "SELECT count(UserID) AS [Guests] "
else
strSqL = "SELECT count(UserID) Guests "
end if
strSql = strSql & "FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE Right(UserID, 5) = 'Guest' "

Set rsGuests = objConnection.Execute(strSql)
Guests = rsGuests("Guests")
strOnlineGuestsCount = rsGuests("Guests")
%>
<font color="green"><%=Guests%></font> <% if Guests=1 then %>Guest<% else %>Guests<% end if %>.</b>
<br><br>
<%
objConnection.Close
set objConnection = nothing
end function %>




- Alan
www.iamviet.com
www.calvsa.net
Snitz Resource



Go to Top of Page

Jeepaholic
Average Member

USA
697 Posts

Posted - 27 June 2001 :  23:19:38  Show Profile  Visit Jeepaholic's Homepage
Can't you just create a simple ASP page (i.e. onlinedudes.asp) with all the necessary function/etc includes at the top, save it into the forum directory... Then, in your main page do an include of the new onlinedudes.asp file that's in the forum directory?

Al Bsharah
Jeepaholics Anonymous
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 28 June 2001 :  03:12:56  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
This is more or less the same as activeusers2.asp but I renamed it active_users_home.asp and placed it in the /forum directory.

I think you need your cookies set to website rather than forum and it should work fine. It has been for me.

And yes, this is just what jeepaholic suggested above = )

<table width="100%" cellpadding=0 cellspacing="1" Border="1">
<tr>
<td align="center">
<table width="100%" cellpadding=4 cellspacing="0" Border="0">
<tr>
<td bgcolor="<% =strHeadCellColor %>" colspan="8">
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" size="+1"><b>Online Users</b></font></td>
</tr>
<tr>
<td align="center" bgcolor="<% =strForumCellColor %>" valign="middle"> </td>
<td valign=top bgcolor="<% =strForumCellColor %>" colspan="7"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strForumLinkFontColor %>" size="+1">
<A HREF="<%=strForumURL%>active_users.asp"><B>Currently Logged Into The Forum</B></A> (<% =onlinecount %>)</FONT><BR>
<%
mypage = request("whichpage")

If mypage = "" then
mypage = 1
end if

mypagesize = request.cookies(strCookieURL & "paging")("pagesize")

If mypagesize = "" then
mypagesize = 15
end if

set rs = Server.CreateObject("ADODB.Recordset")
'## Forum_SQL
strSql ="SELECT " & strTablePrefix & "ONLINE.UserID, " & strTablePrefix & "ONLINE.M_BROWSE, " & strTablePrefix & "ONLINE.DateCreated "
strSql = strSql & " FROM " & strMemberTablePrefix & "ONLINE "
strSql = strSql & " ORDER BY " & strTablePrefix & "ONLINE.DateCreated DESC"

rs.cachesize = 20
rs.open strSql, my_Conn, 3

i = 0

If rs.EOF or rs.BOF then '## No categories found in DB
Response.Write ""
Else

rs.movefirst
num = 0
rs.pagesize = mypagesize
maxpages = cint(rs.pagecount)
maxrecs = cint(rs.pagesize)
rs.absolutepage = mypage
howmanyrecs = 0
rec = 1
do until rs.EOF or (rec = mypagesize+1)
if Right(rs("UserID"), 5) <> "Guest" then
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strTablePrefix & "ONLINE.UserID "
strSql = strSql & " FROM " & strTablePrefix & "MEMBERS, " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.M_NAME = '" & rs("UserID") & "' "
set rsMember = my_Conn.Execute (strSql)
end if
%>
<% if Right(rs("UserID"), 5) <> "Guest" then %>
<font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>" color="<% =strForumLinkFontColor %>"><% =rs("UserID")%>, </font>
<%
end if
rs.MoveNext
rec = rec + 1
loop
%>
<font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>" color="<% =strForumLinkFontColor %>"><% if Members <> 0 then %>and <% end if %><% =Guests %><% if Guests=1 then %> Guest.<% else %> Guests.<% end if %></font><p>
</td>
</tr>
<% end if %>
</table>
</td>
</tr>

See it at http://www.skepticfriends.org

@tomic

Edited by - @tomic on 28 June 2001 03:42:21
Go to Top of Page

bcooper
Starting Member

34 Posts

Posted - 28 June 2001 :  11:29:34  Show Profile  Send bcooper an AOL message
Ok, I tried all of these methods, saving it into the forum dir. and including it in a different one and I always get this error:

Microsoft VBScript compilation error '800a0411'

Name redefined

/pages/forum/config.asp, line 43

dim strDBType, strConnString, strTablePrefix, strMemberTablePrefix '## Do Not Edit



Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 28 June 2001 :  11:47:50  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
Where is your
<!--#include file="config.asp"--> ?

This is the top of my homepage(default.asp)
<%Response.Buffer = True%>
<!--#INCLUDE virtual="Forum/config.asp" -->
<!--#INCLUDE virtual="Forum/inc_functions.asp" -->
<!--#include file="Forum/inc_top.asp"-->

and further down the include for showing active users...

<!--#include virtual="forum/active_users_home.asp"-->

@tomic



Edited by - @tomic on 28 June 2001 11:50:45

Edited by - @tomic on 28 June 2001 11:53:28
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07