Jump to content

How to: Remote Auth then Redirect to Referrer?


Bisa

Recommended Posts

As the topic suggests I'd like to know how to check a user remotely (in this particular example if they are logged in to our phpBB3 forum) and then, if they are, redirect them back to the page they were trying to access.

 

This is an attempt to bridge two frameworks, phpBB and Eqdkp.

 

What I know so far is this code would help me restrict access to custom pages based on my phpBB sessions:

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

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

if(!$user->data['is_registered']){
if ($user->data['user_id'] != ANONYMOUS){
	trigger_error('NOT_AUTHORISED');
}

login_box('', $user->lang['NOT_AUTHORISED']);
}

(btw, I've got the eqdkp and forum on the same server in separate sub-directories so perhaps "remotely" is an incorrect word)

 

however, simply adding this to my EqDKP session.php results in to many conflicts as they both use the same names for functions etcetera. Hence why I want to first send the user to some code checking if they are forum users and logged in, if they are send them back to eqdkp and allow them access.

 

I suspect this approach might be riddled with security issues or that it is possibly even messier then solving it some other way, well, that's why I reach out for help here ;)

Link to comment
Share on other sites

Just have a script at the top of the page where you want to check.  Put the variables in a session, header with the session id to the "check" page, have the check page send back a variable that says whether or not they are authorized, and then a simple if statement checking that variable will or will not show said information on the initial page.  Make sense?  I'm assuming here you know how to write PHP, if you don't, maybe I can jot something down to get you started.

Link to comment
Share on other sites

cheers, well I am able to understand/write php but I never got my head around sessions  ::) (and classes, but that is not relevant) so if you could "jot" me just a little sample code (provided you feel like it and have the time of course) I will most likely be able to build on it to suit my needs ;)

 

on a side not, this will be my last entry for tonight so if you do not hear from me it will not be because I am not grateful for your help but rather that I am sleeping or working  ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.