vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Online Users Today (https://vborg.vbsupport.ru/showthread.php?t=198986)

OnyxChase 12-16-2008 05:21 AM

Online Users Today
 
Hello,

I had a code that has worked for ages but for some reason today I noticed it was showing a completely OFF number, '13263'.

Basically I have an OFF-vBulletin script that needs this information. It is called using the following:

PHP Code:

$timenow time();
$datecut $timenow 86400;

mysql_connect('localhost''username''password');
mysql_select_db('database');

$result mysql_query("SELECT COUNT(*) FROM vbulletin_session WHERE lastactivity > $datecut");
$result mysql_fetch_array($result);

$onlineusercount $result[0];

echo 
$onlineusercount ' Users Online Today'

Anybody can figure out what I am doing wrong? It should be something in the 400 or 500 users online today, not 13000!

Lynne 12-16-2008 02:40 PM

Have you looked at your session table to see how many rows are in it? Could something have happened to the cron job that removes sessions? (Although, with the time being a factor in the query, that shouldn't matter.) Try running that query by yourself (in the admin panel or phpMyAdmin) and see what the result is.

Deceptor 12-16-2008 09:04 PM

Try change "SELECT COUNT(*)" to:
Code:

SELECT COUNT(*) AS `total`
Then use:

Code:

$onlineusercount = $result['total'];
Might help, not too certain :)


All times are GMT. The time now is 08:13 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.01037 seconds
  • Memory Usage 1,715KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete