View Full Version : Amount of users from HTML
OnyxChase
11-25-2007, 04:37 AM
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:
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 1196109185 at 1196109185 ---------------
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 1196223706 at 1196223706 ---------------
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.
$r2 = mysql_query('select count(*) from vbulletin_session');
$r2 = mysql_fetch_array($r2);
$onlineusercount = $r2[0];
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.