Author |
Topic  |
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 17 December 2000 : 02:42:46
|
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. |
 |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 17 December 2000 : 02:47:04
|
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 |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 17 December 2000 : 03:06:33
|
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. |
 |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 17 December 2000 : 03:13:10
|
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 |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 17 December 2000 : 03:30:34
|
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. |
 |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 17 December 2000 : 03:37:32
|
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 |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 17 December 2000 : 05:11:58
|
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 |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 17 December 2000 : 06:21:02
|
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> |
 |
|
HuwR
Forum Admin
    
United Kingdom
20587 Posts |
Posted - 17 December 2000 : 07:01:53
|
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 |
 |
|
HuwR
Forum Admin
    
United Kingdom
20587 Posts |
Posted - 17 December 2000 : 07:34:14
|
<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> |
 |
|
HuwR
Forum Admin
    
United Kingdom
20587 Posts |
Posted - 17 December 2000 : 09:07:47
|
<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> |
 |
|
anotherwin95
Junior Member
 
USA
140 Posts |
Posted - 17 December 2000 : 10:35:12
|
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 |
 |
|
HuwR
Forum Admin
    
United Kingdom
20587 Posts |
Posted - 17 December 2000 : 11:02:50
|
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> |
 |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 17 December 2000 : 17:16:52
|
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 |
 |
|
Topic  |
|