Webmaster Forum  

Go Back   Webmaster Forum > Website Design Forum > Website Design Forum
User Name
Password
Register FAQ Members List Calendar Transactions Store Search Today's Posts Mark Forums Read


[PHPBB] Displaying user statistics on Non-phpBB Page

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-18-2005, 19:28
admans
Senior Member


Join Date: Jul 2005
Posts: 248
Trader Rating: (0)
Points: 22 (Donate)
5 F$/Referral Refer Friends
admans is on a distinguished road
Default [PHPBB] Displaying user statistics on Non-phpBB Page

Step 1: Creating the userstats
The first step is to create a php file. Call the file userstats.php. Paste the following into the file. Make the neccesary changed
PHP Code:
<?
 
#database info, or include a config.php file
 
$db_host 'localhost'
 
$db_user 'username'#change to your databaseuser name
 
$db_password 'password'#change to your database password
 
$db_name 'database_name'#change to your db name #connect to the database, or end all scripts and give the reason for ending
 
 
mysql_connect($db_host,$db_user,$db_password) or die(mysql_error()); 
 
mysql_select_db($db_name) or die(mysql_error());
 
 
#select the number of users online
 
$result mysql_query("SELECT count(s.session_logged_in)
 FROM phpbb_sessions s
 WHERE s.session_logged_in = 1"
);
 
 
#display amount of users online
 
echo "<table><tr><td>";
 
#this is a while loop that will loop through the array of returned
 #results and display them, it is used throughout this script
 
while($r=mysql_fetch_array($result)){ 
     echo 
"Total users online: ".$r['count(s.session_logged_in)']."<br>";
 }
 
 
#select the newest member 
 
$result mysql_query("SELECT u.user_id, u.username
 FROM phpbb_users u
 ORDER BY u.user_id DESC
 LIMIT 1"
);
 
 
#display newest user, change the <a> tag to your forum directory
 
while($r=mysql_fetch_array($result)){ 
     echo 
"Newest registerd user: <a href=\"www.domain.com/forum/profile.php?mode=viewprofile&u=".$r['user_id']."\">".$r['username']."</a><p>";
 }
 
 
#select total topics 
 
$result mysql_query("SELECT count(t.topic_id)
 FROM phpbb_topics t"
);
 
 
#display total topics
 
while($r=mysql_fetch_array($result)){ 
     echo 
"Total topics: ".$r['count(t.topic_id)']."<br>";
 }
 
 
#select total amount of posts
 
$result mysql_query("SELECT count(p.post_id)
 FROM phpbb_posts p"
);
 
 
#display total posts
 
while($r=mysql_fetch_array($result)){ 
     echo 
"Total Posts: ".$r['count(p.post_id)']."";
 }
 echo 
"</td></tr></table>";
 
?>


Step 2: Including the user stats
The next step is to include the stats into another file. First, you must make sure that the extension of the file you are going to include the user stats in is .PHP. If the extension is something else, change it to .PHP now. In order to include the stats, paste the following code to where you want the stats to be displayed
PHP Code:
<? include('userstats.php'); ?>
__________________

http://img76.imageshack.us/img76/6450/sc2but4ng.gif | http://img495.imageshack.us/img495/...ogorwtan0je.gif | <a href="http://webtools.sc2.info"><img src="http://img129.imageshack.us/img129/8682/sc2webtan7ju.gif" border="1" width="100" alt="Free Webtools for all" /></a> | <a href="http://www.indexrated.com"><img src="http://img398.imageshack.us/img398/4813/listed1pb.gif" border="1" width="100" alt="Index Rated Directory - Rating Quality Sites" /></a>

Get all Games,Apps and Wallpapers Nokia, Samsung and Sony Erricson!!

admans is offline
Reply With Quote
  #2  
Old 07-19-2005, 08:01
xyris
Senior Member


Join Date: Jul 2005
Posts: 104
Trader Rating: (0)
Points: 0 (Donate)
5 F$/Referral Refer Friends
xyris is on a distinguished road
Default Re: [PHPBB] Displaying user statistics on Non-phpBB Page

Is there some tooltip for vb to do this?
xyris is offline
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Resources : | Advertise at FHF | itextLink.com| Reseller Hosting| TextDot| iNamePros| Any Webmaster| Web Host| Dep3| cheap low cost web hosting reviews|


All times are GMT -4. The time now is 23:38.


Powered by: vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.