PDA

View Full Version : Total Time Online Hack v1.0


Pages : [1] 2

g-force2k2
08-27-2002, 10:00 PM
[ Click Here ] (https://vborg.vbsupport.ru/attachment.php?s=&postid=292003) to download the latest update!

Nifty Addon by TECK: ;)

[View TECK's Modification] (https://vborg.vbsupport.ru/showthread.php?postid=301968#post301968)

Yeah my first hack for vb2.2.7 :p but then again its compatible with vb2.2.6 as well tested on both :)

What does this hack do? Just as the title states :p it calculates the total time online for each user ;)

Configurable::
The time limit before a user is considered inactive is configurable and is included in the install txt file... so if you want a user to be defined as inactive after 3 minutes then there'll be a variable in the script to limit that configure that ;)

Also Configurable is the amount of users to show per page on the leader time online board :) That is also configurable in the timeonline.php included with the zip...

Features ::
Includes both viewable on the postbit and getinfo templates...
Includes a leader board for the top users time online ;)

What to do? ::
Queries to Run (1)
File Modification (5)
Template Modificatiion (2)
Templates to Add (3)
Files to Upload (1) :: [ timeonline.php ] (forum directory)

It's an easy hack to install (took me a little time to configure) but it looks great imo... probably a hack that will use and that i can see every forum having... why not right ;) Enjoy yet another release... :) And if you like this hack i would be greatful if you could click install ;) thanks...

Edit ::
Viewable Demo [ Here ] (http://www.xtreme-forumz.net/timeonline.php?action=view_leader)

Note ::
If for some odd reason you get a division by zero error

find:

$daysreg = floor((time() - $lead[2]) / 86400);
$daysreg = iif($daysreg == 0,'1','$daysreg'); // checking to see if not registered for more then a day to prevent division by zero
$dotimeperday = floor($lead[3] / $daysreg);

replace with:

$daysregs = floor((time() - $lead[2]) / 86400);
if($daysregs == 0) { // checking to see if not registered for more then a day to prevent division by zero
$daysreg = 1;
} else {
$daysreg = $daysregs;
}
$dotimeperday = floor($lead[3] / $daysreg);

g-force2k2

g-force2k2
08-28-2002, 05:05 PM
Screenshot A :: postbit template

g-force2k2

g-force2k2
08-28-2002, 05:06 PM
Screenshot B :: Time Online Leader Board

FYI :: this screenshot now looks different :p instead of that one link i integrated a page nav system into it... regards...

g-force2k2

g-force2k2
08-28-2002, 05:07 PM
Screenshot C :: getinfo template

Enjoy the hack :D

g-force2k2

ExcErr
08-28-2002, 05:51 PM
nice hack, will install it today...
thx!

PS: plz add the # of posts column to the Leader time online....because it's more comfortable to see how many hours user was online and how many posts he posted...
if you will do it, plz post than the upgrade way from old v to new...
thx again

g-force2k2
08-28-2002, 05:55 PM
thanks to WebmasterXT found a quick fix... sorry it was a last minute thing... but here's the fix...

find:

if($newtime < $inactivetime) {

replace it with:

if($newtime < $factivetime) {

im sorry for such the quick fix... but there shouldn't be anymore... it was a last minute change that i forget to update... my bad...

regards...

g-force2k2

g-force2k2
08-28-2002, 05:58 PM
Updated Zip...

g-force2k2

NTLDR
08-28-2002, 06:01 PM
I can't wait to install this one :D I've wanted it ever since someone suggested it ;)

irn-bru
08-28-2002, 06:15 PM
thanx m8 nice hack ..

Just a few suggestions.

timeonline.php

[ Previous Page ]";
[ Next Page ]";
[ Last Page ]";

Change---

[ Previous Page ]</a>";
[ Next Page ]</a>";
[ Last Page ]</a>";

getinfo_timeonline---

Change the <normallfont> </normallfont> to <smallfont> </smallfont>

"my getinfo is all smallfont"

time---

<table cellpadding="2" cellspacing="0" border="0" width="95%" align="center">
<tr><td width="50%">
<img src="https://vborg.vbsupport.ru/images/vb_bullet.gif" alt="" border="0" align="absmiddle"><normalfont><b>
<a href="index.php?s=$session[sessionhash]">$bbtitle</a> Total Time Online Hack © g-force2k2</b></normalfont></td></tr></table>

Change to---

<table cellpadding="2" cellspacing="0" border="0" width="95%" align="center">
<tr><td width="100%">
<img src="https://vborg.vbsupport.ru/images/vb_bullet.gif" alt="$bbtitle" border="0" align="absmiddle"><normalfont><b>
<a href="index.php?s=$session[sessionhash]">$bbtitle</a> &gt Total Time Online © g-force2k2</b></normalfont></td></tr></table><p>

g-force2k2
08-28-2002, 06:17 PM
Originally posted by ExcErr
nice hack, will install it today...
thx!

PS: plz add the # of posts column to the Leader time online....because it's more comfortable to see how many hours user was online and how many posts he posted...
if you will do it, plz post than the upgrade way from old v to new...
thx again

:p hope thats good :) regards...

g-force2k2

Webmasta XT
08-28-2002, 06:19 PM
hey i installed this hack Awesome hack man, keep up the good work

g-force2k2
08-28-2002, 06:21 PM
Originally posted by irn-bru
thanx m8 nice hack ..

Just a few suggestions.

timeonline.php

[ Previous Page ]";
[ Next Page ]";
[ Last Page ]";

Change---

[ Previous Page ]</a>";
[ Next Page ]</a>";
[ Last Page ]</a>";

Thanks for this update :p the other changes are a matter of preference... ;) zip updated :) regards...

g-force2k2

DrkFusion
08-28-2002, 06:26 PM
Does this add a query for each user online?
I saw your demo, and there are 10 people online, and 10 queries, so I am guessing this is what it does, a forum which I admin at has hundreds of people online at ones, so...not sure, mind telling me?

Thanks, nice idea by the way

g-force2k2
08-28-2002, 06:28 PM
no DrkFusion... it'll only run that query as many times that its fetched on the page... so the default is set to max 10 so it'll only ever hit 10 queries... regards...

g-force2k2

DrkFusion
08-28-2002, 06:29 PM
Looks very nice man, good job.

Chris M
08-28-2002, 06:51 PM
Very smooth:)

Satan

ExAvIoUr
08-28-2002, 07:13 PM
worked perfectly.

NTLDR
08-28-2002, 07:45 PM
Truely Amazing g-force2k2, this is on of the best hacks I have installed ;)

One v.minor error, in the time_leader template, this:

<a href="member.php?s=&session[sessionhash]&action=getinfo&userid=$userid">

Should be this ($ not &)

<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$userid">

Thank you for sharing this :D

g-force2k2
08-28-2002, 07:47 PM
NTLDR :: thanks ;) will update shortly thanks for telling me about the error though :p every bit helps... regards...

g-force2k2

ULTIMATESSJ
08-28-2002, 07:57 PM
Great, i've been waiting for a hack like this for ages, good work

/me clicks install

NTLDR
08-28-2002, 08:11 PM
I have put the display of the time online in the postbit along with the number of posts etc, how easy would it be to just change this display H:M:S (Hours:Mins:Seconds) instead of 0 Hours, 0 Minutes, 0 Seconds Online?

Goldknight
08-28-2002, 08:12 PM
Great job as you always do =D

/me install

Goldknight
08-28-2002, 08:14 PM
Originally posted by NTLDR
I have put the display of the time online in the postbit along with the number of posts etc, how easy would it be to just change this display H:M:S (Hours:Mins:Seconds) instead of 0 Hours, 0 Minutes, 0 Seconds Online?

I d like to have that one too

ExAvIoUr
08-28-2002, 08:18 PM
me too if thats possible.

g-force2k2
08-28-2002, 08:24 PM
its pretty simple guys ;) just open up the admin/functions.php and go down the the function that i created... just change Days to D... Hours to H... Minutes to M and Seconds to S :p its that simple and it'll change up for all three setups like that :) enjoy

err... edit nvm i see what you mean :p give me a minute and i'll create the setup for you :) regards...

g-force2k2

NTLDR
08-28-2002, 08:31 PM
I thought it was that code but was't 100% ;)

I have copied the function and changed it to:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
// do time online function
function doposttimeonline($timeonline) {

$days = floor($timeonline / 86400);
if($days == 0) {
$ftime = "";
} elseif($days == 1) {
$ftime = "$days Day, ";
} else {
$ftime = "$days Days, ";
}

$tothours = $days * 86400;
$newhours = $timeonline - $tothours;
$hours = floor($newhours / 3600);
$ftime.= "$hours:";

$totmin = (($hours * 3600) + ($days * 86400));
$newmin = $timeonline - $totmin;
$minutes = floor($newmin / 60);
$ftime.= "$minutes:";

$totsec = (($hours * 3600) + ($minutes * 60) + ($days * 86400));
$seconds = $timeonline - $totsec;
$ftime.= "$seconds";

return $ftime;

}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

And placed it under the other one and changed:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$post[onlinetime] = dotimeonline($post[timeonline]);
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

To:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$post[onlinetime] = doposttimeonline($post[timeonline]);
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

So I get H:M:S (eg: 0:44:10) in the post bit and the full length version everywhere else.

Thanks again g-force2k2, if Hack of the month comes back this will be my nomination :D

g-force2k2
08-28-2002, 08:37 PM
heh good job man :p here's a more modified code and it'll change it everywhere on the forum and i think you wanted it to look more like this anyway :p but you can just add this as a new function like you stated if you want that ;) regards...

g-force2k2

g-force2k2
08-28-2002, 08:39 PM
Originally posted by NTLDR
Thanks again g-force2k2, if Hack of the month comes back this will be my nomination :D

thanks ;) i owe you one :) regards...

g-force2k2

Goldknight
08-28-2002, 08:40 PM
Thanks g-force2k2 :)

:banana:

NTLDR
08-28-2002, 08:45 PM
Originally posted by g-force2k2
thanks ;) i owe you one :)

No problem, this hack is the best I have seen in ages, I've allways wanted it since someone requested it ages ago, and you have done a superb job. Your one of the top hackers here g-force2k2 and a credit to vB.org :)

Velocd
08-28-2002, 09:50 PM
Very cool hack g-force, I'll think about installing this later. ;)

bommelchen
08-28-2002, 10:06 PM
How can i display the user with the most online time on Forumhome ?

The Hack is nice :)

THX Bommelchen

PsYc
08-28-2002, 10:16 PM
great hack :)


works like a charm

good work, very good :D


* PsYc clicks *install*

g-force2k2
08-28-2002, 10:22 PM
Originally posted by bommelchen
How can i display the user with the most online time on Forumhome ?

The Hack is nice :)

THX Bommelchen

open index.php (root folder)

find:

// get total posts

before it add:

$tuser = $DB_site->query_first("SELECT username,userid,timeonline FROM user ORDER BY timeonline DESC LIMIT 1");
$ttime = dotime($tuser[timeonline]);
$bestonline = "<b>User Most Online:</b> <a href='member.php?s=&action=getinfo&userid=$tuser[userid]>$tuser[username]</a> - $ttime";

