Badge Posted October 7, 2008 Report Share Posted October 7, 2008 I want to prevent access to the main page in your program to that nobody but logged in users can view it, basically I have your program acting solely as my piots home page only what must I do to ensure that only logged in users can see it?I have other pages that aren't part of your program that I want to restrict access to is there a line of code that I have to place in these pages to check to see if they are logged in? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 8, 2008 Administrators Report Share Posted October 8, 2008 for other pages, you can include the /core/codon.config.php, and then use: if(!Auth::LoggedIn()) { die('You are not logged in'); } // they are not logged in You can also place that in your local.config.php, at the bottom before the ?>. That should do the trick.Sorry for the late reply! Just started new job, been a little hectic. Quote Link to comment Share on other sites More sharing options...
Badge Posted October 8, 2008 Author Report Share Posted October 8, 2008 That line of code works when you put it in the codon.config.php file but not the other, you get a big error. If I place it in the codon.config it overrides everything and you get a blank white page with that says your are not logged in but now you are locked out of logging in because you are not given a link or any other way to login. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 9, 2008 Administrators Report Share Posted October 9, 2008 Don't modify the codon.config.php.You can do this then, though you'll have to re-do the change after an update. Open core/bootstrap.inc.php, and under this line: Auth::StartAuth(); SiteData::loadSiteSettings(); Put: if(!Auth::LoggedIn()) { header('Location: '.SITE_URL.'/index.php/Login'); } Quote Link to comment Share on other sites More sharing options...
Badge Posted October 9, 2008 Author Report Share Posted October 9, 2008 Almost now I get this errorRedirect LoopFirefox has detected that the server is redirecting the request for this address in a way that will never complete. The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete. * Have you disabled or blocked cookies required by this site? * NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.boy what do you charge for your services? you got bukoo bucks coming from from me! Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 9, 2008 Administrators Report Share Posted October 9, 2008 lol.. what do you need?Then try this redirect instead of the header() call: echo '<script type="text/javascript"><!--window.location = "'.SITE_URL.'/index.php/Login";//--></script>'; Quote Link to comment 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.