Webmaster Forums 101 - Free Help and Discussions
 
 
 

MEMBER REWARDS - Earn free advertising by participating in these forums! Click here for details.

Welcome to Webmaster Forums 101!

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th July 2003, 02:50 PM   #1
viper's Avatar

Username: viper
Rank: WF101 Fanatic
Join Date: Apr 2003
Location: Canada
Posts: 172
Points: 28.21
Default phpbb integration

hi mr.tech i need some help i want to use the login and private messages and who's online stuff from phpbb 2.0.4 on my main site so i want to intergate them together. But the way they tell to do it on phpbb.com doesn't work with my template system i am using for my main site.


It won't let me include both common.php from the forums and my template.php class file for my template system but i have to use my template.php class or my templates won't work and i have to have common.php from the forums or the sessions won't call from the forums.


I was wondering how to do this without using the common.php file from the forums.



any help would be appreciated


Thanks.
__________________
viper is offline   Reply With Quote
Old 21st July 2003, 10:17 AM   #2
Mr. Tech's Avatar

Username: Mr. Tech
Rank: Problem Solver
Join Date: Dec 2004
Location: Gold Coast, Australia
Posts: 2,166
Points: 1,025.61
Send a message via MSN to Mr. Tech
Default Re: phpbb integration

This is how I do it:

Page that shows whos online

Code:
<?php define('IN_PHPBB', true); // Path to forum $phpbb_root_path = 'forum/'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.php'); include($phpbb_root_path . 'config.php'); $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); init_userprefs($userdata); // Page which gets the data include("online.php"); echo "$onlinet"; ?>

online.php

