PDA

View Full Version : User(+Forum?)Stats on a NON-VB Page!


Jack28
07-15-2004, 12:51 AM
UserStats on a NON-VB Page!
and if possible ForumStats like:

Currently Active Users: 145 (47 members and 98 guests)
Threads: 37,933
Posts: 359,546
Members: 51,820
Newest member: YBnormal

can anyone make this mini-mod plz!

thnx,
JaCky

Jack28
07-17-2004, 01:14 AM
bump

Andreas
07-17-2004, 01:51 AM
select * from datastore where title='userstats'


Unserialize this and you will have an array with entries numbermembers, newusername and newuserid.


select * from datastore where title='forumcache'


Unserialize this which will give you an multi-dimensional associative array with all forum information. Loop through this array and accumulate threadcount and replycount.

'Who is online' is a bit more complicated. Take a look at index.php after

// ### LOGGED IN USERS #################################################

to see how vBulletin does it.

Jack28
07-17-2004, 01:42 PM
so? how will it be when i make just one single forumstats.php page?

do i need to use includes n stuff?

mchaos
02-07-2006, 03:26 AM
I too am trying to put who is online on a non vb page, Have tryed many things, with little progress, how bout a hand...

virtualraceday
02-09-2006, 01:34 PM
try this... it works for vb 3.5.x

<?php
// Connecting to your database
mysql_connect(DB_HOST, DB_USER, DB_PASS)
OR die ("Cannot connect to your database");
mysql_select_db('dogforum') OR die("Cannot connect to your database");

$guests = mysql_query("SELECT COUNT(*) FROM session WHERE userid=0");
$row = mysql_fetch_row($guests);
$numberguest=$row[0];

$users = mysql_query("SELECT COUNT(*) FROM session WHERE userid<>0");
$row = mysql_fetch_row($users);
$numberusers=$row[0];

$total_online = $numberguest + $numberusers;

$query = mysql_query("select * from datastore");
$data = array();
while ($row = mysql_fetch_row($query)) {
$data[$row[0]] = $row[1];
}

$maxonline = unserialize($data['maxloggedin']);
$userstats = unserialize($data['userstats']);
?>


Visitors Online: <strong><?=$total_online;?></strong><br>
Members: <strong><?=$numberusers;?></strong> <br>
Guests: <strong><?=$numberguest;?></strong><br>
Registered users:<strong><?=$userstats['numbermembers'];?></strong><br><br>
Most users online: <b><?=$maxonline['maxonline'];?></b><br>
on <?=date("M jS, Y G:i:s", $maxonline['maxonlinedate']);?>.<br>
Newest member, <b><?=$userstats['newusername'];?></b>

work fine for me... check it out http://www.thedogsite.com/ (top left box)