i search for this and not found any new thing in vbulletin comunity forum and modifications
so i write codes manually
for examplt your non-vb page name is : home.php
first we need create a connection to vbulletin forum database
i use a function in other php page and then include this page in home.php
example code in connection.php:
function forumconnection(){
mysql_connect("localhost", "forumdbusername", "pass") or die(mysql_error());
mysql_select_db("forumdbname");
}
in home.php
dont forget:
require_once('connection.php');
so i have a function to connect database and can use this connection everywhere i need
in home.php
and anywhere i want to show vbulletin stat
<?php
forumconnection();
$forum_url = "http://you-forum-adress.com/";
$online_users_sql = mysql_query("SELECT distinct userid FROM session WHERE userid <> 0");
$online_users_count = mysql_num_rows($online_users_sql);
$online_quest_sql = mysql_query("SELECT userid FROM session WHERE userid='0'");
$online_quest_count = mysql_num_rows($online_quest_sql);
$all_users_count = mysql_num_rows(mysql_query("SELECT userid FROM user"));
$all_thread_count = mysql_num_rows(mysql_query("SELECT threadid FROM thread"));
$all_posts_count = mysql_num_rows(mysql_query("SELECT postid FROM post"));
function Username1($username) {
global $forum_url;
list($pid,$usergroupid,$usernam) = mysql_fetch_array(mysql_query("SELECT userid,usergroupid,username FROM `user` WHERE userid = '$username' limit 1"));
list($opentag, $closetag) = mysql_fetch_array(mysql_query("SELECT opentag,closetag FROM usergroup WHERE usergroupid = $usergroupid limit 1"));
$username = $opentag.$usernam.$closetag;
return "<a target=\"_blank\" href=\"".$forum_url."member.php?userid=$pid\">$username</a>";
}
?>
online users: <?php echo $online_users_count;?>and online quests: <?php echo $online_quest_count; ?>
<?php
while($onlineusers_get=mysql_fetch_array($online_users_sql))
{
$onlineuser = Username1($onlineusers_get['userid']);
?>
<?php echo $onlineuser; ?>
<?php
}?>
<br />
all members : <?php echo $all_users_count; ?><br />
all thread : <?php echo $all_thread_count; ?><br />
all posts : <?php echo $all_posts_count; ?><br />
<?php
mysql_close();
?>
change forum url in line 2
and you can customize style and add html codes
enjoy it.
هیچ نظری موجود نیست:
ارسال یک نظر