then in the forumhome template where you want to appear place the variable ::

$bestonline

i think that should work ;) haven't tested yet... but regards :)

g-force2k2

bommelchen
08-28-2002, 10:37 PM
Sorry this is not working ! i get a blank page.
Any idears ?

bommelchen

NTLDR
08-28-2002, 10:44 PM
$ttime = dotime($tuser[timeonline]);

Should be:

$ttime = dotimeonline($tuser[timeonline]);

;)

g-force2k2
08-28-2002, 10:49 PM
:p thanks NTLDR i said i didn't test it :p didn't even remember my own function name ;) thanks for backing me up as usual :) regards...

g-force2k2

bommelchen
08-28-2002, 10:54 PM
Big thanks work perfect !!

bommelchen

[D]Vincent
08-29-2002, 01:14 AM
Great hack, I will install it soon.

Gohan
08-29-2002, 01:19 AM
Great Hack, g-force2k2!

I'll install it tommorrow :D

Souly
08-29-2002, 02:31 AM
Installed on a 2.2.5 Version without any Problems! Great Hack!

My Demoscreens:[GERMAN]

[1] ID-Card (ausgefahren)
-----------------------------------
http://www.clanforen.de/clanforen/images/attach/timeonline1.gif

[2] Profil-Card
-----------------------------------
http://www.clanforen.de/clanforen/images/attach/timeonline2.gif

[3] ?bersicht aller Zeiten (http://www.clanforen.de/clanforen/timeonline.php?s=&getinfo=view_leader)
-----------------------------------
http://www.clanforen.de/clanforen/images/attach/timeonline3.gif


thx!

Boofo
08-29-2002, 02:54 AM
I couldn't get it to work on the forumhome even with this change. It kept messing up my "Member of the Day" hack. Neither one would show right if I have them both going. Any other way to get it to show on forumhome?

And how is the Time online per day calculated?

And one last thing Sorry :)). Is there a way I can get it to NOT show any users times that are all at zero until they are online?

Originally posted by NTLDR
$ttime = dotime($tuser[timeonline]);

Should be:

$ttime = dotimeonline($tuser[timeonline]);

;)

g-force2k2
08-29-2002, 03:03 AM
Boofo the code should work... if it doesn't just change some variables around and see what happens...

As for the time online per day calculated? the total time online divided by the days registered... :p maybe this hack should be included in vb3 so that the members who registered way before hand don't lose their time :P

As for selecting the users with no time... just change this query ::

$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user");

to this ::

$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE timeonline != 0");

regards... hope that helps somewhat :)

g-force2k2

Boofo
08-29-2002, 03:11 AM
That didn't quite work. The list is smaller but I still have about 10 users who show up on the listing that have no time online. Also, the forumhome thing doesn't work no matter what I change around.

Is there a way, after we figure the list out, to not have the template show up in the profile if there is no time either?

g-force2k2
08-29-2002, 03:22 AM
open member.php

find:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

replace with:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[onlinetime] > 0) {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
} else {
$getinfo_template = "";
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

regards... will look into forumhome issue for you now... can you give me the coding for FireFlys member of the day and the code you're using for mine? regards...

g-force2k2

Boofo
08-29-2002, 03:29 AM
LOL Now it doesn't show up at all in the getinfo template, even when there is some time. Do we need to check for zeros on all of it or something?

You know me, g-force2k2, it never ceases to go quite right in the beginning. :)

g-force2k2
08-29-2002, 03:36 AM
nah actually Boofo that was my bad... in the member.php replace the code i just gave you with this code:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[timeonline] > 0) {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
} else {
$getinfo_template = "";
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

that should fix that problem :)

now open index.php

find:

// get total posts

above that add:

// +++++++ Total Time Online Hack v1.0 [ g-force2k2 ] +++++++
$topuseronline = $DB_site->query_first('
SELECT userid, username, timeonline
FROM user
ORDER BY timeonline
DESC LIMIT 1');
$totaltimeonline = dotimeonline($topuseronline[timeonline]);
$ftopuseronline = "<b>Top User Online:</b> <a href='member.php?s=$session[sessionhash]&action=getinfo&userid=$topuseronline[userid]'>$topuseronline[username]</a> : $totaltimeonline";
// +++++++ Total Time Online Hack v1.0 [ g-force2k2 ] +++++++


open forumhome template:

place where you want to show :

$ftopuseronline

regards :)

g-force2k2

Boofo
08-29-2002, 03:43 AM
Firefly's Code:

+-------------------------------------------------------------------------------------------------+
| Member of the day |
+-------------------------------------------------------------------------------------------------+
| A hack by Chen 'FireFly' Avinadav (chen.avinadav@vbulletin.com) |
+-------------------------------------------------------------------------------------------------+

+
+++
+

+-------------------------------------------------------------------------------------------------+
| In index.php, replace this code: |
+-------------------------------------------------------------------------------------------------+
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
+-------------------------------------------------------------------------------------------------+

+-------------------------------------------------------------------------------------------------+
| With this code: |
+-------------------------------------------------------------------------------------------------+
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}

// start member of the day stuff
$thisdate=date('Y-m-d');
$getdaytemplate=$DB_site->query_first("SELECT template
FROM template
WHERE title='memberoftheday'
AND templatesetid=-2");
$daytemplate=$getdaytemplate['template'];
$daybits=explode('||vb||',$daytemplate);
if ($daybits[0]!=$thisdate or ($resetmember==1 and $bbuserinfo['usergroupid']==6)) {
/* This template is either outdated or the admin wants to reset it.
Either way, we need to choose a new member of the day. Aren't you excited?! */
$newmember=$DB_site->query_first("SELECT userid,username
FROM user
WHERE userid<>$daybits[1]
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1");
$newtemplate=$thisdate.'||vb||'.$newmember['userid'].'||vb||'.$newmember['username'];
$DB_site->query("UPDATE template
SET template='".addslashes($newtemplate)."'
WHERE templatesetid=-2
AND title='memberoftheday'");
$memberoftheday['userid']=$newmember['userid'];
$memberoftheday['username']=$newmember['username'];
} else {
$memberoftheday['userid']=$daybits[1];
$memberoftheday['username']=$daybits[2];
}
// end of member of the day stuff
+-------------------------------------------------------------------------------------------------+

+
+++
+

+-------------------------------------------------------------------------------------------------+
| In the "forumhome" template, replace this code: |
+-------------------------------------------------------------------------------------------------+
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a>
+-------------------------------------------------------------------------------------------------+

+-------------------------------------------------------------------------------------------------+
| With this code: |
+-------------------------------------------------------------------------------------------------+
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a><br>
The $bbtitle member of the day is <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$memberoftheday[userid]">$memberoftheday[username]</a>
+-------------------------------------------------------------------------------------------------+

+
+++
+

+-------------------------------------------------------------------------------------------------+
| Run this query: |
+-------------------------------------------------------------------------------------------------+
INSERT INTO template (templateid,templatesetid,title,template) VALUES (NULL,-2,'memberoftheday','0||vb||0||vb||0');
+-------------------------------------------------------------------------------------------------+


The code in this thread for the forumhome:

// get total posts


before it add:


$tuser = $DB_site->query_first("SELECT username,userid,timeonline FROM user ORDER BY timeonline DESC LIMIT 1");
$ttime = dotimeonline($tuser[timeonline]);
$bestonline = "<b>User Most Online:</b> <a href='member.php?s=&action=getinfo&userid=$tuser[userid]>$tuser[username]</a> - $ttime";


then in the forumhome template where you want to appear place the variable ::


$bestonline

g-force2k2
08-29-2002, 03:52 AM
okay thanks Boofo i don't see how the codes contrast... but i will install this on a my forum to see what i can observe for you regards... i posted some other coding above if you want to test that..

g-force2k2

Boofo
08-29-2002, 04:15 AM
No need to test it on your end. Both fixes work perfectly. Thank you very much, sir. :)

We lucked out on this one. We usually have to go through alot more to fix it to work with my board. That must mean you are getting better and better all the time, huh? :) Can't beat experience. ;) Keep up the great work, there, g. :)

Now, all we have to do is get it not to show any members in the listing with the times at zero and we are all set. :)

g-force2k2
08-29-2002, 04:18 AM
Boofo try using this query then? ::

$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE timeonline > 0");

regards... hope that fixes the final issue :) btw i think you're getting better then me Boofo ;)

g-force2k2

Boofo
08-29-2002, 04:27 AM
Sorry, that didn't change anything. :(

I'm not anywhere near as good as you on this stuff. I just seem to find more bugs with my setup than anyone else. I figure, if you can fix it to work with my site, then it will work with anyone's site. At least, that's the way it seems most of the time. :)

Originally posted by g-force2k2
Boofo try using this query then? ::

$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE timeonline > 0");

regards... hope that fixes the final issue :) btw i think you're getting better then me Boofo ;)

g-force2k2

g-force2k2
08-29-2002, 04:35 AM
Boofo

open timeonline.php

find:

$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
WHERE userid!=0
ORDER by timeonline DESC LIMIT $startat,$perpage");

replace with:

$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
WHERE userid!=0 AND timeonline > 0
ORDER by timeonline DESC LIMIT $startat,$perpage");

regards :) maybe that'll work now :P

g-force2k2

Boofo
08-29-2002, 05:01 AM
You're good! that fixed it. :)

What should this be at now?


$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE timeonline > 0");


leave it like it is?

g-force2k2
08-29-2002, 06:05 AM
you can keep that as is as well ;) regards... glad that it worked :)

g-force2k2

Boofo
08-29-2002, 06:11 AM
Thanks again for all of the help. Great hack! ;)

andrew67
08-29-2002, 10:34 AM
Best hack out for a long time! GREAT WORK!!! :)

scottct1
08-29-2002, 01:12 PM
I want to install this hack but I have one question, will it show the users time online when they are in invisable mode?

Thanks!

g-force2k2
08-29-2002, 02:38 PM
scottct1 yeah it should... but i don't see that as a problem...

g-force2k2

Okiewan
08-29-2002, 03:12 PM
Cool hack, but a problem?

Time online per day is out of whack for everyone but users who register after the hack is installed... any way to change it to start averaging from 0 rather than looking at how long the user has been registered? IMHO, that calc as it is now isn't very useful. I for example have been registered for nearly 3 years, was online 3 hours after installing the hack. Shows my online time as 3 hours, but my per day average as 8 seconds :)

NTLDR
08-29-2002, 03:33 PM
Originally posted by Okiewan
Time online per day is out of whack for everyone but users who register after the hack is installed...

I attempted to do this but failed badly :p

The way I wanted to do it was if you registed before the date the hack was installed it calculated the time online since then per day, otherwise it did it since you registred, but I didn't get anywhere :cry:

scottct1
08-29-2002, 03:44 PM
Ok I clicked install. :) Any way to add a days column. :) Some of us spend way to much time in front of their computer!

wolfe
08-29-2002, 04:05 PM
i get this error on the time online leader page

Fatal error: Call to undefined function: dotimeonline() in /usr/local/psa/home/vhosts/mysite/httpdocs/forums/timeonline.php on line 39

wolfe
08-29-2002, 04:23 PM
not working properly on VBB 2.2.4

grog6
08-29-2002, 04:27 PM
Waouhouh, thx a lot G-force2k2 !

It's a very fabullous hack, thanks for this work, it works perfectly :)

NTLDR
08-29-2002, 04:52 PM
Originally posted by wolfe
not working properly on VBB 2.2.4

It works fine on vB 2.2.4, go through the instructions, I expect you have made a mistake ;)

g-force2k2
08-29-2002, 08:09 PM
wolfe did you make the changes to the admin/functions.php? regards...

g-force2k2

PsYc
08-29-2002, 09:26 PM
Originally posted by Okiewan
Cool hack, but a problem?

Time online per day is out of whack for everyone but users who register after the hack is installed... any way to change it to start averaging from 0 rather than looking at how long the user has been registered? IMHO, that calc as it is now isn't very useful. I for example have been registered for nearly 3 years, was online 3 hours after installing the hack. Shows my online time as 3 hours, but my per day average as 8 seconds :)


yes same problem here too...

the counter seems a bit buggy

can you have a look at it g-force2k2?

Souly
08-29-2002, 11:18 PM
I have do the follow to calculate a correct "Time Online Per Day".

First you need the Timestamp (LINUX) before you start to install my changes! ! !

in timeonline.php find:

$daysregs = floor((time() - $lead[2]) / 86400);


change it to: [installtimestamp=yourtimestampyou must change it manually]

$daysregs = floor((time() - installtimestamp) / 86400);


I have Start the Tool now, an now is Linuxtime=1030666140 - also my Code is

$daysregs = floor((time() - 1030666140) / 86400);


And don?t look on my bad english - first learn german :lick:

Boofo
08-29-2002, 11:24 PM
What does this mean? :) Isn't that on the server already?

First you need the Timestamp (LINUX) before you start to install my changes! ! !

g-force2k2
08-29-2002, 11:31 PM
aight... for all the ppl that feel cheated... here's a code i devised for ya...no the counter isn't buggy because it uses the joindate :p but here's a little code i whipped up for ppl like you that feel cheated :p regards...

open timeonline.php

find:

$daysregs = floor((time() - $lead[2]) / 86400);

replace with:

// Time Online Hack Addon (fair time per day?) g-force2k2
$fairtime = 1030505285;
if($joindate < $fairtime) {
$daysregs = floor((time() - $fairtime) /86400);
} else {
$daysregs = floor((time() - $lead[2]) / 86400);
}
// Time Online Hack Addon (fair time per day?) g-force2k2

should really change those values up for ya now ;) regards...

g-force2k2

g-force2k2
08-29-2002, 11:33 PM
ahh... see Souly had a similiar idea to me ;) just set the time back so but... for him all users will have that time as the register date... even if they register five weeks later ;) my code prevents that... but good thinking Souly :)

g-force2k2

Souly
08-29-2002, 11:41 PM
hehe - nice :) very nice :)

OK. you see -- iam a newbie! :dead:

Boofo
08-29-2002, 11:46 PM
All that did was make the Total Time Online and the Time Online Per Day the same value on my site. :)

g-force2k2
08-29-2002, 11:50 PM
Boofo what time code did you use? try this number see if it varies the values differently?

$fairtime = 1030494285;

regards...

g-force2k2

Boofo
08-30-2002, 12:22 AM
ok, that seemed to change it. It now look like around half (which would make sense since I installed this hack yesterday). But, what does this addon actually do? How will it affect people who register after it is installed? Thank you, by the way. :)

g-force2k2
08-30-2002, 12:27 AM
how will this effect users afterwards :p? well if their joindate is after the time that installed their time won't be effected at all ;) so this is only more or less a feature to help those that have been long time members :) regards...

g-force2k2

Kars10
08-30-2002, 10:30 AM
Hello G-Force!!
First Thankx for this great Hack. But theres a Problem with it.
Everytime i try to use the "next" Link in the Navigation of the "timeonline" i get a blank page. When i use the reload-Button the site is there. After this it works for 2-3 Klicks and then i get a white page. The same if i use the backlink in the "Forum-Navigation"....:confused:
I promised i make all youre Instruction says and i don?t see any error in my installation. Ok, i get that "zero-error" and make youre fix from Post #2. It works, but the Nav-Problem is a Problem...
Please help! ;)

PsYc
08-30-2002, 12:29 PM
another little error:

when i watch the timeonline.php i see that my online time increase, the seconds, minutes and so on

but i don't see the time of other members increasing, but i know they are online too with me at the same time.

only when i go through something else in the board and then go back to the timeonline.php i saw their time but refreshing the page doesnt work here

i have your - post, division by zero and the fairtime addon installed too

any suggestions?

g-force2k2
08-30-2002, 12:45 PM
hmm... i'll look into both issues...

Minifreunde make sure that you made the fix on the earlier posts... the links nextpage and the others i forgot to end with </a> could be a problem ;) it was fixed but perhaps you downloaded before hand... regards...

g-force2k2

Kars10
08-30-2002, 06:38 PM
Originally posted by g-force2k2
hmm... i'll look into both issues...

Minifreunde make sure that you made the fix on the earlier posts... the links nextpage and the others i forgot to end with </a> could be a problem ;) it was fixed but perhaps you downloaded before hand... regards...

g-force2k2

Hello G!
I downloadet the latest of youre versions, and here is the Link correct (the </a> appears). Ive done anything the manual says, believe me...
And the problem PsYc speaks of, about the metarefresh i get too...my page reloads not....i must reload it with the Refrehbutton of the Browser... :(
This Hack is great, but this Problems are bad for me...

Regards. :)

bommelchen
08-30-2002, 07:33 PM
I have a problem the time per day is always show 0 !!
Any idears ?

bommelchen

g-force2k2
08-30-2002, 08:22 PM
bommelchen did you make the change on post#71?

Minifreunde i will look into it now... as for the metafresh i don't really know... but is it a problem? unless you're sitting their under the timonline.php seeing each user's time go up then its really only their for displaying the time leaders...

btw Psyc and Minifreunde does the time of the other users just not go up? or just not go up untill you revisit via another session? regards i will try to sort everything out... regards...

g-force2k2

PsYc
08-30-2002, 08:51 PM
btw Psyc and Minifreunde does the time of the other users just not go up? or just not go up untill you revisit via another session? regards i will try to sort everything out... regards...




yes the time of other go up, but i remember it went up if i reloaded the page before or in the postbit when they are online, but for now it only shows in a new session like you mentioned above


edit: and i only see my time increasing by sec and so on in postbit and on the timeonline.php

g-force2k2
08-30-2002, 08:56 PM
Psyc but does there's go up at the same rate as yours or not? sorry for the trouble just trying to straighten things out :p regards...

g-force2k2

PsYc
08-30-2002, 09:04 PM
no its no trouble ;)

we trouble you :)

yes my time goes up and theirs not

but in a new session i see their new online time but then its still no going up with mine at the same time

as you said only in a new session

g-force2k2
08-30-2002, 09:05 PM
but is their time going up at an even rate? like when you go into a new session do they gain the exact amount of time that you do? regards...

g-force2k2

PsYc
08-30-2002, 09:11 PM
yes its like everyone see his time increasing but not the time of others but for everyone it counts right just not visible if you refresh the page

only in a new session

g-force2k2
08-30-2002, 09:14 PM
PsYc try adding this coding to the time template where you'd like it to appear ::

<a href='$PHP_SELF?s=$session[sessionhash]&action=view_leader'>[ reload page ]</a>

see if that fixes the probably instead of reloading click on the link ;) regards...

g-force2k2

PsYc
08-30-2002, 09:21 PM
nope still the same problem

i know before some addons it worked, dont know why not now

here is my timeonline.php

maybe you see an error:

--------------------------------------------------

<?php

error_reporting(7);

/* Total Time Online Hack v1.0
Created on Thursday August 22, 2002
Copyright g-force2k2
Notice :: Please do not edit (including addons) this hack. Thanks for respecting my work! */

$templatesused = "time,time_leader";

require('./global.php');

// +++++++ Time Online Hack Configuration [ Edit Below Only ] +++++++
$usersperpage = "10"; // Configure this to show the number per page on the leader board!
// +++++++ Time Online Hack Configuration [ Don't Edit Below This Line ] +++++++

if(trim($action) == "") {
$action = "view_leader";
}

// +++++++ Start Viewing Total Time Online Users +++++++
if($action == "view_leader") {
$perpage = $usersperpage;
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE timeonline > 0");
$totalpages = ceil($totalusers[0] / $perpage);
if($page == "") {
$page = 1;
}
$startat = ($page-1)*$perpage;
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline, posts
FROM user
WHERE userid!=0 AND timeonline > 0
ORDER by timeonline DESC LIMIT $startat,$perpage");
while($lead = $DB_site->fetch_array($leadtime)) {
$userid = $lead[0]; $username = $lead[1]; $joindate = vbdate($dateformat,$lead[2]); $timeonline = dotimeonline($lead[3]); $posts = $lead[4];
$fairtime = 1030490880;
if($joindate < $fairtime) {
$daysregs = floor((time() - $fairtime) /86400);
} else {
$daysregs = floor((time() - $lead[2]) / 86400);
}
if($daysregs == 0) { // checking to see if not registered for more then a day to prevent division by zero
$daysreg = 1;
} else {
$daysreg = $daysregs;
}
$dotimeperday = floor($lead[3] / $daysreg);
$timeperday = dotimeonline($dotimeperday);
eval("\$time_leader.= \"".gettemplate("time_leader")."\";");
}
if($page!=1) {
$prv = $page - 1;
$firstpage = "<a href='timeonline.php?s=$session[sessionhash]&action=view_leader&perpage=$perpage&page=1'\">[ Erste Seite ]</a>";
$prevpage = "<a href='timeonline.php?s=$session[sessionhash]&action=view_leader&perpage=$perpage&page=$prv'\">[ Vorherige Seite ]</a>";

}
if ($page!=$totalpages) {
$nxt = $page+1;
$nextpage = "<a href='timeonline.php?s=$session[sessionhash]&action=view_leader&perpage=$perpage&page=$nxt'\">[ Nächste Seite ]</a>";
$lastpage = "<a href='timeonline.php?s=$session[sessionhash]&action=view_leader&perpage=$perpage&page=$totalpages'\">[ Letzte Seite]</a>";
}
eval("dooutput(\"".gettemplate("time")."\");");
}

?>

---------------------------------------------------------

bommelchen
08-30-2002, 09:21 PM
bommelchen did you make the change on post#71?
Yes i have make the changes now and it is working but it is the same time like the total time !!!

Any idears?
bommelchen

g-force2k2
08-30-2002, 09:25 PM
bommelchen can you give me a screenshot? thanks in advance...

PSYc see if you can undo the changes and see if it works again... if not then i will try and work something up... regards...

g-force2k2

