Extending phpBB logins system....
Moderator: General Moderators
Extending phpBB logins system....
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?
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(...)
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(...)
You find the function definition in include/auth.php et voilà there you are$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info);
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?
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?