PhpBB3 authenticate agains custom database


I've got a website that has it's own database for authenticating users right now.  I need to add PhpBB3 onto this site.  I've got it installed already and working.

Is there a way so that when a user logs into my existing site which authenticates against my current database, they can also be logged into PhpBB3? (They would just link to the forums after logging in and be able to post)

From what I've researched, I'd need to modify the PhpBB's /includes/auth/auth_db.php file.

Has someone already completed this, or know of an easier solution?

Who is Participating?
compfixer101Connect With a Mentor Commented:
I would assume so

"As it was mentioned before you SHOULD install PHP as a module for realization of functions of work with headers and authorization. Anyway, these are occurrences of the same scale. Besides that, in case of PHP as a CGI-program variable $PHP_SELF (which should save name of the script accomplished) contains everything except for name. That is not the greatest trouble which can happen but you may need to use a script of someone else in which it is widely used& It may happen that by repeated call of script on name which is contained in the variable $PHP_SELF script simply finishes its work. A beaten link. Such a pity. Maybe its possible to find some other differences but it seems to me that this difference is quite enough to make your choice in favor of a PHP-module."
snakeriverAuthor Commented:
I've got the code below that others have gotten to work (Just need to modify the auth_db.php file to use my database).  When I run it, it says that the user has logged in successfully, then it redirects to the forums, but the user is NOT logged in there.

I ran this script on another hosting server, and works just fine.  Can anybody think of a reason why this wouldn't work on one hosting server versus another?  Sessions maybe?

    define('IN_PHPBB', true);
    $phpbb_root_path = './forums/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);
    // Start session management
        echo "User is already logged in";
        //$username = request_var('username', '', true);
        //$password = request_var('password', '', true);
		$username = "user";
		$password = "password";
        $result = $auth->login($username, $password);
        if ($result['status'] == LOGIN_SUCCESS)
            echo "User was successfully logged into phpBB";
            echo "User's login failed";
<META http-equiv="refresh" content="2;URL=forums/">

Open in new window

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

what is the difference in the servers?
different php versions?
different mysql versions?

did you purge the cache?
snakeriverAuthor Commented:
Looks like the two major differences are:

Server that does NOT work:
Running as CGI

Server that DOES work:
Running as Apache module
yeah, i would think that using php4 is the issue
Plus is dropping support for php4 soon, so i highly suggest that you upgrade to version 5
snakeriverAuthor Commented:
I tried running it with PHP5 by putting a .htaccess in my main directory where the login script runs, and one in the /forums directory.  Still no luck...

Would running PHP as CGI versus module be an issue?
snakeriverAuthor Commented:
Yeah, there is something definitely wrong with their hosting provider.  Thanks for your help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.