PsYc
08-30-2002, 09:56 PM
i used a new file than with the division by zero update

doesnt work


so i've uploaded my old timeonline.php i posted on page 6

hope you can find a clue

psyc :)

g-force2k2
08-30-2002, 10:02 PM
i really can't see any problems at the moment PsYc... just so you know it doesn't calculate every second the user is online... its probably as close as you can get to the real time that they're online... it doesn't tally each second by second... it does use sessions to keep track of the time online... i don't know if that helps you in your explanation... but i will still be looking for a fix for the reloading issue... regards...

g-force2k2

PsYc
08-30-2002, 10:05 PM
ah so you mean it shouldn't count every second of every member who is online?

only my time? so this is no error?

then you don't need to look at the code :)

sometimes i saw their secs move up and then not, this confused me a little

so if this is a desired behaviour its fine ;)

g-force2k2
08-30-2002, 10:09 PM
well like it was stated it only counts the time online in a new session... hence another user's time won't be counted unless they complete a new session... and it keeps track by the modifiable timeout code that i created for the admin/sessions.php if you were to count every single second it would probably require enourmous amounts of sqls... here it works when they have a new session within a certain amount of time(time out time) they will recieve that time... it may not be perfect... but it is extremely close ;) regards... and sorry for all the troubles... but it does work no ;)

g-force2k2

PsYc
08-30-2002, 10:16 PM
yes it works perfect as you said, so sorry for bothering you ;)


great support, this hack should be hack of the month :)

my nomination

g-force2k2
08-30-2002, 10:21 PM
Originally posted by PsYc
great support, this hack should be hack of the month :)

my nomination

thanks :) i really appreciate it ;)

g-force2k2

bommelchen
08-30-2002, 11:35 PM
PSYc see if you can undo the changes and see if it works again... if not then i will try and work something up... regards... I have undo the changes and it works too..... is this ok?
I will wait for the next day and icheck it again !

bommelchen

Kars10
08-31-2002, 06:09 AM
Originally posted by g-force2k2
btw Psyc and Minifreunde does the time of the other users just not go up? or just not go up untill you revisit via another session? regards i will try to sort everything out... regards...

g-force2k2

Yeah the time goes up in a session. But the fact with the lost connection is still there.
The Links are permanetly down. Even the Backlink to my index.php (main-forumpage) is down too.
I made the changes in the second post (with the zero error) and thats all. All other changes i made was in youre manual... :bored:

Rock
08-31-2002, 12:06 PM
Thanks alot! :D
Im actually installing the hack atm :D
cheerz and thx m8!

Rock
08-31-2002, 01:03 PM
Damnm finished installing the hack, its working on timeonline.php, i can see all the results ,
but its not working @ Postbit ...
any ideas ??
it only apears like this:
:bunny:

KarateKid
08-31-2002, 02:38 PM
I miss a

install.txt

in your zipped file!!

Goldknight
08-31-2002, 03:31 PM
Originally posted by Rock
Damnm finished installing the hack, its working on timeonline.php, i can see all the results ,
but its not working @ Postbit ...
any ideas ??
it only apears like this:
:bunny:

Did you add the new templates?

Goldknight
08-31-2002, 03:33 PM
Originally posted by KarateKid
I miss a

install.txt

in your zipped file!!

g-force2k2 have his own system.. check "install_timeonline.php" in the zip that he attach it at first post. It is "modify" install.txt. Open it up with any text editor and you will see the instruction inside.

g-force2k2
08-31-2002, 03:40 PM
Minifreunde :: Attach your timeonline.php here and i will debug for you regards...

Rock :: what lines did you put in the admin/functions.php ?

KarateKid :: Goldknight is correct... the install_timeonline.php is the txt file... regards...

Goldknight :: thanks for the help :)

g-force2k2

Kars10
08-31-2002, 04:31 PM
Originally posted by g-force2k2
Minifreunde :: Attach your timeonline.php here and i will debug for you regards...

Rock :: what lines did you put in the admin/functions.php ?

KarateKid :: Goldknight is correct... the install_timeonline.php is the txt file... regards...

Goldknight :: thanks for the help :)

g-force2k2
Ok here it is!
Thanks... :D

g-force2k2
08-31-2002, 05:08 PM
hmm... i just compared the files Minifreunde and i didn't see any difference... now you said that the links didn't work correctly yes? cause i uploaded your timeonline.php to my forum and it works fine... all five links work etc... so im not sure what to tell you? regards...

g-force2k2

KarateKid
08-31-2002, 09:58 PM
thanks Goldknight,

I knew it. But I searched for this mentioned file. But its ok. I'll do it so :-)

LouChipher
09-01-2002, 12:32 PM
Is it possible to add a history for every day with the top30 online users (very active guest possible, too)? and the day average, since instal the hack, new member from register date...

Rock
09-01-2002, 02:11 PM
Originally posted by g-force2k2
Minifreunde :: Attach your timeonline.php here and i will debug for you regards...

Rock :: what lines did you put in the admin/functions.php ?

KarateKid :: Goldknight is correct... the install_timeonline.php is the txt file... regards...

Goldknight :: thanks for the help :)

g-force2k2


Mate, i added the lines u said in the install file ...
Here they are:

File Modification (5)
// +++++++++++++++++++++
open admin/functions.php (2)

find: (1)

$post[joindate]=vbdate($registereddateformat,$post[joindate]);

below it add:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$post[onlinetime] = dotimeonline($post[timeonline]);
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

find: (2) (the second appeareance)

?>

above it add:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
// do time online function
function dotimeonline($timeonline) {

$days = floor($timeonline / 86400);
if($days == 0) {
$ftime = "";
} elseif($days == 1) {
$ftime = "$days Day, ";
} else {
$ftime = "$days Days, ";
}

$tothours = $days * 86400;
$newhours = $timeonline - $tothours;
$hours = floor($newhours / 3600);
$ftime.= "$hours Hours, ";

$totmin = (($hours * 3600) + ($days * 86400));
$newmin = $timeonline - $totmin;
$minutes = floor($newmin / 60);
$ftime.= "$minutes Minutes, ";

$totsec = (($hours * 3600) + ($minutes * 60) + ($days * 86400));
$seconds = $timeonline - $totsec;
$ftime.= "$seconds Seconds Online";

return $ftime;

}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++



Did exactly what u said on the install file...

Rock
09-01-2002, 02:11 PM
Originally posted by Goldknight


Did you add the new templates?

dUhhhh ...
Of course ...

wolfe
09-01-2002, 03:27 PM
right i got a test for you

g-force2k2

is there anyway of adding a bit to the user.php file in the Admin CP so you can find users by time online and also mass delete them and mass email them by there time spent online :D this would be great if you can :D

wolfe
09-01-2002, 03:34 PM
also i got it working Great hakc d00d :D:D

suzemir
09-01-2002, 08:19 PM
great hack - i love it

thanks

groovesalad
09-01-2002, 11:36 PM
Doesn't work. Here's what happens.

As soon as I edit admin/sessions.php from:

find: (1)

if ($session['styleid']!=0) {
$bbuserinfo['styleid'] = $session['styleid'];
}

to

// +++++++ Time Online Hack [ g-force2k2 ] +++++++
$inactivetime = 5; // Configure Time Out Time Here in Minutes!
$factivetime = $inactivetime * 60;
$newtime = time() - $bbuserinfo[lastactivity];
if($newtime < $factivetime) {
$DB_site->query("UPDATE user SET timeonline=timeonline+$newtime WHERE userid='$bbuserinfo[userid]'");
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++




I get this when my page loads:

There seems to have been a slight problem with the Groove-Salad database.
Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.

Database error in vBulletin 2.2.6:

Invalid SQL: UPDATE user SET timeonline=timeonline+2 WHERE userid='3'
mysql error: Unknown column 'timeonline' in 'field list'

mysql error number: 1054

Date: Sunday 01st of September 2002 05:31:31 PM
Script: http://groove-salad.com/forum/forum/
Referer:




I don't understand why it's saying the script is at http://groove-salad.com/forum/forum/

Any help would be greatly appreciated.

Goldknight
09-01-2002, 11:59 PM
Originally posted by Rock


dUhhhh ...
Of course ...

Ok, I m going to let g-force2l2 care of this one..

later


bah

g-force2k2
09-02-2002, 01:30 AM
groovesalad did you run the queries first? regards...

g-force2k2

wolfe
09-02-2002, 01:33 AM
please help

https://vborg.vbsupport.ru/showthread.php?postid=293943#post293943

groovesalad
09-02-2002, 01:34 AM
gforce: sorry, new to this. How do I run a query?

g-force2k2
09-02-2002, 01:39 AM
you can run it through either phpmyadmin (if you know what that is) or you could simply find the runaquery hack by Firefly just search his profile... or i can just make you a auto installer that'll automatically run the queries for you... your call ;) regards...

g-force2k2

g-force2k2
09-02-2002, 01:40 AM
wolfe i'll look into an addon if ppl are interested... i have alot to do at the moment... but i'll see what i can do in the future... regards...

g-force2k2

Boofo
09-02-2002, 01:54 AM
How can we add the time online that is in the postbit to the private messages postbit (privmsg)?

wolfe
09-02-2002, 01:56 AM
d00d have you got phpmyadmin

g-force2k2
09-02-2002, 02:12 AM
Boofo :

open private.php

find:

$fromuserinfo['username'] = "N/A";
}

under it add:

$fromuserinfo[onlinetime] = dotimeonline($fromuserinfo['timeonline']);

then open privmsg template

place where you want:

Time Online: $fromuserinfo[onlinetime]

regards...

g-force2k2

wolfe
09-02-2002, 02:26 AM
thanx d00d

Boofo
09-02-2002, 03:12 AM
Thanks, g-force2k2. ;)

Castel
09-02-2002, 06:47 AM
Nice hack g-force2k2, love your forum design BTW. This hack could get pretty server intensive for heavy traffic forums however since it updates the user table at each page load.

You could move the user table update query into the updateuserforum function and get online time tracking done without any extra queries what so ever. It will lose a bit of it's 'real time' feel but not a bad compromise for a busy site.

If not that, moving up the code a few lines in sessions.php will at least exclude the non registered or non logged in users from generating the extra query on each page load.

TECK
09-02-2002, 07:07 AM
great hack. i will install this one for sure. :)
now a question. i want it to display the top20 onliners. should i look into this mod? or can you write this up? thanks g-force.

hmm i noticed this on your first post:
"Please respect my hack and don't make any alterations unless permission is granted by me... thanks for respecting my hacks..."
what do you mean by this? well if i install your hack, rest assured i will modify it the way it suit best for my board.

g-force2k2
09-02-2002, 07:18 AM
Nakkid(TECK) i don't mean template changes and looks... feel free to make it look they way you'd like... as for the top20 there's an option to configure for the amount per page you want to view... regards...

Edit:: there besides i just granted you permission to edit what you'd like :p enjoy... And just so you know it does come with a page navigation feature ;) hope all that helps somewhat...

g-force2k2

Rock
09-02-2002, 12:08 PM
Help plz ?

