vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Amount of users from HTML (https://vborg.vbsupport.ru/showthread.php?t=163558)

OnyxChase 11-25-2007 04:37 AM

Amount of users from HTML
 
Is there any way to list the number of registered users from a HTML file? Perhaps I could integrate a IFRAME which calls a custom PHP file.

The reason is because I'd like to list the amount of registered members on my website homepage.

Any help would be greatly appreciated. Thanks!

Analogpoint 11-26-2007 02:08 PM

One option would be on your homepage, pull the number straight from your database. If you don't want to run php on your homepage, do the iframe that calls a php file. The code could be:

Code:

mysql_connect('host', 'user', 'pass');
mysql_select_db('yourvbdatabase');

$r = mysql_query('select count(*) from vb_user'); // use the name of your user table
$r = mysql_fetch_array($r);
$registeredusercount = $r[0];

echo 'We have ' . $registeredusercount . ' users.';

This code doesn't take into account moderated/unverified users.

OnyxChase 11-26-2007 02:15 PM

Wow thanks I will try it and will report back!!! Thanks so much.

--------------- Added [DATE]1196109185[/DATE] at [TIME]1196109185[/TIME] ---------------

Woops!!!! I had a typo in the vb_user database name. Works perfectly!!! Thanks!!!! :)

OnyxChase 11-28-2007 02:11 AM

Hi Analogpoint,

I was wondering if it was possible to call up the amount of online users (members and guests) from the database as well? I could not find one table which contained who is online, perhaps it is not stored in mysql?

Thanks for any help! :)

--------------- Added [DATE]1196223706[/DATE] at [TIME]1196223706[/TIME] ---------------

I tried using the _session table but it is giving me a number greater than the one shown on the forum. I'd like it to show the amount of users online in the last hour.

Code:

$r2 = mysql_query('select count(*) from vbulletin_session');
$r2 = mysql_fetch_array($r2);
$onlineusercount = $r2[0];



All times are GMT. The time now is 12:16 AM.

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.00957 seconds
  • Memory Usage 1,712KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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