Extending phpBB logins system....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Extending phpBB logins system....

Post by RFairey »

I have a phpBB board installed on a site I run for one of my University societies - it is in a directory of its own (/phpBB2/) and is linked to from the index page. I would like to have some other features on the main site that requires users to be logged in before they become available. Instead of maintaining two login tables etc, is there a way of checking whether someone is logged into the board, and if not, to request their username/ password, and redirect to the page they originally requested instead of to the board as usual?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

not too hard to find. E.g. if you take a look at the "post reply" button here, you'll see that posting.php?mode=... is requested. Now open this file and you'll find that some kind of authentication/permisson is tested.
a variable $is_auth_type is set and then checked wether there is such an element in an array called $is_auth.
This array is returned by a function auth(...)
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info);
You find the function definition in include/auth.php et voilà there you are ;)
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Post by RFairey »

Aha -
think I've got it. Managed to reverse engineer some of the session functions so that I can get at the $userdata array in an outside page. ['session_user_id'] is what I needed.

Now I need a way for you to log in from an outside page - would it work to isolate the login script into a second file (keeping paths to includes etc) and have either Javascript resirections or hidden form fields to remember where to go back to once you've entered your password?
Post Reply