TECK
09-02-2002, 01:11 PM
Originally posted by g-force2k2
Nakkid(TECK) i don't mean template changes and looks... feel free to make it look they way you'd like... as for the top20 there's an option to configure for the amount per page you want to view... regards...

Edit:: there besides i just granted you permission to edit what you'd like :p enjoy... And just so you know it does come with a page navigation feature ;) hope all that helps somewhat...

g-force2k2 thanks. :)
you got me scared with the permission thing...

Kmaster
09-02-2002, 01:35 PM
Cool hacks~~thanks a lot

g-force2k2
is that possible hide admin online time to another group? keep admin info. secret~~ :p

g-force2k2
09-02-2002, 03:33 PM
Kmaster for the postbit try this ::

open admin/functions.php

find:

$post[onlinetime] = dotimeonline($post[timeonline]);

replace it with:

if($post[usergroupid] == 6) {
$post[onlinetime] = "";
} else {
$post[onlinetime] = dotimeonline($post[timeonline]);
}

open member.php

find:

eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");

replace it with:

if($userinfo[usergroupid] == 6) {
$getinfo_timeonline = "";
} else {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
}

finally

open timeonline.php

find:

$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user");

replace with:


if($bbuserinfo[usergroupid] != 6) {
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE usergroupid != 6");
} else {
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user");
}

then find:

$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
ORDER by timeonline DESC LIMIT $startat,$perpage");

replace with:

if($bbuserinfo[usergroupid] != 6) {
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
WHERE usergroupid != 6
ORDER by timeonline DESC LIMIT $startat,$perpage");
} else {
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
ORDER by timeonline DESC LIMIT $startat,$perpage");
}

Haven't tested it yet Kmaster.... but give it a shot :) regards...

g-force2k2

eXtremeTim
09-02-2002, 03:56 PM
Yet another good hack. I will install this one soon.

Boofo
09-02-2002, 04:44 PM
g-force2k2, do these 2 pieces of code look right to you? They work the way they are but I'm not sure if they will interfere with anything else. This also includes the code you gave me to NOT display users with zero time in the list. I would also like to be able to NOT display the Total Online Time in the posts for users who have zero time or Admins. Any way to do that?

if($bbuserinfo[usergroupid] != 6) {
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE usergroupid != 6 AND timeonline > 0");
} else {
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE timeonline > 0");
}

And:

if($bbuserinfo[usergroupid] != 6) {
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline, posts
FROM user
WHERE timeonline > 0
ORDER by timeonline DESC LIMIT $startat,$perpage");
} else {
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline, posts
FROM user
WHERE usergroupid != 6 AND timeonline > 0
ORDER by timeonline DESC LIMIT $startat,$perpage");
}

g-force2k2
09-02-2002, 04:52 PM
looks right to me Boofo...

open admin/functions.php

find:

$post[onlinetime] = dotimeonline($post[timeonline]);

replace it with:

if($post[usergroupid] == 6 OR $post[timeonline] == 0) {
$post[onlinetime] = "";
} else {
$post[onlinetime] = dotimeonline($post[timeonline]);
}

open member.php

find:

eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");

replace it with:

if($userinfo[usergroupid] == 6 OR $userinfo[timeonline] == 0) {
$getinfo_timeonline = "";
} else {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
}


That should do the trick Boofo... but a quick thing about user time online being zero... this actually should not take effect anymore... because all new registers will have a timeonline from the point that you installled... only reason some users hack a timeonline that is zero is because the fact that you installed it after your forum has been up for quite some time ;) this really has nothing to do with this addition just explaining why users shouldn't havea timeonline of zero anymore... regards...

g-force2k2

Boofo
09-02-2002, 05:18 PM
Thanks for the help, g-force2k2. The only reason I want it to not show zero time online users is because I have a few members that haven't been on for a while and probably won't be again and it just looks a little cleaner this way. One last thing. I need to make it so the Total Time Online link doesn't show up in the posts where there is no time after it (for like Admins and zero time-users). Can you help me with that final thing, sir? :)

Also, does this code look right to you? This is from the member.php. It doesn't need that last else statement does it?

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[usergroupid] == 6 OR $userinfo[timeonline] == 0) {
$getinfo_timeonline = "";
} else {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
}
}
} else {
$getinfo_template = "";
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

g-force2k2
09-02-2002, 05:29 PM
Change this:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[usergroupid] == 6 OR $userinfo[timeonline] == 0) {
$getinfo_timeonline = "";
} else {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
}
}
} else {
$getinfo_template = "";
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

to this:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[usergroupid] == 6 OR $userinfo[timeonline] == 0) {
$getinfo_timeonline = "";
} else {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++

As for the postbit idea... just make a new template called

postbit_timeonline

in it place the coding that was inserted into the postbit template

open showthread.php

and add the postbit_timeonline to the $templatesused

then in admin/functions.php

find:

$post[onlinetime] = dotimeonline($post[timeonline]);


replace it with:

$post[onlinetime] = dotimeonline($userinfo[timeonline]);
if($post[usergroupid] == 6 OR $post[timeonline] == 0) {
$postbit_timeonline = "";
} else {
eval("\$postbit_timeonline = \"".gettemplate('postbit_timeonline')."\";");
}

then back in the postbit template but the $postbit_timeonline in the position of the inserted code you removed to put in the postbit_timeonline template... regards...

g-force2k2

Boofo
09-02-2002, 05:35 PM
Thank you. I should be able to use $postbit_timeonline for the private messages too, right? If so, I am all set now. Thanks again. :)

Boofo
09-02-2002, 05:54 PM
Shouldn't this:


$post[onlinetime] = dotimeonline($userinfo[timeonline]);
if($post[usergroupid] == 6 OR $post[timeonline] == 0) {
$postbit_timeonline = "";
} else {
eval("\$postbit_timeonline = \"".gettemplate('postbit_timeonline')."\";");
}


Actually be this?


$post[onlinetime] = dotimeonline($post[timeonline]);
if($post[usergroupid] == 6 OR $post[timeonline] == 0) {
$postbit_timeonline = "";
} else {
eval("\$postbit_timeonline = \"".gettemplate('postbit_timeonline')."\";");
}

g-force2k2
09-02-2002, 05:56 PM
yeah my bad Boofo :p $post not $userinfo ;) regards...

g-force2k2

springbok
09-02-2002, 08:07 PM
Absolutely love it.

g-force2k2
09-03-2002, 01:27 AM
btw Boofo so everything worked out fine?

thanks Springbok :) glad to hear ;) regards...

g-force2k2

Rodney
09-03-2002, 09:46 AM
hi.... i cant find --- > find: (2) (the second appeareance)

?>

in admin/functions.php

Boofo
09-03-2002, 10:19 AM
It's the one at the very bottom of the file.

Originally posted by Rodney
hi.... i cant find --- > find: (2) (the second appeareance)

?>

in admin/functions.php

Boofo
09-03-2002, 10:20 AM
Yes, sir, it did. Thanks for all the help. :)

Originally posted by g-force2k2
btw Boofo so everything worked out fine?

regards...

g-force2k2

Kmaster
09-03-2002, 01:21 PM
Originally posted by g-force2k2
Kmaster for the postbit try this ::

open admin/functions.php

find:

$post[onlinetime] = dotimeonline($post[timeonline]);

replace it with:

if($post[usergroupid] == 6) {
$post[onlinetime] = "";
} else {
$post[onlinetime] = dotimeonline($post[timeonline]);
}

open member.php

find:

eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");

replace it with:

if($userinfo[usergroupid] == 6) {
$getinfo_timeonline = "";
} else {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
}

finally

open timeonline.php

find:

$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user");

replace with:


if($bbuserinfo[usergroupid] != 6) {
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE usergroupid != 6");
} else {
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user");
}

then find:

$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
ORDER by timeonline DESC LIMIT $startat,$perpage");

replace with:

if($bbuserinfo[usergroupid] != 6) {
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
WHERE usergroupid != 6
ORDER by timeonline DESC LIMIT $startat,$perpage");
} else {
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
ORDER by timeonline DESC LIMIT $startat,$perpage");
}

Haven't tested it yet Kmaster.... but give it a shot :) regards...

g-force2k2

Kwel~~thank you so much!!

LouChipher
09-03-2002, 03:46 PM
Originally posted by LouChipher
Is it possible to add a history for every day with the top30 online users (very active guest possible, too)? and the day average, since instal the hack, new member from register date...

g-force2k2? :rolleyes:

g-force2k2
09-03-2002, 05:07 PM
Louchipher not exactly sure what you mean... if you're talking about making up for lost time i posted a fix on post#71 you can just call the time() function in any php file and echo it to see what time to use as your install time... then just replace the time...

But if you mean like a day by day stats...like top 30 usersonline today would be a tougher hack... yet not saying its not possible but would probably require more queries and such... regards...

g-force2k2

D. Hollingworth
09-04-2002, 09:34 AM
Originally posted by Minifreunde
Hello G-Force!!
First Thankx for this great Hack. But theres a Problem with it.
Everytime i try to use the "next" Link in the Navigation of the "timeonline" i get a blank page. When i use the reload-Button the site is there. After this it works for 2-3 Klicks and then i get a white page. The same if i use the backlink in the "Forum-Navigation"....:confused:
I promised i make all youre Instruction says and i don?t see any error in my installation. Ok, i get that "zero-error" and make youre fix from Post #2. It works, but the Nav-Problem is a Problem...
Please help! ;)

Heh, and I thought it was just me. Yep, same thing is happening here. At random times, you click on something and it returns a blank page- refresh, and you can see the page again:p G-Force, have you had time to look into this yet? Although this hack has provided its share of challenges, (probably the most I?ve had to deal with yet), it?s still one of the best ones I?ve seen. Any solutions to this strange anomaly would be appreciated.

Great work!

Dave H

wolfe
09-04-2002, 10:52 AM
i get that with VBB 2.2.4 i think its a HTML Timeout thats not supposed to be there :(

D. Hollingworth
09-04-2002, 10:59 AM
I?m running 2.2.7. It?s weird. I checked the page source, and squat! No partial headers, no nothing. It?s almost like it?s not even retrieving the page from the db. It only happens every so often, and yes? It?s most likely to happen when you try to link from anything in the display list. It?s no emergency, but it would be nice to correct the error just the same :)

Dave H

g-force2k2
09-04-2002, 11:08 AM
okay D. Hollingworth i'll look further into the situation ;) just have college and then i will do my part and do alittle research :) regards... glad that you like it...

g-force2k2

D. Hollingworth
09-04-2002, 11:19 AM
Thanks-o-many.

Incase it helps at all, I just tried to 'update counters' in the Admin Panel, and I got a blank page when I clicked “update.’ I guess it might not be limited to just the main forums.

Dave H

wolfe
09-04-2002, 11:35 AM
ok here is my design

In functions.php

Repalce


// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
// do time online function
function dotimeonline($timeonline) {

$days = floor($timeonline / 86400);
if($days == 0) {
$ftime = "";
} elseif($days == 1) {
$ftime = "$days Day, ";
} else {
$ftime = "$days Days, ";
}

$tothours = $days * 86400;
$newhours = $timeonline - $tothours;
$hours = floor($newhours / 3600);
$ftime.= "$hours Hours, ";

$totmin = (($hours * 3600) + ($days * 86400));
$newmin = $timeonline - $totmin;
$minutes = floor($newmin / 60);
$ftime.= "$minutes Minutes, ";

$totsec = (($hours * 3600) + ($minutes * 60) + ($days * 86400));
$seconds = $timeonline - $totsec;
$ftime.= "$seconds Seconds Online";

return $ftime;

}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++



with



// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
// do time online function
function dotimeonline($timeonline) {

if($days == 0) {
$ftime = "";
} elseif($days == 1) {
$ftime = "$days Day, ";
} else {
$ftime = "$days Days, ";
}

$totdays = $days * 86400;
$newdays = $timeonline - $tothours;
$days = floor($newdays / 86400);
$ftime.= "<b>$days</b> Days, ";

$tothours = $days * 86400;
$newhours = $timeonline - $tothours;
$hours = floor($newhours / 3600);
$ftime.= "<b>$hours</b> Hrs, ";

$totmin = (($hours * 3600) + ($days * 86400));
$newmin = $timeonline - $totmin;
$minutes = floor($newmin / 60);
$ftime.= "<b>$minutes</b> Mins, ";

return $ftime;

}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++



to get it to look like this with out having a day on it :D

wolfe
09-04-2002, 11:39 AM
and to put it in your postbit template

under avatar.

Find


$post[avatar]<p>



and replace it with



<br><br>
$post[avatar]<br><br><smallfont><a href='timeonline.php?s=$session[sessionhash]&action=view_leader'><b>Time Spent On This Board:</b></a><br> $post[onlinetime] </smallfont><br><br>


enjoy :D

D. Hollingworth
09-04-2002, 12:18 PM
Hmm... I don't have $post[avatar]<p> in my functions.php. I have all sorts of $post[avatar]=""; occurances instead. Maybe cause it's 2.27. This is getting stranger. My users in the "non-moderated" group are racking up the correct time. The users in the "moderated" section can be hanging around for 30-minutes or more, yet they remain at zero, or at 1-second.

Infact, the only user that 'was' displaying 1-second has now reverted back to 0.0.0. ): Oh well, at least my non-moderated members are displaying correctly :)

Dave H

wolfe
09-04-2002, 12:21 PM
no d00d the Avatr but is in your postbit template :D sorry

D. Hollingworth
09-04-2002, 12:25 PM
*Snicker* :p

Gotta stop these all nighters.

Thanks man.

g-force2k2
09-04-2002, 01:22 PM
hmm... D. Hollingworth what this situation about moderated members? i will look into it if deemed necessary... sounds wierd... regards...

g-force2k2

D. Hollingworth
09-04-2002, 09:20 PM
Sorry about that... All seems to have stabilized now, and everything is showing up as it should. Maybe it needed a break in period?:p I'll continue to watch it, but I think all will be fine.

The only real issue is linking off any page, and or within any page the online tracker generates. It still keeps coming up with blank pages, and you have to refresh to view the page. Looks like something pretty minor, but that?s really the only problem right now.

Thanks again,

Dave H

Matt87
09-06-2002, 08:48 PM
You say that I can't modify anything, that means that I can't even modify postbit, so that it doesn't say this information there?!

NTLDR
09-06-2002, 08:50 PM
Originally posted by Matt87
You say that I can't modify anything, that means that I can't even modify postbit, so that it doesn't say this information there?!

See my post in the warnings hack ;)

Modifying the post bit won't be any problem.

Matt87
09-06-2002, 09:18 PM
Yes, I saw it, I posted this before I posted that :p

g-force2k2
09-06-2002, 11:22 PM
thanks as always NTLDR ;) regards... hope you enjoy it Matt87 :)

g-force2k2

410
09-09-2002, 12:08 AM
I am getting this error...

Warning: Division by zero in /home/public_html/forums/timeonline.php on line 42

?

matthepepe
09-09-2002, 12:59 AM
Alright guys i have been trying and trying to get this to list in the memberlist but i cant seem to get it ... i have it showing up but everything is zeros.... any suggestions as to waht codes i need to add to anyfiles or whatever?

g-force2k2
09-09-2002, 01:58 AM
Originally posted by 410
I am getting this error...

Warning: Division by zero in /home/public_html/forums/timeonline.php on line 42

?

the fix is included in the zip... and on the first post...

matthepepe did you make sure to use the function? also you have to define it in the query...

regards...

g-force2k2

D. Hollingworth
09-09-2002, 03:49 AM
Everything’s working well here, except for that link problem. It only seems to be a problem for MS Explorer. I tried all versions of Netscape from 3.0 to 7.0, and no problems, so this blank page issue seems to be limited to ‘Explorer’ only. I’m not rushing you for a fix or anything, but just thought you’d want my updated findings.

Dave H

matthepepe
09-09-2002, 04:54 AM
Originally posted by g-force2k2


the fix is included in the zip... and on the first post...

matthepepe did you make sure to use the function? also you have to define it in the query...

regards...

g-force2k2

Im not quite sure what i did or needs to be done ... ... ill keep tinkering w/ it.

g-force2k2
09-09-2002, 11:44 AM
okay thanks Dave H. i'll look at the hack through ie today and see what i can find...

mattthepepe try using the dotimeonline function in conjunction with $userinfo[timeonline]

in the memberlist.php should include this

$userinfo[onlinetime] = dotimeonline($userinfo[timeonline];

within the

$userinfo=$DB_site->fetch_array($users)) {

then in the memberlistbit template put the variable $userinfo[onlinetime]

regards...

g-force2k2

matthepepe
09-09-2002, 03:27 PM
no luck there .... only brings up a blank memberlist page is all white.

chad777
09-14-2002, 03:35 AM
I am looking at timeonline.php?&action=view_leader

and when I look at it the Total Time Online and the Time Online Per Day are the same.

it has been installed for 3 days and those to are exactly the same....

how do you fix it to make Total time online the total time online and time online per day the time online per day ?

Join Date :09-10-2002
Total Time Online: 12 Hours, 44 Minutes, 16 Seconds Online
Time Online Per Day :12 Hours, 44 Minutes, 16 Seconds Online

This is what it reads ...

Is it getting the time wrong ??

PHiXTiT
09-14-2002, 10:55 AM
This is a great hacK!!! (5 StArZ)

jUst Wondering about this.?..

The initial zip file installed just great.

However, I want all the extra features so I went ahead and did all the other modifications that are chopped up throughout this thread....

- All users can see the time for all but admins on all pages.

- For all users (Admins too) viewing posts they see the time for all but admins. For admins they see a Time Online: link. They cant view the time online for an admin so why is it still a link in the postbit for admins. But admins can view the time on all other pages.

The only part that I think that is not clarified is what goes in the postbit_timeonline template and where the call for the postbit_timeonline template is exactly in the showthread.php. I put it in the showpost area of the showthread.php file.

I went through all the updates in this thread and created an updated txt file.

Can you please go through this and make sure it is all right. Or if you know of anything I missed out!

I have a feeling that I am not doing something right with the new template postbit_timeonline

Thanks in advance, I notice you are doing a great job on backing up your hacks to us, so I made sure to give a big 5, and a :D

g-force2k2
09-14-2002, 04:21 PM
PHiXTiT it looks good... but if you're wondering about whats up with the postbit stuff because its not looking correct just make $post[usergroupid] to $bbuserinfo[usergroupid] im not sure if you wanted it your way though... nice job though and thanks for the compliments :)

chad what formula do you currently have for calculating the time per day? regards...

g-force2k2

chad777
09-14-2002, 04:38 PM
Not sure what you are saying :)

here is the file..

g-force2k2
09-15-2002, 04:43 AM
chad777 it looks fine here O_o did you make any modifications or no? if not did you by chance edit the template? regards...

g-force2k2

chad777
09-15-2002, 05:29 AM
time_leader template

<tr><td bgcolor="#13486D" width="20%"><smallfont color="#000000"><a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$userid">
$username</a></smallfont></td>
<td bgcolor="#1C5780" width="20%"><smallfont color="#000000">$joindate</smallfont></td>
<td bgcolor="#13486D" width="30%"><smallfont color="#000000">$timeonline</smallfont></td>
<td bgcolor="#1C5780" width="30%"><smallfont color="#000000">$timeperday</smallfont></td></tr>

DiscussAnything
09-15-2002, 10:47 AM
just one quick note: I removed the $refreshheader or something from the Whosonline template because my users would goto who's online whenever they werent using their computers, since this will refresh every minute, and keep em active. It's a great way to cheat to get to the top of the list....

Also, instead of average time online per day, would it be possible to make the column display the online time for that week or so?

wolfe
09-15-2002, 04:42 PM
just updated to VBB 2.2.7 and getting this on the time online leader board

Call to undefined function: dotimeonline() in /usr/local/psa/home/vhosts/mysite.com/httpdocs/forums/timeonline.php on line 39

NTLDR
09-15-2002, 05:47 PM
You NEED to re-apply all your hacks, they won't work otherwise :rolleyes:

In particular you don't have the dotimeonline() function in functions.php which this hack requires. Follow the instructions and re-apply the hack

wolfe
09-15-2002, 09:01 PM
d00d i have got the bit in my functions.php and still not working :(

NTLDR
09-15-2002, 09:07 PM
Well you can't have done it correctly, check to make sure.

As the error message states, theres no dotimeonline() function avalible. This hack works fine on 2.2.7.

wolfe
09-15-2002, 09:10 PM
oh **** made a mistake works great now thanx d00d :D

NTLDR
09-15-2002, 09:11 PM
No problem, we all make silly little mistakes ;)

pjgoncalves
09-16-2002, 03:58 AM
this is a really cool hack!

i'm having a problem :(

this line:

$DB_site->query("UPDATE user SET timeonline=timeonline+$newtime WHERE userid='$bbuserinfo[userid]'");

is causing this:

Database error in vBulletin Control Panel 2.2.6:

Invalid SQL: UPDATE user SET timeonline=timeonline+94 WHERE userid='1'
mysql error: Unknown column 'timeonline' in 'field list'

mysql error number: 1054


and i have the timeonline in the field list as shown on the pic in attach.. any idea to fix this 'little' prob?

greets,
paulo

g-force2k2
09-16-2002, 01:47 PM
pjgoncalves,

did you run the query? regards...

ALTER TABLE user ADD timeonline int(10) NOT NULL DEFAULT '0'

g-force2k2

NSeXcellent
09-17-2002, 01:02 AM
Originally posted by g-force2k2
pjgoncalves,

did you run the query? regards...

ALTER TABLE user ADD timeonline int(10) NOT NULL DEFAULT '0'

g-force2k2

Im stuck on doing that. Can you explain to me what that means? I cannot figure out what you mean by 'Run Query'... Thanks G

g-force2k2
09-17-2002, 01:17 AM
NSeXcellent

just download the file i attached and place it in your admin folder... then run the url...

ie: ...forum/admin/test.php