Code:
<?php $user_forum_sql = ( !empty($forum_id) ) ? "AND ( u.user_session_page = $forum_id OR s.session_page = $forum_id)" : ""; $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s WHERE u.user_id = s.session_user_id AND ( s.session_time >= ".( time() - 300 ) . " OR u.user_session_time >= " . ( time() - 300 ) . " ) $user_forum_sql ORDER BY u.username ASC"; $result = $db->sql_query($sql); if(!$result) { message_die(GENERAL_ERROR, "Couldn't obtain user/online information.", "", __LINE__, __FILE__, $sql); } $userlist_ary = array(); $userlist_visible = array(); $logged_visible_online = 0; $logged_hidden_online = 0; $guests_online = 0; $online_userlist = ""; $prev_user_id = 0; $prev_session_ip = 0; while( $row = $db->sql_fetchrow($result) ) { // User is logged in and therefor not a guest if( $row['session_logged_in'] ) { // Skip multiple sessions for one user if( $row['user_id'] != $prev_user_id ) { $style_color = ""; if( $row['user_level'] == ADMIN ) { $row['username'] = '<b>' . $row['username'] . '</b>'; $style_color = 'style="color:#' . $theme['fontcolor3'] . '"'; } else if( $row['user_level'] == MOD ) { $row['username'] = '<b>' . $row['username'] . '</b>'; $style_color = 'style="color:#' . $theme['fontcolor2'] . '"'; } if( $row['user_allow_viewonline'] ) { $user_online_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>'; $logged_visible_online++; } else { $user_online_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>'; $logged_hidden_online++; } if( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN ) { $online_userlist .= ( $online_userlist != "" ) ? ", " . $user_online_link : $user_online_link; } } } else { if( $row['session_ip'] != $prev_session_ip ){ $guests_online++; } } $prev_user_id = $row['user_id']; $prev_session_ip = $row['session_ip']; } if( empty($online_userlist) ) { $online_userlist = $lang['None']; } $online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . " " . $online_userlist; $total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online; if($total_online_users > $board_config['record_online_users']) { $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '$total_online_users' WHERE config_name = 'record_online_users'"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't update online user record (nr of users)", "", __LINE__, __FILE__, $sql); } $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . time() . "' WHERE config_name = 'record_online_date'"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't update online user record (date)", "", __LINE__, __FILE__, $sql); } $board_config['record_online_users'] = $total_online_users; $board_config['record_online_date'] = time(); } if( $total_online_users == 0 ) { $l_t_user_s = $lang['Online_users_zero_total']; } else if( $total_online_users == 1 ) { $l_t_user_s = $lang['Online_user_total']; } else { $l_t_user_s = $lang['Online_users_total']; } if( $logged_visible_online == 0 ) { $l_r_user_s = $lang['Reg_users_zero_total']; } else if( $logged_visible_online == 1 ) { $l_r_user_s = $lang['Reg_user_total']; } else { $l_r_user_s = $lang['Reg_users_total']; } if( $logged_hidden_online == 0 ) { $l_h_user_s = $lang['Hidden_users_zero_total']; } else if( $logged_hidden_online == 1 ) { $l_h_user_s = $lang['Hidden_user_total']; } else { $l_h_user_s = $lang['Hidden_users_total']; } if( $guests_online == 0 ) { $l_g_user_s = $lang['Guest_users_zero_total']; } else if( $guests_online == 1 ) { $l_g_user_s = $lang['Guest_user_total']; } else { $l_g_user_s = $lang['Guest_users_total']; } $l_online_users = sprintf($l_t_user_s, $total_online_users); $l_online_users .= sprintf($l_r_user_s, $logged_visible_online); $l_online_users .= sprintf($l_h_user_s, $logged_hidden_online); $l_online_users .= sprintf($l_g_user_s, $guests_online); $onlinet="<hr size=\"1\"><br>$l_online_users<br><br>$online_userlist<br>"; ?>

And that should do it. You'll have to find a MOD which will aloow you to show PM's but what I have shown you will show whos online.

Hope that helps!
__________________
Please read the Forum Rules

Get rewarded for posting
- free advertising!

.::. [ Webmaster Resources ] .::. [ Web Design ] .::. [ Developer Tutorials ] .::.
Mr. Tech is offline   Reply With Quote
Old 21st July 2003, 10:23 AM   #3
viper's Avatar

Username: viper
Rank: WF101 Fanatic
Join Date: Apr 2003
Location: Canada
Posts: 172
Points: 28.21
Default

well that should help with the whosonline part but how about the login part.


what i want is to be able to use phpbb's login stuff on my main site so it log's them in to my site and the forums.



and the pm thing i'm sure i can figure that out on my own trying to get support on phpbb.com isn't that easy lol.



Thanks for the help Mr.Tech.
__________________
viper is offline   Reply With Quote
Old 21st July 2003, 10:35 AM   #4
Mr. Tech's Avatar

Username: Mr. Tech
Rank: Problem Solver
Join Date: Dec 2004
Location: Gold Coast, Australia
Posts: 2,166
Points: 1,025.61
Send a message via MSN to Mr. Tech
Default

Just use this code:

Code:
<form action="forum/login.php" method="post"> <input type="hidden" name="autologin"> <input type="hidden" name="redirect" value=""> <b>Username:</b><br> <input type="text" name="username" size="15" maxlength="40" value=""><br> <b>Password:</b><br> <input type="password" name="password" size="15" maxlength="25"><br> <input type="submit" name="login" value="Log in"> </form>
__________________
Please read the Forum Rules

Get rewarded for posting
- free advertising!

.::. [ Webmaster Resources ] .::. [ Web Design ] .::. [ Developer Tutorials ] .::.
Mr. Tech is offline   Reply With Quote
Old 29th July 2003, 12:29 PM   #5

Username: PY 222
Rank: WF101 Fanatic
Join Date: Jan 2003
Location: California
Posts: 189
Points: 0.00
Default

Code:
<?php define('IN_PHPBB', true); // Path to forum $phpbb_root_path = 'forum/'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.php'); include($phpbb_root_path . 'config.php'); $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); init_userprefs($userdata); // Page which gets the data include("online.php"); echo "$onlinet"; ?>

Mr. Tech. I was just wondering what does echo "$onlinet" does and where does it come from?

I don't get it?
__________________
When the Bitterness is gone, Sweetness will follow.
PY 222 is offline   Reply With Quote
Old 29th July 2003, 01:05 PM   #6
Mr. Tech's Avatar

Username: Mr. Tech
Rank: Problem Solver
Join Date: Dec 2004
Location: Gold Coast, Australia
Posts: 2,166
Points: 1,025.61
Send a message via MSN to Mr. Tech
Default

Quote:
Originally Posted by online.php
$onlinet="<hr size=\"1\"><br>$l_online_users<br><br>$on line_userlist<br>";

online.php :cheesygr:
__________________
Please read the Forum Rules

Get rewarded for posting
- free advertising!

.::. [ Webmaster Resources ] .::. [ Web Design ] .::. [ Developer Tutorials ] .::.
Mr. Tech is offline   Reply With Quote
Old 29th July 2003, 04:44 PM   #7

Username: PY 222
Rank: WF101 Fanatic
Join Date: Jan 2003
Location: California
Posts: 189
Points: 0.00
Default

Kewl! Thanks.

Looks I learn something new again today. Great work Mr. Tech for informing me.
__________________
When the Bitterness is gone, Sweetness will follow.
PY 222 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone host me a phpBB for free DarkGotenks Web Hosting & Domain Discussion 2 15th June 2005 12:24 AM
phpBB 2.0.5 Mr. Tech Software & Hardware Help 9 30th July 2003 05:09 PM
phpBB 2.0.4 out 16th January 2003 Mr. Tech Software & Hardware Help 1 17th January 2003 08:35 AM
Useful phpBB links Mr. Tech Software & Hardware Help 2 11th January 2003 09:47 AM
phpBB help Mr. Tech Software & Hardware Help 0 9th January 2003 10:04 AM

Login
User Name
Password


Featured Members


Featured Links


Useful Resources
Webmaster Resources
Developers Tools
Developer Tutorials


Partners

All times are GMT +10. The time now is 10:07 PM.


Powered by vBulletin Version 3.5.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.3.2
 
 
WEBMASTER FORUMS 101
ARCHIVE
CONTACT US
TOP
   
© Webmaster Forums 101 2005. All Rights Reserved.
Design by: vBCore