View Full Version : phpBB forum sessions

03-15-2010, 06:02 PM

I have phpBB forum and want to create a session from page which is in my website... I know that I need a special form, but I have no idea where to send values of password and login when someone tries to login...

Do someone had this kind of problem before? If you haven't understood what I am seeking for - ask me :)

The main idea is to make login page which would create a session in my forum, because my page with form is outside the phpBB forum directory.

Thanks in advance :)

03-15-2010, 06:17 PM
At the very top of your "protected" page, put the code shown ...
make sure the root_path variable points to where your forum is located.
In the example, my forum is located in another directory called "forum".
Your path will probably be different from mine.

define('IN_PHPBB', true);
$phpbb_root_path = '/forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management


. Then the rest of your HTML page
. You can also display the user's login name within your HTML, if you want ... like this ...
echo('<span style="font-size:13pt; font-weight:bold; color:#d31044;">Welcome Back '.$user->data['username'].'! </span> &nbsp; | &nbsp; <a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '" class="textlink">Log out</a>');
echo"<br />";
. The rest of your HTML

03-15-2010, 06:20 PM
can you tell me, which variables of this script are pass and login??

Because I want to create phpBB forum session and mine too by using same info :)

03-15-2010, 07:15 PM
That example is what sessions are created when you log into phpBB.
There are no session variables for the password, only the username.

That's sort of the point of using sessions. Once a person is logged-in, you
don't care about the password anymore ... they are logged in.

So on your site, you'll have them log into phpBB, and then you can leave
the forum and use the same session variables on other pages. But they
have to log into phpBB first, using the phpBB login form.

I guess I don't understand what you're trying to do exactly?

03-15-2010, 07:24 PM
what you are saying is right :)

I can try to explain this again:

I have my site with sessions like this:

$_SESSION['nick'] = $nick;
$_SESSION['password'] = $password;
$_SESSION['authID'] = $r['id'];

$password - md5 type.
$nick - lowercase letters
$id - number.

What I want to do is to create MY session and phpBB session at the same time from the same LOGIN FORM. I don't want to use phpBB sessions in my entire webpage because I have saved other, different info which I use.

Password and login are the same and that lets me to create two sessions at the same time.

03-15-2010, 09:54 PM
I think phpBB encrypts their passwords (MD5), so you would not
be able to work with that anyhow.

So, which way are you going?
1) Have them log into phpBB and use that throughout?
2) Have them log into your regular site and use that with phpBB ... throughout?

Which login will be the "master" login?

03-15-2010, 11:12 PM
This one: Have them log into your regular site and use that with phpBB.

I am using md5 too. Apart from this, user enters their real ligin and pass, and then pass is encrypted via md5. So if they put real values, I can check them.

When user logs theese steps would be executed:

1. user enters login and pass
2. Then php script checks if that login and pass are in MY database.
3. Then phpBB php script checks if that login and pass are in its database.
4. If the entered information exists in both databases, MY session and phpBB session will be activated, otherwise - error message.

The hard thing is to make a script which would check this info and create both sessions.

03-16-2010, 12:32 AM
phpbb uses an authorization plugin that can be changed to whatever you want.
This is really advanced, out of my league. Here is a PHP Class for it.

You might want to look for a phpbb forum for more advanced help.
But I know it can be done. phpbb can use YOUR custom site login instead of it's own.

03-16-2010, 05:48 PM
Can you write me a form and php script which creates phpBB session??

03-16-2010, 07:07 PM
Quote from post #8:

This is really advanced, out of my league.