and it should run the query for you ;) regards... haven't tested it but it should work :) regards...

g-force2k2

NSeXcellent
09-17-2002, 01:33 AM
Ok i'm not sure if i've missed something or not. I've followed the instructions in 'install_timeonline' to the T. Uploaded the 3 php files that were edited, added all the templates, ran the query. My problem is a small one. I cannot see where the Time Online is supposed to show up. I dont see it anywhere. I guess I have missed something. At least I am getting no errors :D ... Any idea what I might have missed?

g-force2k2
09-17-2002, 04:48 PM
did you make the postbit edit ;) regards...

g-force2k2

Bison
09-18-2002, 06:34 AM
Some of my members aren't showing a time in their profiles and some are. I see then on the board and they've been online longer that some of the members who's time IS showing up.

What am I doing wrong here?

g-force2k2
09-18-2002, 01:13 PM
Rolodex did you make any kind of restrictions to any usergroups? regards...

g-force2k2

Bison
09-18-2002, 05:20 PM
None ... but never mind "G" ... for some unknown reason, it started working!

While I got you here, I want to tell you that you put togetther the MOST "smoothly" installed hacks on this board!!!

Do you have a PayPal account? I'd pay you in a heart beat! :)

Thank you for you excellent work M8! :)

bouncer18
09-19-2002, 04:15 PM
im an idiot

post removed cause you answered it 532895934 times now

Bison
09-19-2002, 04:18 PM
Use this ( I cleaned up the one g-force2k2 added in the zipfile):

bouncer18
09-19-2002, 04:22 PM
DAMNIT

Sorry guys..
i am a fool

maybe if i readthe first thread i wouldnt have to feel so stupid.

Great hack, i like it

GoTTi
09-19-2002, 10:36 PM
g-force, can you combine the edits to the hack into a new .zip file and upload it for us, 14 pages of downloading and editing is getting confusin..

maybe because i am tired ;)

Bison
09-19-2002, 11:26 PM
Nothing confusing about it ... install the app and refer to this page while doing it. The guy does this stuff for free ... what else do you want?

Dark Shogun
09-20-2002, 09:08 AM
Does anyone know how to get rid of this error when viewing the leader board? Warning: Division by zero in /web/blarg/public_html/testvb/timeonline.php on line 42

Dark Shogun

bouncer18
09-20-2002, 04:10 PM
Originally posted by Dark Shogun
Does anyone know how to get rid of this error when viewing the leader board? Warning: Division by zero in /web/blarg/public_html/testvb/timeonline.php on line 42


Dark Shogun

check his first post

Bison
09-20-2002, 07:49 PM
Originally posted by bouncer18
im an idiot

post removed cause you answered it 532895934 times now

"NO Comment!"

NSeXcellent
09-20-2002, 10:27 PM
Hi guys... I got it working fine except for one thing. I'm really not in need of the leader list, but a few members requested it. I was getting the 'Division by Zero' error, but edited the 'timeonline.php' with the fix. Now when I click on the link in postbit, it opens up the timeonline.php link, but i'm getting a blank page. This could have possibly been covered already, but i dont remember seeing a fix or solution. Any help? Thanks!

xevito
09-21-2002, 12:36 AM
Can someone write an idiots guide and post an updated file - this thread is getting confusing now.

GoTTi
09-21-2002, 09:43 PM
I am having slight problem with this hack

The Time Online is not being displayed in the user threads, which I assume is the postbit templates.

Attached is SS of what it is doing.

Neo
09-22-2002, 12:21 AM
Why did you incert a new row for this?

You dont need to do any database edits to make this hack.

TECK
09-22-2002, 07:43 PM
should i say it's a great one... you hack, still?? :)

btw, i use a very light part of you hack,
i mod it to give me only the online hours spent.. in the post only.
here it is a little piece my postbit, with the activity online:

GoTTi
09-23-2002, 01:08 AM
Neo what do u mean?

TECK
09-23-2002, 03:03 AM
Originally posted by Neo
Why did you incert a new row for this?

You dont need to do any database edits to make this hack. yes you do.

TECK
09-23-2002, 01:31 PM
hmm g-force, i just realised that the hack it's adding a query everywhere, in all pages. i really dont like that because i'm trying to stay with an average of max 18queries on my forums.

and you should use in your sessions.php something like:
$timeactive = time() - $bbuserinfo['lastactivity'];
if ($bbuserinfo['userid'] != 0 and $timeactive < (5 * 60)) {
$DB_site->query("UPDATE user SET timeactivity=timeactivity+$timeactive WHERE userid='$bbuserinfo[userid]'");
}
so it doesnt perform a query also for quests. it will save you some serverload.

UPDATE :)
check below how to optimise the code and eliminate the extra query...
wait for g-force to update his files... or do it yourself if your belt is strong enough.

g-force2k2
09-23-2002, 03:51 PM
NSeXcellent:

make sure that the link is this:

<a href='timeonline.php?s=$session[sessionhash]&action=view_leader'>Time Online:</a>

xevito:

everything is included in the zip file, other changes are just custom ones nothing necessary

Da GoTTi:

did you include the $post[onlinetime] variable in the postbit?

Neo:

how would you do it?

TECK:

thanks for the addition :) i will add the link to the first post ;)

regards...

g-force2k2

TECK
09-23-2002, 04:37 PM
ok, g-force i found a way to dont load any query at all. you can update your code if you want... is your hack and it's a great tool.
now let's optimise shall we? :)

here it is what i did, step by step (keep in mind i used my own terms, change them to yours):
run this query:
ALTER TABLE user ADD timeactivity int(10) unsigned DEFAULT '0' NOT NULL AFTER posts
in /admin/functions.php find:
$post[joindate]=vbdate($registereddateformat,$post[joindate]);
replace it with:
$post[joindate]=vbdate($registereddateformat,$post[joindate]);

// activity time
$post[activity] = floor($post[timeactivity] / 3600);
if ($post[activity] <> 1) {
$pluralhour = 's';
} else {
$pluralhour = '';
}
in /admin/sessions.php find:
if ($ourtimenow - $bbuserinfo['lastactivity'] > $cookietimeout) {
if (!isset($bypass)) {
if ($noshutdownfunc) {
$DB_site->query("UPDATE user SET lastvisit=lastactivity,lastactivity=$ourtimenow".iif($showforumusers,",inforum='0' ","")." WHERE userid='$bbuserinfo[userid]'");
} else {
$shutdownqueries[99]="UPDATE user SET lastvisit=lastactivity,lastactivity=$ourtimenow".iif($showforumusers,",inforum='0'","")." WHERE userid='$bbuserinfo[userid]'";
}
}
$bbuserinfo['lastvisit'] = $bbuserinfo['lastactivity'];
} else {
if (!isset($bypass)) {
if ($noshutdownfunc) {
$DB_site->query("UPDATE user SET lastactivity=$ourtimenow".iif($showforumusers,",inforum='0' ","")." WHERE userid='$bbuserinfo[userid]'");
} else {
$shutdownqueries[99]="UPDATE user SET lastactivity=$ourtimenow".iif($showforumusers,",inforum='0' ","")." WHERE userid='$bbuserinfo[userid]'";
// This update will be done in the doshutdownfunction automatically, but the old method was doing screwy things!!
}
}
$bbuserinfo['lastvisit'] = $bbuserinfo['lastvisit'];
}
replace it with:
$timeactive = time() - $bbuserinfo['lastactivity'];
if ($ourtimenow - $bbuserinfo['lastactivity'] > $cookietimeout) {
if (!isset($bypass)) {
if ($noshutdownfunc) {
$DB_site->query("UPDATE user SET ".iif($bbuserinfo['userid']!=0 and $timeactive<(1*60),"timeactivity=timeactivity+$timeactive,","")."lastvisit=lastactivity,lastactivity=$ourtimenow".iif($showforumusers,",inforum='0' ","")." WHERE userid='$bbuserinfo[userid]'");
} else {
$shutdownqueries[99]="UPDATE user SET ".iif($bbuserinfo['userid']!=0 and $timeactive<(1*60),"timeactivity=timeactivity+$timeactive,","")."lastvisit=lastactivity,lastactivity=$ourtimenow".iif($showforumusers,",inforum='0'","")." WHERE userid='$bbuserinfo[userid]'";
}
}
$bbuserinfo['lastvisit'] = $bbuserinfo['lastactivity'];
} else {
if (!isset($bypass)) {
if ($noshutdownfunc) {
$DB_site->query("UPDATE user SET ".iif($bbuserinfo['userid']!=0 and $timeactive<(1*60),"timeactivity=timeactivity+$timeactive,","")."lastactivity=$ourtimenow".iif($showforumusers,",inforum='0' ","")." WHERE userid='$bbuserinfo[userid]'");
} else {
$shutdownqueries[99]="UPDATE user SET ".iif($bbuserinfo['userid']!=0 and $timeactive<(1*60),"timeactivity=timeactivity+$timeactive,","")."lastactivity=$ourtimenow".iif($showforumusers,",inforum='0' ","")." WHERE userid='$bbuserinfo[userid]'";
// This update will be done in the doshutdownfunction automatically, but the old method was doing screwy things!!
}
}
$bbuserinfo['lastvisit'] = $bbuserinfo['lastvisit'];
}
in postbit template, add:
Activity Online: <font color="#E4630A">$post[activity]</font> hour$pluralhour
anywhere you like... voila, no queries loaded and also the event time is set to 1, so no more limits and worries about the exact time...

as i said before, i did it this way because all i wanted to have is the time in postbit.
the results? a screenshot is here (https://vborg.vbsupport.ru/attachment.php?s=&postid=301692)...

go ahead and update your cool hack now. :)
thanks for letting me aport a small contribution to it.

cheers.
floren. :)

monitox
09-23-2002, 06:01 PM
Great great HACK ! :classic:

Thank YOU very much man !
I use it on a (mutilated :) ) 2.2.2 board and works PERFECT !

Have A Cool Day !

