Wednesday, May 28, 2008

Integrate PHPBB login to your website

PHPBB is one of most widely used forum board system. Build on strength platform of PHP, PHPBB free yet stable and easy to configure. We can aware if a system using PHPBB as its forum board system, by its unique layout and themes.

For some website that doesn't have own member management system can use PHPBB for their user / login based system. PHPBB provide a solid member management system, sign up interface, also nice member profile interface.

For sign up, easiest way is using existing PHPBB signup form. More customization is required to match your website theme. Simply edit profile_add_body.tpl template under your phpbb/template/templatename/ folder. It's all in html + smarty code.

Next is to link a login form (on your main website) to phpbb login verification system. You need to create a form contain 3 main object : user name, password, and Login button


<form name="frmPhpBBLogin" action="your_phpbb_login.php" method="post">

User name : <input name="username" type="text">

Password : <input name="'password'" type="password">

<input value="'Login'" type="'submit'">

</form>




To get login info which stored in PHPBB session, simply get it from COOKIE data by
PHP Code snippet
-----------
$session_data = isset($_COOKIE['phpbb2_data'])?unserialize(stripslashes($_COOKIE['phpbb2_data'])) : array();
if (isset($session_data['userid'])) GetPHPBBMemberDetail($session_data['userid'])
function GetPHPBBMemberDetail($id) {
$myQR = "SELECT * FROM `phpbbdb`.`phpbbprefix_users` WHERE `user_id`='$id'";
$myRE = mysql_query($myQR);
return mysql_fetch_assoc($myRE);
}

------------
Note :
- Actual cookie variable name may vary, you can do a var_dump($_COOKIE) to find out.
- Change `phpbbdb` to your actual PHPBB database name
- Chnage `phpbbprefix_` to actual PHPBB table naming prefix
You must have mysql access to get all the data.

To log out simply hit PHPBB's logout url, normally at login.php?logout=true

6 comments:

kahosadi said...

How to integrate existing user management to phpBB?

says said...

since it dont have any API (or it have?), you must access directly to the database table. My query to get someone's data is

SELECT * FROM `$forum_db`.`phpbb_users` AS u LEFT JOIN `$forum_db`.`phpbb_user_group` as ug ON u.`user_id`=ug.`user_id` WHERE u.user_id='$id'

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

says said...

you can find more about that at http://xrumer-palladium.blogspot.com/2009/03/about-xrumer.html

if you're talk about any unofficial source, believe there's huge of them available. just try your luck with google.

Anonymous said...

My test this forum number 5. trfrtfzfefdkiol

Contact Lenses said...

Very good site, congratulations!

http://www.contact-lenses-without-prescription.com/