vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Total Time Online Hack v1.0 (https://vborg.vbsupport.ru/showthread.php?t=42864)

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:

PHP Code:

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

under it add:

PHP Code:

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

then open privmsg template

place where you want:

PHP Code:

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

Quote:

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:

PHP Code:

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

replace it with:

PHP Code:

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


open member.php

find:

PHP Code:

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

replace it with:

PHP Code:

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

finally

open timeonline.php

find:

PHP Code:

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

replace with:

PHP Code:

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:

PHP Code:

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

replace with:

PHP Code:

      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?

Code:

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:

Code:

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:

PHP Code:

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

replace it with:

PHP Code:

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


open member.php

find:

PHP Code:

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

replace it with:

PHP Code:

  if($userinfo[usergroupid] == 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?

Code:

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

PHP Code:

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

to this:

PHP Code:

// +++++++ Start Time Online Hack [ g-force2k2 ] +++++++
  
$userinfo[onlinetime] = dotimeonline($userinfo[timeonline]);
    if(
$userinfo[usergroupid] == 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:

PHP Code:

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

replace it with:

PHP Code:

  $post[onlinetime] = dotimeonline($userinfo[timeonline]);
    if(
$post[usergroupid] == 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:

Code:

$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?

Code:

$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.

Quote:

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. :)

Quote:

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

regards...

g-force2k2


Kmaster 09-03-2002 01:21 PM

Quote:

Originally posted by g-force2k2
Kmaster for the postbit try this ::

open admin/functions.php

find:

PHP Code:

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

replace it with:

PHP Code:

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


open member.php

find:

PHP Code:

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

replace it with:

PHP Code:

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

finally

open timeonline.php

find:

PHP Code:

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

replace with:

PHP Code:

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:

PHP Code:

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

replace with:

PHP Code:

      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

Quote:

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

Quote:

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

PHP Code:

// +++++++ 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


PHP Code:

// +++++++ 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

PHP Code:

$post[avatar]<p


and replace it with


PHP Code:

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

$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.


All times are GMT. The time now is 07:11 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.01947 seconds
  • Memory Usage 1,947KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (31)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete