ad_williams Posted December 12, 2009 Share Posted December 12, 2009 Well ive got phbb3 foums set up on my site. Ive already made it so that you can use your forum login anywhere on the site. My next step is setting up secure pages that only people who are in a certain group on the forums can access. So far i have done this (the code below) but it comes up with this error when used on a webpage "[an error occurred while processing this directive] " <?php define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : 'forums/'; // Please change this to match the path of your installation. $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // This calls out the common PHPBB3 files, which we can use to easily verify users. include($phpbb_root_path . 'includes/functions_display.' . $phpEx); // This calls out the PHPBB3 functions, which we can use to manipulate users. $user->session_begin(); $auth->acl($user->data); $user->setup(); if($user->data['is_registered']) { echo '<p>yes</p>'; } else { echo '<p>no</p>'; //User's login failed } ?> The yes, no bit is just to make it simpler when testing Any help will be appreciated. Adam Quote Link to comment https://forums.phpfreaks.com/topic/184902-creating-secret-pages-for-people-logged-in-only/ Share on other sites More sharing options...
RussellReal Posted December 12, 2009 Share Posted December 12, 2009 thats right dude idk about the forum stuff but checking the session is what is required to check if the user is logged in, than you just echo the page or you don't (Or include) Quote Link to comment https://forums.phpfreaks.com/topic/184902-creating-secret-pages-for-people-logged-in-only/#findComment-976090 Share on other sites More sharing options...
ad_williams Posted December 12, 2009 Author Share Posted December 12, 2009 ok thanks mate. Is there anyway i can make it so dreamweaver tells me when i do something wrong when writing it - like it does with HTML?? Sorry if its a bit off topic - just saves me asking for stupid reasons. Quote Link to comment https://forums.phpfreaks.com/topic/184902-creating-secret-pages-for-people-logged-in-only/#findComment-976096 Share on other sites More sharing options...
oni-kun Posted December 12, 2009 Share Posted December 12, 2009 ok thanks mate. Is there anyway i can make it so dreamweaver tells me when i do something wrong when writing it - like it does with HTML?? Sorry if its a bit off topic - just saves me asking for stupid reasons. I doubt any IDE can really do that, atleast not with something like PHP. Anyway, Doesn't PHPBB allow you to only let certain groups view a forum? It's an admin configuration, I doubt it even needs you to touch the code, if I understand what you're asking. Quote Link to comment https://forums.phpfreaks.com/topic/184902-creating-secret-pages-for-people-logged-in-only/#findComment-976099 Share on other sites More sharing options...
ngreenwood6 Posted December 12, 2009 Share Posted December 12, 2009 your best bet at this point IMO is to try adding die() statements in there to see where it is actually killing the script. So you could do this: <?php define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : 'forums/'; // Please change this to match the path of your installation. $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx) or die('could not include'); // This calls out the common PHPBB3 files, which we can use to easily verify users. include($phpbb_root_path . 'includes/functions_display.' . $phpEx); // This calls out the PHPBB3 functions, which we can use to manipulate users. $user->session_begin(); $auth->acl($user->data); $user->setup(); if($user->data['is_registered']) { echo '<p>yes</p>'; } else { echo '<p>no</p>'; //User's login failed } ?> if you noticed i added a die() statement to the include so that you can see if it is dying there or after it. best bet is to figure out where it is actually stopping at and then troubleshoot it. you could also just add echo statements before and after stuff to see if it echos it or not. Quote Link to comment https://forums.phpfreaks.com/topic/184902-creating-secret-pages-for-people-logged-in-only/#findComment-976101 Share on other sites More sharing options...
ad_williams Posted December 12, 2009 Author Share Posted December 12, 2009 Thanks for helping guys - Problem solved ... Doesn't PHPBB allow you to only let certain groups view a forum? It's an admin configuration, I doubt it even needs you to touch the code, if I understand what you're asking. Oni - just to clear it up, i mean for the pages on my website not certain forums. Thanks though Quote Link to comment https://forums.phpfreaks.com/topic/184902-creating-secret-pages-for-people-logged-in-only/#findComment-976112 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.