Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > vB1 Hacks

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
  #12  
Old 04-25-2001, 03:46 PM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It sounds like the query is never performing since there is no data in the table to select. Try this...

change:

if ($totalonline > $numberoldhigh) {

to

if ( ($totalonline > $numberoldhigh) or ($numberoldhigh < 1) ) {

Check your highsessions table and see if any data is being entered.
Reply With Quote
  #13  
Old 05-03-2001, 04:33 PM
Spider Spider is offline
 
Join Date: Nov 2001
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great! I finally got it to work.

I changed

if ($totalonline > $numberoldhigh) {

to

if ( ($totalonline > $numberoldhigh) or ($numberoldhigh < 1) ) {

But after that it still didn't work. Then I just went bold, went into the database and setted a
value of 0 in the "high" field. After I did that, it worked like a charm.

Thanks alot for helping me out.

Greetings,
Spider
Reply With Quote
  #14  
Old 05-20-2001, 02:31 AM
theprof
Guest
 
Posts: n/a
Default

Thanks!
Reply With Quote
Reply

Thread Tools

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 06:11 PM.


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.03800 seconds
  • Memory Usage 2,221KB
  • Queries Executed 18 (?)
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)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
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (4)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