Using phpBB with another login system

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
ch8rt
Registered User
Posts: 16
Joined: Wed Dec 13, 2006 11:49 am
Location: UK
Contact:

Re: Using phpBB with another login system

Post by ch8rt »

pyrokenesis wrote:What do you need to know? Specific questions are more helpful.
Well, were do I start, I know nothing about this stuff and at the moment, I have an elgg.org front end (which is a community kind of thing) and a phpbb forum, they both use seperate logins. All I've done so far is ask members to use the same names on each so we have a chance to merge the two or something?

I haven't got a clue what to do to get this done? I believe I'm right in understanding that the method being talked about here would effectively log in the user of the same name when you log in to either the forum or the frontend? But they'll still have to register to both sections seperately.

Any pointers on where I should start?
User avatar
pyrokenesis
Registered User
Posts: 75
Joined: Sat Dec 23, 2006 1:13 pm
Location: London

Re: Using phpBB with another login system

Post by pyrokenesis »

ch8rt wrote:I haven't got a clue what to do to get this done? I believe I'm right in understanding that the method being talked about here would effectively log in the user of the same name when you log in to either the forum or the frontend? But they'll still have to register to both sections seperately.

Any pointers on where I should start?
Find the code in your frontend where the registration takes place, find where registration takes place in the forum, extract that code and place it after the frontend code. This registers the user in the phpbb forum at the same time they register on your main site.
aka Bigglesworth aka Billy Ray Valentine - Capricorn
http://www.royalurbanite.com/automp3mod/
taogyn
Registered User
Posts: 6
Joined: Wed Jun 27, 2007 1:38 pm

Re: Using phpBB with another login system

Post by taogyn »

Are you guys using two databases or one?

I know i'm bringing it up now, but this topic will save the world.
User avatar
pyrokenesis
Registered User
Posts: 75
Joined: Sat Dec 23, 2006 1:13 pm
Location: London

Re: Using phpBB with another login system

Post by pyrokenesis »

When I solved the problem I was using two databases.
aka Bigglesworth aka Billy Ray Valentine - Capricorn
http://www.royalurbanite.com/automp3mod/
taogyn
Registered User
Posts: 6
Joined: Wed Jun 27, 2007 1:38 pm

Re: Using phpBB with another login system

Post by taogyn »

Hi Pyro thanks for getting back to me.

Regarding the the login form from my main site, it already has an action
<form action="process.php" method="POST">

You mentioned that the form should point towards the forum login
<form method="post" action="forums/login.php">

But i'm not sure how this will work. The process does many other functions that i cannot remove, is there a way to have two actions? or could i integrate the forum login code to my process code?
User avatar
pyrokenesis
Registered User
Posts: 75
Joined: Sat Dec 23, 2006 1:13 pm
Location: London

Re: Using phpBB with another login system

Post by pyrokenesis »

The process.php should work for other functions but the login function within process.php will be defunct.
aka Bigglesworth aka Billy Ray Valentine - Capricorn
http://www.royalurbanite.com/automp3mod/
taogyn
Registered User
Posts: 6
Joined: Wed Jun 27, 2007 1:38 pm

Re: Using phpBB with another login system

Post by taogyn »

So its not possible from the way i have set up the form?

Theres another way, which i have tried, but still no luck. Heres the link
http://www.phpbuilder.com/board/showthr ... t=10318328

Once the user logs in the main site, he/she will auto log into the forum. Anyone had success with this method?
flagman5
Registered User
Posts: 11
Joined: Sat May 19, 2007 1:44 am

Re: Using phpBB with another login system

Post by flagman5 »

Code: Select all

////////////////////for phpBB///////////////////////////////
//generate session id

$query = "SELECT config_value FROM phpbb_config WHERE config_name='rand_seed'";
$return_seed = mysql_query($query) or die(mysql_error());
$seed = mysql_result($return_seed,0);

$val = $seed. microtime();
$val = md5($val);
$seed = md5($seed . $val . 'a');

// put it back in the table..werid
$sql = "UPDATE phpbb_config SET config_value='$seed' WHERE config_name='rand_seed'";
$return = mysql_query($sql) or die(mysql_error());

$session_id = md5(substr($val, 4, 16));

//get IP
$client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );
$user_ip = encode_ip($client_ip);

//current time
$current_time = time();

//create entry in sessions table
$sql = "INSERT INTO phpbb_sessions
			(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin)
			VALUES ('$session_id', '$clientid', $current_time, $current_time, '$user_ip', '0', '1', '0')";
$return = mysql_query($sql) or die(mysql_error());
// create sessiondata
$sessiondata['userid'] = *your own site ID, i dont know if you use phpBB or ur own sites;
$sessiondata['autologinid'] = false;

setcookie('phpbb2mysql_data', serialize($sessiondata), $current_time + 31536000, "/", ".urwebsite.com");
setcookie('phpbb2mysql_sid', $session_id, 0, "/", ".urwebsite.com");

///////////////////////////////////////////////////////////////
this is my code in my own login.php file...not the phpbb, and of course i got most of the code from PHPBB's functions
taogyn
Registered User
Posts: 6
Joined: Wed Jun 27, 2007 1:38 pm

Re: Using phpBB with another login system

Post by taogyn »

Thank you flagman

I entered the code, this error came up.

'encode_ip function has not been defined'
Saint_hh
Registered User
Posts: 363
Joined: Thu Mar 31, 2005 5:16 pm
Location: Hamburg / Germany
Name: Kevin
Contact:

Re: Using phpBB with another login system

Post by Saint_hh »

I had the same error, you just have to add this function, above the code of flagman5:

Code: Select all

function encode_ip($dotquad_ip)
{
	$ip_sep = explode('.', $dotquad_ip);
	return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
}
Then no error should come up.
schwarzenneger
Registered User
Posts: 25
Joined: Mon May 05, 2008 1:07 pm

Re: Using phpBB with another login system

Post by schwarzenneger »

Sorry for interrupting but I was just able to integrate phpbb with my existing website's login with very few lines of code and using very simple assumptions. I got so excited that I came back to this forum and posted this reply on the first matching thread I found. I'll now find proper thread and post my solution there.
schwarzenneger
Registered User
Posts: 25
Joined: Mon May 05, 2008 1:07 pm

Re: Using phpBB with another login system

Post by schwarzenneger »

I have posted the details on this thread:
http://www.phpbb.com/community/viewtopi ... 4&t=993475
aelliott1485
Registered User
Posts: 4
Joined: Wed Jul 02, 2008 4:37 pm

Re: Using phpBB with another login system

Post by aelliott1485 »

Hey has anybody tried doing this with phpBB3? I have gotten close (I think) to getting it to work, using some existing login classes found online but nothing seems to work.
aelliott1485
Registered User
Posts: 4
Joined: Wed Jul 02, 2008 4:37 pm

Re: Using phpBB with another login system

Post by aelliott1485 »

Ok I figured out what I wanted to do - in phpBB3 - I modified the login system by adding a function that accepted a user ID (since I had that available based on my userid in my other system), queried for the user with that ID and logged the user in that way. If anyone wants more details just let me know.
Post Reply

Return to “[2.0.x] MOD Writers Discussion”