Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/65042?pagenum=1
05 November 2025, 09:24
Topic
pitstraight
Total time online ?
23 June 2007, 01:46
Is there a mod that will add the total users's online time onto their profile ?
I have Active Users installed, could I take the time from that ?<
Replies ...
HuwR
23 June 2007, 04:06
this is a value that is not possible to calculate since the forum or the webserver has no idea whatsoever when you navigate away from the site, so anything you try to record will be wrong.<
pitstraight
23 June 2007, 04:23
I know the value won't be perfect, but if I just want to accumulate the times that members accumulate in the Active Users screen how would I do that ?
I have a basic understanding of what I would do, but I don't know how to write it in HTML coding.<
HuwR
23 June 2007, 05:38
you will need to add quite a bit of code in order to accomplish what you want and you will need to add a column to the active_users table to keep track of the online time, I am not familiar enough with the active_user mod, so can't give you any specifics.<
pitstraight
23 June 2007, 05:52
That's ok, but is there someone else who can help ?<
pitstraight
23 June 2007, 05:55
Actually, isn't there a column there already because the time is displayed on the active users page.<
Shaggy
25 June 2007, 04:51
It's wouldn't be too difficult to achieve, actually. All you need to do is add a new field to the members table to hold the time and then modify the ActiveUserTracker sub in inc_func_common.asp to pull AU_LOGINTIME from the ACTIVE_USERS table and then use that to calculate and update the time in the members table when deleting inactive users.
This has come up at least once before so a bit of searching should done up more specifics related to the axact changes you'll need to make.
<
pitstraight
25 June 2007, 19:35
Thanks Shaggy, but I searched before I posted and did a lot of reading and didn't come up with anything. I can see that all the pieces are there, I just don't have a clue how to join them all together properly.<
Shaggy
26 June 2007, 04:58
Can't find it know meself, either, but that's more than likely the insomnia & hayfever hampering my search powers.
<
pitstraight
30 June 2007, 00:52
Is there anyone else out there that can actually HELP with my problem ?<
pitstraight
01 July 2007, 18:07
Am I being ignored, or is this just too hard for anyone to help me with ?<
ruirib
01 July 2007, 18:25
No one is ignored, I think. It may just be that people do not have that much time to think about this, among the members who do know enough about the way the current code works to help you with it. Not all mod requests get answered... many do, some don't.<
pitstraight
03 July 2007, 01:26
OK, how long should I wait then ? In 10 days I've had 2 people respond. HuwR couldn't really help, Shaggy seems to know how to do it but neither of us can find anything by searching. This place is pretty active, but there is still a few threads which get ignored, dropped, whatever.
I've said before that I don't know how to write all the html that I need to know to get it to work, or I would have already done it. I've added a few mods (I can follow instructions), and I can see that it is possible but I haven't hte foggiest clue where to start with the code.<
ruirib
03 July 2007, 04:12
I can't say that you should wait two or three days and you will get a reply. Maybe you won't get any. This is a voluntary support forum, people post about the issues they feel comfortable with, they like the most, whatever... I for one, do no post much about mods, cause I really don't like much to do it. On a voluntary system, likely with not much of free time, any help is welcome, but no one is forced to address all issues.
I understand your point of view, you have a need and you seem to get no replies... I guess this matter is not that popular among our regulars... I know this does not help much, but it's just to let you know that you're not ignored...<
tribaliztic
24 July 2007, 14:58
I did ask for this earlier, don't remember what replies I got but not anything that helped me enough to make the changes myself =) Now I have more knowledge and it shouldn't be that hard to do I think. It's just the time issue... =) <
PPSSWeb
24 July 2007, 15:21
Where did you want this displayed in the profile?
I would think you should be able to use the same calcualtion used on the active users page for this.
abs(DateDiff("n",StrToDate(rsAM("AU_LOGINTIME")),strForumTimeAdjust))
In the profile page (page name depends on where you want it displayed), you would have to query the active users table for the AU_LOGINTIME value then put this value and the appropriate formatting.<
tribaliztic
24 July 2007, 15:29
But this will only show online time for THIS session? Not all sessions since registering? Or am I wrong?
<
PPSSWeb
24 July 2007, 15:46
Originally posted by tribaliztic But this will only show online time for THIS session? Not all sessions since registering? Or am I wrong?
Very true., I guess that is what I get for answering without fully understanding the question. Sorry for the hasty reply.
In that case, it looks like Shaggy hit it right on the head in the post above.
I think you will also have to add the calculation to the deleteInactiveUsers() function to capture all cases where the user is removed from the active users.
If I am looking at this right though, I am not sure this will be accurate. I think both of these functions operate on timeouts, so this will not cover the function where they log out directly. In this case their time will keep increasing until the next timeout. Is this right? Even still, this will only execute when someone else loads these functions. So if I am thinking right, this could keep counting users time until someone else logs in, even if the other user left a and timed out a long time ago.<
Shaggy
25 July 2007, 04:07
I'd be careful of making this information publicly available in profiles; personally, I wouldn't hang around a forum for too long if anyone could register and see this information, best to keep it for admins only.
<
PPSSWeb
25 July 2007, 07:49
Originally posted by Shaggy I'd be careful of making this information publicly available in profiles; personally, I wouldn't hang around a forum for too long if anyone could register and see this information, best to keep it for admins only.
Good point Shaggy. I agree completely.<
tribaliztic
25 July 2007, 17:13
Originally posted by Shaggy I'd be careful of making this information publicly available in profiles; personally, I wouldn't hang around a forum for too long if anyone could register and see this information, best to keep it for admins only.
I'm registered at two other forums that do show this in the profiles, only the user can se his/her own time. I don't really see the problem with showing this for everyone though?
<
pitstraight
25 July 2007, 23:54
I don't see the problem with everyone seeing it, but if someone can write the code Im sure I can make it show the way I want.
also VERY glad to see some life in this thread <
PPSSWeb
26 July 2007, 10:06
I am not sure how this will work as I havn't had time to really test it, but maybe this will give you a start.
As stated you will need to add a field to the Members table. With a numeric value started at 0. Make sure you chose a data type that will have enough room so you will not be likely to over run the value if you forum stays up for a number of years.
To get the total time value from the database and current active time then add the two and update the total time, you will need something like this.
Code:
'##Total online time## if MemberID="-1" then 'If this is a Guest, do nothing else 'If this is a Member, get Login Time strSql = "SELECT AU_LOGINTIME FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID = " & MemberID set rsAM = my_conn.execute (strSql) if rs.EOF or rs.BOF then 'do nothing else 'get Total Time online strSQL = "SELECT M_TIMEONLINE FROM " & strTablePrefix & "MEMBERS WHERE (MEMBER_ID = " & MemberID & " AND MEMBER_ID <> -1)" set rs = my_conn.execute (strSql) if rs.EOF or rs.BOF then 'do nothing Else 'update total time online onlineTime = rs("M_TIMEONLINE") + abs(DateDiff("n",StrToDate(rsAM("AU_LOGINTIME")),strForumTimeAdjust)) strSql = "UPDATE " & strTablePrefix & "MEMBERS SET M_TIMEONLINE='" & onlineTime & "'" & _ "WHERE MEMBER_ID = " & MemberID my_conn.execute (strSql) End IF end if rsAM.close set rsAM = Nothing rs.close set rs = Nothing end if '######
It has been mentioned that this should go in inc_func_common. I am just not sure where it is best to put it at the moment. I added it to the ActiveUserTracker() function and it has not run when I expected it to. Or maybe I was just too impatient. Where you want to display this information, you will need to put something like this:
Code:
strSQL = "SELECT M_TIMEONLINE FROM " & strTablePrefix & "MEMBERS WHERE (MEMBER_ID = " & MemberID & " AND MEMBER_ID <> -1)" set rs = my_conn.execute (strSql) if rs.EOF or rs.BOF then 'do nothing Else 'output total time online Response.Write " Total Time Online: " & rs("M_TIMEONLINE") End if
I am pretty sure this code will need some tweaking and cleanup. But perhaps it will give you a start.