Bisa Posted July 19, 2010 Share Posted July 19, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/208214-how-to-remote-auth-then-redirect-to-referrer/ Share on other sites More sharing options...
linus72982 Posted July 19, 2010 Share Posted July 19, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/208214-how-to-remote-auth-then-redirect-to-referrer/#findComment-1088351 Share on other sites More sharing options...
Bisa Posted July 19, 2010 Author Share Posted July 19, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/208214-how-to-remote-auth-then-redirect-to-referrer/#findComment-1088373 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.