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)
 Updated Active Users
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 6

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 December 2000 :  02:42:46  Show Profile
You might want to add the ability to show the names of the users online from default.asp. There were a lot of requests for that and that's why I had added it to the previous mod.
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 17 December 2000 :  02:47:04  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
yea, I was trying to keep the default page not so cluttered. I think with the stats, forms, private message, whos online, menu, it all really starts to get to much. One thing I wanted to add to this which I was not sure how, was to add how long the user has been on the site for. Something where it takes the Time they loged on and then there current browsing time and give there time online. I could subtract the times, but then what if a user was signed on at 11:50 pm, what would happen when it was 1:50 am and they were still online, -23 hours? have any ideas Richard?

Brad
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 December 2000 :  03:06:33  Show Profile
Just use the full datestring.

Here is what the forum uses:

20001217015800 = December 17, 2000 1:58:00

With the dates stored like that, you can do subtraction without getting a negative result.
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 17 December 2000 :  03:13:10  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Ok.... what is the function that the forum uses to get the full date and time? and how would you go about getting the difference?

Brad
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 December 2000 :  03:30:34  Show Profile
In inc_functions.asp there are these two functions:

function StrToDate(strDateTime) - which does this:

20001217015800 ----> December 17, 2000 1:58:00

and function DateToStr(dtDateTime) which does this:

December 17, 2000 1:58:00 ----> 20001217015800

To get the current Date/Time you use <% =Now() %>

so you can use this: <% DateToStr(Now()) %> to convert the current Date/Time to the string shown above.
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 17 December 2000 :  03:37:32  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Ok how about finding the difference in the two, liek to find the total online time? would i just subtract the two?

EXAMPLE:
strCurrentTime = DateToStr(Now())
strOnlineTime = strOldTime - strCurrentTime
strOnlineTime = StrToDate(strOnlineTime)


Brad
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 December 2000 :  04:19:51  Show Profile
Actually,

Take a look here: http://www.web-savant.com/users/kathi/asp/samples/tut/Date_Calculations.asp

This looks to be more what you need.
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 17 December 2000 :  05:11:58  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I looked at that, and it did not look like something I could use. I got the code to work, and it works great,a s far as i can tell untill i was at being on the site for about an hour then the time online got all screwed up. any sugestions on why this happens?

strRSCheckedIn = rs("CheckedIn")
strRSLastDateChecked = rs("LastDateChecked")
strOnlineDateCheckedIn = StrToDate(strRSCheckedIn)
strOnlineLastDateChecked = StrToDate(strRSLastDateChecked)

strOnlineTotalTime = strRSLastDateChecked - strRSCheckedIn
strOnlineTotalTime = Round(strOnlineTotalTime / 100)

If strOnlineTotalTime > 60 then
' they must have been online for like an hour or so.
strOnlineTotalTime = (strOnlineTotalTime / 60)
strOnlineTotalTime = strOnlineTotalTime & " Hours"
Else
strOnlineTotalTime = strOnlineTotalTime & " Minutes"
End If

Brad
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 December 2000 :  06:21:02  Show Profile
How about this:

<font size=1><pre id=code><font face=courier size=2 id=code>strRSCheckedIn = rs("CheckedIn")
strRSLastDateChecked = rs("LastDateChecked")
strOnlineDateCheckedIn = StrToDate(strRSCheckedIn)
strOnlineLastDateChecked = StrToDate(strRSLastDateChecked)

strOnlineTotalTime = DateDiff("n",strOnlineDateCheckedIn,strOnlineLastDateChecked)

If strOnlineTotalTime > 60 then
' they must have been online for like an hour or so.
strOnlineHours = 0
do until strOnlineTotalTime < 60
strOnlineTotalTime = (strOnlineTotalTime - 60)
strOnlineHours = strOnlineHours + 1
loop
strOnlineTotalTime = strOnlineHours & " Hours " & strOnlineTotalTime & " Minutes"
Else
strOnlineTotalTime = strOnlineTotalTime & " Minutes"
End If</font id=code></pre id=code></font id=size1>
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20587 Posts

Posted - 17 December 2000 :  07:01:53  Show Profile  Visit HuwR's Homepage
YOu could do this, it is more efficient

<pre id=code><font face=courier size=2 id=code>
strOnlineHours = strOnlineTotalTime\60
strOnlineMinutes = strOnlineTotalTime MOD 60
</font id=code></pre id=code>

<font color=blue>'Resistance is futile'</font id=blue>

NOTE the \ is correct this denotes Interger divide

Edited by - huwr on 17 December 2000 07:19:06
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20587 Posts

