Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools
Total Time Online Hack v1.0 Details »»
Total Time Online Hack v1.0
Version: 1.00, by g-force2k2 g-force2k2 is offline
Developer Last Online: May 2008 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 08-27-2002 Last Update: Never Installs: 99
 
No support by the author.

[ Click Here ] to download the latest update!

Nifty Addon by TECK:

[View TECK's Modification]

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

What does this hack do? Just as the title states 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 ]

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

find:

PHP Code:
$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:

PHP Code:
$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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #47  
Old 08-29-2002, 03:29 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #48  
Old 08-29-2002, 03:36 AM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nah actually Boofo that was my bad... in the member.php replace the code i just gave you with this code:

PHP 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:

PHP Code:
// get total posts 
above that add:

PHP Code:
// +++++++ 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 :

PHP Code:
$ftopuseronline 
regards

g-force2k2
Reply With Quote
  #49  
Old 08-29-2002, 03:43 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Firefly's Code:

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:

Code:
// 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
Reply With Quote
  #50  
Old 08-29-2002, 03:52 AM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #51  
Old 08-29-2002, 04:15 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #52  
Old 08-29-2002, 04:18 AM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Boofo try using this query then? ::

PHP Code:
  $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
Reply With Quote
  #53  
Old 08-29-2002, 04:27 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.

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

PHP Code:
  $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
Reply With Quote
  #54  
Old 08-29-2002, 04:35 AM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Boofo

open timeonline.php

find:

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

PHP Code:
    $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
Reply With Quote
  #55  
Old 08-29-2002, 05:01 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're good! that fixed it.

What should this be at now?

PHP Code:
$totalusers $DB_site->query_first("
    SELECT COUNT(*) AS users
    FROM user
    WHERE timeonline > 0"
); 
leave it like it is?
Reply With Quote
  #56  
Old 08-29-2002, 06:05 AM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you can keep that as is as well regards... glad that it worked

g-force2k2
Reply With Quote
  #57  
Old 08-29-2002, 06:11 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks again for all of the help. Great hack!
Reply With Quote
  #58  
Old 08-29-2002, 10:34 AM
andrew67 andrew67 is offline
 
Join Date: Dec 2001
Posts: 157
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Best hack out for a long time! GREAT WORK!!!
Reply With Quote
  #59  
Old 08-29-2002, 01:12 PM
scottct1 scottct1 is offline
 
Join Date: Mar 2002
Location: Connecticut
Posts: 391
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #60  
Old 08-29-2002, 02:38 PM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

scottct1 yeah it should... but i don't see that as a problem...

g-force2k2
Reply With Quote
  #61  
Old 08-29-2002, 03:12 PM
Okiewan's Avatar
Okiewan Okiewan is offline
 
Join Date: Dec 2001
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:47 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04946 seconds
  • Memory Usage 2,401KB
  • Queries Executed 30 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (11)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (16)post_thanks_box
  • (16)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (16)post_thanks_postbit_info
  • (15)postbit
  • (16)postbit_onlinestatus
  • (16)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete