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)

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

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

PHP Code:

<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:
[sql]ALTER TABLE user ADD timeactivity int(10) unsigned DEFAULT '0' NOT NULL AFTER posts[/sql]
in /admin/functions.php find:
Code:

$post[joindate]=vbdate($registereddateformat,$post[joindate]);
replace it with:
Code:

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

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

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

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

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

Quote:

Originally posted by g-force2k2
NSeXcellent:

make sure that the link is this:

PHP Code:

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


All times are GMT. The time now is 07:43 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.01304 seconds
  • Memory Usage 1,762KB
  • 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
  • (6)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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