Integrate Phpbb3 forum login(session) with website

Submitted By: omkargupta
Rating: (Not rated) (Rate It)
Share: Share By Email By Email

Visit


Description

When we use third part tool phpbb3 with your website as site forum there is necessary to set phpbb3 login session.
Ex-
Website name:-www.example.com
forum:- www.example.com/forum/


forum:-
www.example.com/forum/index.php,viewforum.php,viewtopic.php
First we need that user that is register with site also have entry in phpbb3 forum users table and user_group with same user id that is given on site registration time.

$var_id=$_GET['id'];

$user->session_begin();
if($var_id!='')
{
$str="select * from site_members where member_id=$var_id";
$qstr=mysql_query($str,$dbc);
$fstr=mysql_fetch_array($qstr);

$user->data[user_ip] = $_SERVER['REMOTE_ADDR'];
$user->data[user_regdate] = 0;
$user->data[username] = $fstr['first_name'];
$user->data[username_clean] = $fstr['first_name'];
$user->data[user_password] = md5($fstr['password']);

$user->data[user_lastpage] = index.php;

{missing check link for full code}
$user->data[session_id] = session_id();
$user->data[session_user_id] = $fstr["member_id"];;


$user->data[session_ip] = $_SERVER['REMOTE_ADDR'];
$user->data[session_browser] = $_SERVER['HTTP_USER_AGENT'];
$user->data[session_forwarded_for] = '';
$user->data[session_page] = 'index.php';
$user->data[session_viewonline] = 1;
$user->data[session_autologin] = 0;
$user->data[session_admin] = 0;
$user->data[is_registered] = 1;
$user->data[is_bot] = '';
$autologin='true';
$result = $auth->login($fstr['username'], $fstr['password'], $autologin);
$result['error_msg']=LOGIN_SUCCESS;
}

Comments (0)


Add Your Rating

(Not published)
star
starstar
starstarstar
starstarstarstar
starstarstarstarstar
 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.