Jump to content

Recommended Posts

Posted

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?

  • Administrators
Posted

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.

Posted

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.

  • Administrators
Posted

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');	}

Posted

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!

  • Administrators
Posted

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>';

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.

Loading...
×
×
  • Create New...