monitox
09-23-2002, 07:15 PM
TECK > your modification is NOT working for me :glasses:
Give me MySQL error :(

PS: esti cumva Roman ? :D

TECK
09-23-2002, 07:21 PM
monitox, it doesnt work because the params and variables are not identical. this is a custom install for my forum, not the original hack. just wait for g-force to customize it, because you add an extra query on the process with his current hack...

and yes i'm romanian.. you can tell by the name. :)

GoTTi
09-23-2002, 09:47 PM
g-force =

Yes the code is in the postbit, here is what I got in there:

<p align="right"><smallfont><a href="javascript:openeditsigwindow(490,320,'$session[sessionhash]','$post[userid]')">Edit Sig</a> | <a href="report.php?s=$session[sessionhash]&postid=$post[postid]">Report this post to a moderator</a> | $post[iplogged] | <a href='timeonline.php?s=$session[sessionhash]&action=view_leader'>Time Online:</a>$post[onlinetime]</smallfont></p>

anything wrong?

g-force2k2
09-24-2002, 01:52 PM
Da_GoTTi: did you make the admin/functions.php file edit? regards...

g-force2k2

NSeXcellent
09-24-2002, 02:43 PM
Originally posted by g-force2k2
NSeXcellent:

make sure that the link is this:

<a href='timeonline.php?s=$session[sessionhash]&action=view_leader'>Time Online:</a>


Its identical to that. It just brings up a blank page.

GoTTi
09-24-2002, 10:39 PM
yes the modification is on the functions....

all of it is in correctly, i dunno what is causing it.

groovesalad
09-24-2002, 11:35 PM
Da Gotti - I'm having the same issue. Just comes up not finding the page.

groovesalad
09-24-2002, 11:56 PM
I get a division by zero error when I click on the Time Online link. I've looked at the zero.php file, but it looks like a lot of computer garble. Am I supposed to upload this .php file? I can't decipher directions from it.

groovesalad
09-25-2002, 12:05 AM
Originally posted by g-force2k2
aight... for all the ppl that feel cheated... here's a code i devised for ya...no the counter isn't buggy because it uses the joindate :p but here's a little code i whipped up for ppl like you that feel cheated :p regards...

open timeonline.php

find:

$daysregs = floor((time() - $lead[2]) / 86400);

replace with:

// Time Online Hack Addon (fair time per day?) g-force2k2
$fairtime = 1030505285;
if($joindate < $fairtime) {
$daysregs = floor((time() - $fairtime) /86400);
} else {
$daysregs = floor((time() - $lead[2]) / 86400);
}
// Time Online Hack Addon (fair time per day?) g-force2k2

should really change those values up for ya now ;) regards...

g-force2k2

This didn't change anything unfortunately.

groovesalad
09-29-2002, 05:10 PM
Anyone know how to make it so regular users can't see how long the Admins have been online?

410
09-30-2002, 12:06 AM
Any possible way to like reset the time after each month? So I can create like a "Loser of the month" award or something :) ... and maybe add some sort of log of each month...

Thanks!

\ \ - Speedy - / /
10-14-2002, 01:30 PM
ok I have that Profile Change Thingy installed that changes it . .. then when I did what it said in for getinfo template it showed up like this . .

Can someone post a fix for this? Thankx

\ \ - Speedy - / /

NTLDR
10-14-2002, 06:47 PM
You need to make sure that the bgcolor is set correctly for the <td> tags in the getinfo_timeone (I think?) template. They should be either { firstaltcolor } or { secondaltcolor } without the spaces.

maverick1969
10-18-2002, 04:48 AM
Merci pour ce hack car je vien de le mettre et il est geniel

Sc0rp
10-18-2002, 10:13 AM
nice hack..:D installed it and working.. one prob when I click time online though :(

Fatal error: Call to undefined function: dotimeonline() in c:\www\apache\htdocs\zforce\timeonline.php on line 39

whats wrong there?

and is there any way I can show the total time online of the user?

thanx mate :)

N9ne
10-18-2002, 06:51 PM
g-force, a tiny request: maybe you could optimize TECK's code on page 15? It reduces queries :) [I dont know about the params and variables so I can't use it...]

BlueVoltage
10-19-2002, 12:16 AM
Yes, Please update TECK's code! :(

Bison
10-19-2002, 03:05 PM
Originally posted by groovesalad
Anyone know how to make it so regular users can't see how long the Admins have been online?

This will remove the Admin Time Online everywhere BUT the threads.... you' still be able to record the admin's time but it won't show in the "View Leaders" and "User Profile" ...

Open your timeonline.php and search for:

WHERE userid !=0 AND timeonline > 0

Change it to:

WHERE userid > 1 AND timeonline > 0

open up member.php ans search for:

$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[timeonline] > 0) {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
} else {
$getinfo_template = "";
}

Replace it with:

if ($userinfo[userid] != 1){
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[timeonline] > 0) {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
} else {
$getinfo_template = "";
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
}

Bison
10-19-2002, 05:42 PM
g-force2k2 ...

I would be nice if you modified your code in the zip file to include Teck's additional fixes. I just applied one (To settings.php) and it automatically removed one query from all of my pages.

You've served us well in the past, and personally have done a lot for me behind the scenes.

Everyone (Including the non-coders) here would appreciate it!

Regards,
Rolodex! :)

xevito
10-20-2002, 06:52 AM
Originally posted by Rolodex


This will remove the Admin Time Online everywhere BUT the threads.... you' still be able to record the admin's time but it won't show in the "View Leaders" and "User Profile" ...

Open your timeonline.php and search for:

WHERE userid !=0 AND timeonline > 0

Change it to:

WHERE userid > 1 AND timeonline > 0

open up member.php ans search for:

$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[timeonline] > 0) {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
} else {
$getinfo_template = "";
}

Replace it with:

if ($userinfo[userid] != 1){
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[timeonline] > 0) {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
} else {
$getinfo_template = "";
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
}



What other mods have you installed as my file doesnt contain the same as yours..

groovesalad
10-20-2002, 12:21 PM
Originally posted by Rolodex


This will remove the Admin Time Online everywhere BUT the threads.... you' still be able to record the admin's time but it won't show in the "View Leaders" and "User Profile" ...

Open your timeonline.php and search for:

WHERE userid !=0 AND timeonline > 0

Change it to:

WHERE userid > 1 AND timeonline > 0

open up member.php ans search for:

$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[timeonline] > 0) {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
} else {
$getinfo_template = "";
}

Replace it with:

if ($userinfo[userid] != 1){
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
if($userinfo[timeonline] > 0) {
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
} else {
$getinfo_template = "";
}
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
}

Yeah, I don't seem to have that either. Here's what I have:


if($action == "view_leader") {
$perpage = $usersperpage;
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user");
$totalpages = ceil($totalusers[0] / $perpage);
if($page == "") {
$page = 1;
}
$startat = ($page-1)*$perpage;
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
WHERE userid!=0
ORDER by timeonline DESC LIMIT $startat,$perpage");
while($lead = $DB_site->fetch_array($leadtime)) {
$userid = $lead[0]; $username = $lead[1]; $joindate = vbdate($dateformat,$lead[2]); $timeonline = dotimeonline($lead[3]);
$daysregs = floor((time() - $lead[2]) / 86400);
if($daysregs == 0) { // checking to see if not registered for more then a day to prevent division by zero
$daysreg = 1;
} else {
$daysreg = $daysregs;
}
$dotimeperday = floor($lead[3] / $daysreg);
$timeperday = dotimeonline($dotimeperday);
eval("\$time_leader.= \"".gettemplate("time_leader")."\";");
}
if($page!=1) {
$prv = $page - 1;
$firstpage = "<a href='timeonline.php?s=$session[sessionhash]&action=view_leader&perpage=$perpage&page=1'\">[ First Page ]</a>";
$prevpage = "<a href='timeonline.php?s=$session[sessionhash]&action=view_leader&perpage=$perpage&page=$prv'\">[ Previous Page ]</a>";
}
if ($page!=$totalpages) {
$nxt = $page+1;
$nextpage = "<a href='timeonline.php?s=$session[sessionhash]&action=view_leader&perpage=$perpage&page=$nxt'\">[ Next Page ]</a>";
$lastpage = "<a href='timeonline.php?s=$session[sessionhash]&action=view_leader&perpage=$perpage&page=$totalpages'\">[ Last Page ]</a>";
}
eval("dooutput(\"".gettemplate("time")."\");");
}


and


// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++


So, maybe you've got other hacks you're working around?

Bison
10-20-2002, 08:21 PM
Can't you see the similarities?

Change this "WHERE userid!=0"

to:

WHERE userid > 1

We all don't have the same hacks on our boards so that may answer your question. Like I did, you have to learn to improvise from others code to get yours to work the way you want.

Peace!

Bison
10-20-2002, 08:24 PM
Place the condition around the code you showed me ....

if ($userinfo[userid] != 1){

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
eval("\$getinfo_timeonline = \"".gettemplate('getinfo_timeonline')."\";");
// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
}

N9ne
10-21-2002, 04:58 PM
Bump for optimized version :(

N9ne
10-21-2002, 06:16 PM
A Question: TECK, maybe you can answer this, how many queries does this hack add, and on what pages, w/o your modification?

Also, someone please modify TECK's code so it works, pwease :D

N9ne
10-22-2002, 03:00 PM
...bump...

Bison
10-24-2002, 12:13 AM
For some unknow reason, my time counter isn't working ... would changing the permissions to who's time to show stop this hack from working?

All I did was prevented the admin and zero posters from showing up in the time leaders list, getinfo and the threads?
:(

snack
10-24-2002, 05:45 PM
Yea i need help i keep getting that divsion zero error on the leader page? which file do i need to edit to fix it?

girlzclan
10-28-2002, 01:00 AM
my is stuck at zero in the threads and 0 on the timeonline page. I had it working on a previous forum but now it's broke :/

lmao helps if i fully install the hack
<-- retard

Bison
10-28-2002, 11:07 AM
I figured out why the times stopped working ... I included a condition into the sesions.php file and it stopped recording time for everyone instead of the admin. I removed the condition and now everyone's time is being recorded again!

Merjawy
10-29-2002, 07:46 AM
nice hack I installed it with the zero problem but thanx I fixed it too and working on 226 now

but what about guests? I love to have something works with whos online

I have a guest that seems to be stuck on my forum of 3 days now.. same IP never left.. jumpts from post to another, attempts to post, quote, edit post, mod. tools, add member to buddy, add member to ignore etc etc.. and hes been at it for 3 days non stop

even shut down the server and back up and hes was back the minute it returned

I am not sure whats going on.. my forum is kinda interesting.. but not that much to have someone on it 3 days and he is still there now.. I had watched him for many hours and had others watch him.. never seen him leave

can't be a bot as he was attempting to do things
his IP traced to Japan but that could verywell be proxy

I just wanted to make a record of his time online :)
and yes it worries me and wonder what the heck is he up to

first thought he could be a bored kid.. but 3 days and still going? hmmmmmm

Mystic XL
11-12-2002, 08:09 AM
Sorry but I can't read through all those pages heh, but I keep getting this error on the view leader page

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

Warning: Division by zero in /home/sjmadho/public_html/board/timeonline.php on line 42

you can view it at http://www.sjmadhouse.net/board/timeonline.php?s=&getinfo=view_leader

Erwin
11-12-2002, 08:16 AM
Originally posted by Merjawy
I have a guest that seems to be stuck on my forum of 3 days now.. same IP never left.. jumpts from post to another, attempts to post, quote, edit post, mod. tools, add member to buddy, add member to ignore etc etc.. and hes been at it for 3 days non stop


That's a search engine spidering bot, probably from Google. Google is actively spidering at the moment.

Erwin
11-12-2002, 08:18 AM
Originally posted by Mystic XL
Sorry but I can't read through all those pages heh...

Use the "Search This Thread" box on the bottom right hand corner.

g-force2k2
11-19-2002, 04:09 PM
Mystic XL change is included in the zip... for fixing the division by zero error...

regards...

g-force2k2

matthepepe
11-21-2002, 04:30 AM
im trying to find out what code i ahve to add where to get the online time to show in the postbit.