Posted - 17 December 2000 :  07:34:14  Show Profile  Visit HuwR's Homepage
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
You might wanna edit it again and comment out the lines
<pre id=code><font face=courier size=2 id=code>
' strSql = "DROP TABLE " & strTablePrefix & "ONLINE"
' my_Conn.Execute strSql
</font id=code></pre id=code>

I already did, but you get an error if ya dont.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

This is not a good idea, there are many users who may want to replace their who's online, and do not know how to delete a table.

do this instead

<pre id=code><font face=courier size=2 id=code>
strSql = "DROP TABLE " & strTablePrefix & "ONLINE"
on error resume next
my_Conn.Execute strSql
if err.number <> 0 then
err.number = 0
end if
</font id=code></pre id=code>

That way it won't show an error if they don't have the table



<font color=blue>'Resistance is futile'</font id=blue>
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20587 Posts

Posted - 17 December 2000 :  09:07:47  Show Profile  Visit HuwR's Homepage
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Using MySQL on NT.
Ok will wait and hope someone works on the code for My SQL can't be much different <img src=icon_smile.gif border=0 align=middle>

<b><font color=red>Been There Done That</b></font id=red>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

This was also a problem with the original whos_online, you need to change the following code
<pre id=code><font face=courier size=2 id=code>
if rsWho.eof or rsWho.bof then
Set objRS2 = Server.CreateObject("ADODB.Recordset")
objRS2.Open "" & strTablePrefix & "ONLINE", objConn, 1, 2, 2

objRS2.AddNew
objRS2("UserID") = strOnlineUser
objRS2("Status") = "LOGIN"
objRS2("DateCreated") = strOnlineDate
objRS2("LastDateChecked") = strOnlineDate
objRS2("CheckedIn") = strOnlineCheckInTime
objRS2("M_BROWSE") = strOnlineLocation
objRS2.Update
objRS2.close

else
</font id=code></pre id=code>

change it to
<pre id=code><font face=courier size=2 id=code>
if rsWho.eof or rsWho.bof then
on error resume next
Set objRS2 = Server.CreateObject("ADODB.Recordset")
strSQL = "INSERT INTO " & strTablePrefix & "ONLINE ( UserID,Status,DateCreated,CheckedIn,M_BROWSE) VALUES ("
strSql = strSQL & User & ",'LOGIN','" & fDate & "','" & CheckInTime & "','" & Location & "')"
my_Conn.Execute (strSql)
if err.number <> 0 then response.write err.number & "|" & err.description
else

</font id=code></pre id=code>

For some reason MYSQL doesn'y always like RecordSet.AddNew

<font color=blue>'Resistance is futile'</font id=blue>
Go to Top of Page

anotherwin95
Junior Member

USA
140 Posts

Posted - 17 December 2000 :  10:35:12  Show Profile  Visit anotherwin95's Homepage  Send anotherwin95 an ICQ Message
Great Mod - I am using it now but have run into one problem. It makes a call for the member profile info to a file called member_profiles.asp or the like. There is no such file in the forum that I am using and so I canged it to members.asp - however the entire members list comes up instead of just the individuals profile. The file I think you mean to call to is pop_profile.asp - I changed the code in active_users.asp to this and it worked perfectly.

:-)



Richard Hay
Webmaster
http://AnotherWin95.com

Edited by - anotherwin95 on 19 December 2000 17:36:12
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20587 Posts

Posted - 17 December 2000 :  11:02:50  Show Profile  Visit HuwR's Homepage
Sorry redbrad0,

Another bug.

If you try to view or reply, you get an error similar to this
<pre id=code><font face=courier size=2 id=code>
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''Replying To Message ' <a href=[topic.asp?method=Reply&TOPIC_ID=21&FORUM_ID=15&CAT_ID=1&Forum_Title=Sorting+test&Topic_Title=Another+Topic]>Another Topic</a> '''.

/mushroomgrove/inc_top.asp, line 269
</font id=code></pre id=code>

This is because you have a single ' in your string, you should change them to two single '' quotes

<font color=blue>'Resistance is futile'</font id=blue>
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 17 December 2000 :  17:16:52  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Ok I fixed all the above errors, I HOPE! :O) I also added the how long they have been online. Thanks to huwr and richard for there help on that. I updated the zip file here....

http://www.freeaspcode.net/active_users.zip

Please let me know if you have any problems with this, or if you know a way to improve it.

Thanks
Brad

Brad
Go to Top of Page
Page: of 6 Previous Topic Topic Next Topic  
Previous Page | Next Page
 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.11 seconds. Powered By: Snitz Forums 2000 Version 3.4.07