Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > vB1 Hacks
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Overgrow Overgrow is offline
Developer Last Online: Jun 2004 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-12-2001 Last Update: Never Installs: 0
 
No support by the author.

Object: display the highest number of user sessions your board has ever had.

Disclaimer: for snyx.. I don't use 2.0 so I have no idea if anything has changed. This is for 1.x and I have NOT tested this. I wrote it at work and decided to post it since you needed it ASAP. It's something I will use as well, but I can't install and test until later tonight. There is a good chance this will work on 2.0 if it hasn't changed in this area.


1) Create table
Code:
CREATE TABLE highsessions (
high int(10) unsigned DEFAULT '0' NOT NULL,
timestamp int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (high)
);
2) Modify your index.php. Find:
Code:
if ($displayloggedin==1) {
    $datecut=time()-$cookietimeout;
    $loggedins=$DB_site->query_first("SELECT COUNT(sessionid) AS sessions FROM session");
    $totalonline=$loggedins[sessions];
and under it, ADD:
Code:
	// record high sessions hack

	$oldhighsessions=$DB_site->query_first("SELECT high,timestamp FROM highsessions");
	$numberoldhigh=$oldhighsessions[high];
	$timeoldhigh=date("M j, Y G:i",$oldhighsessions[timestamp]);

	if ($totalonline > $numberoldhigh) {
		$DB_site->query("UPDATE highsessions SET high='$totalonline',timestamp='".time()."'");
		$numberoldhigh = $totalonline;
		$timeoldhigh="right now!";
	}

	// end high sessions hack
3) Open your forumhome template and use the variable $numberoldhigh wherever you want to display your "record" number of sessions. Use $timeoldhigh to display the date of that record.

enjoy

Show Your Support

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

Comments
  #2  
Old 03-13-2001, 06:09 PM
Guest
 
Posts: n/a
Default

Anyone test this with 2.0 yet?
Reply With Quote
  #3  
Old 03-13-2001, 06:54 PM
Guest
 
Posts: n/a
Default

Anyone test this with 1.x yet?


heheh
Reply With Quote
  #4  
Old 03-13-2001, 07:21 PM
Guest
 
Posts: n/a
Default

You might wanna include a timestamp to recall the date and time when the record was added
Reply With Quote
  #5  
Old 03-13-2001, 07:31 PM
Guest
 
Posts: n/a
Default

Uh oh.. a little piece of code is turning into an actual hack.

I changed the first post to now use a timestamp.
Reply With Quote
  #6  
Old 03-13-2001, 08:18 PM
Guest
 
Posts: n/a
Default

Well testing this with Beta 3 it doesn't have

if ($displayloggedin==1) {

it has

if ($displayloggedin) {

So I pasted below that and added to my template, but it prints Dec 31, 1969 16:00

Any ideas?
Reply With Quote
  #7  
Old 03-13-2001, 08:48 PM
Guest
 
Posts: n/a
Default

Wow it works! 2.0 even... hehe

OK the problem is that when you created the table, there is no value for "TIMESTAMP"

Soooo either you need to enter a value for timestamp manually, or delete the "high" mark and let it set itself again that way it writes a timestamp into the database.

That is assuming there are no errors in my code (haven't tested the timestamp part, just threw it in).
Reply With Quote
  #8  
Old 03-13-2001, 08:58 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by Overgrow
. . . . . Disclaimer: for snyx.. I don't use 2.0 so I have no idea if anything has changed . . . . .
LOL! Thankz man, just Kier saved me on that one!
Reply With Quote
  #9  
Old 04-08-2001, 04:11 AM
theprof
Guest
 
Posts: n/a
Default

May I please have the code for vB 1.x? It doesnt seem to be working on my board. No values are entered into the highsessions table. Instead, the total number of people are shown as the maximum number.
Reply With Quote
  #10  
Old 04-15-2001, 09:01 PM
Spider Spider is offline
 
Join Date: Nov 2001
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looks like a cool hack to me.
Unfortunatly, I have the same problem as theprof.

The date of record keeps standing on Dec 31, 1969 19:00 and the record of simultanious logged in users is the same as the number of users logged in at the moment.

Could you please tell us what to do so that we can enjoy this cool hack too?

[EDIT: Forgot to tell you that I'm using vbb 1.xx]

Greetings,
Spider
Reply With Quote
Reply


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 08:02 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04045 seconds
  • Memory Usage 2,273KB
  • Queries Executed 23 (?)
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
  • (3)bbcode_code
  • (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
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (2)postbit_onlinestatus
  • (10)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