Fernando Posted March 11, 2015 Report Share Posted March 11, 2015 Hello friends, I would like to create a restriction on my website, users who are not registered, by clicking on the site would go directly to the page of access to pilots or registration of new entries. Example on the link below, http://crew.flyvawe.com/index.php/ Anyone have any ideas? My interest is to restrict all pages of the site to menros not register the same site above, only release after login. Quote Link to comment Share on other sites More sharing options...
Tom Posted March 11, 2015 Report Share Posted March 11, 2015 You can redirect using the php header() function, but it has to be before any output. In the very top of your layout.php (or layout.tpl/header.tpl if you're old school), before any output or whitespace: <?php if(!Auth::LoggedIn()){ header("Location: /index.php/registration"); } ?> You'll need to let them log in somehow though, so perhaps instead: <?php if(MainController::$activeModule !== 'LOGIN' && !Auth::LoggedIn()){ header("Location: /index.php/registration"); } ?> Then you have to account for log out, etc. but I'll let you deal with those Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 11, 2015 Report Share Posted March 11, 2015 Nevermind, Tom beat me to it Quote Link to comment Share on other sites More sharing options...
Fernando Posted March 11, 2015 Author Report Share Posted March 11, 2015 Thank you Tom! I am getting the following error below The web page in http://voegolv.net/index.php/registration resulted in too many redirects. Delete your cookies for this site or allowing third-party cookies may fix the problem. If not solve, the problem may be in the server configuration, not on your computer. Learn more about this problem. Error Code: ERR_TOO_MANY_REDIRECTS The page redirects to the chosen link, more loads only and does not open the selected location. Quote Link to comment Share on other sites More sharing options...
Tom Posted March 11, 2015 Report Share Posted March 11, 2015 Ah yeah, you need to stop it on registration too, e.g. <?php $excludedPages = array('REGISTRATION', 'LOGIN'); if(!in_array(MainController::$activeModule, $excludedPages) && !Auth::LoggedIn()){ header("Location: /index.php/registration"); } ?> So just add in the controller names of any pages you want excluded from the redirect in $excludedPages 1 Quote Link to comment Share on other sites More sharing options...
Fernando Posted March 11, 2015 Author Report Share Posted March 11, 2015 Thank you!!! Perfect now!! Quote Link to comment Share on other sites More sharing options...
Heritage1 Posted December 26, 2015 Report Share Posted December 26, 2015 I was curious if there is any payware per say Add on Modules yet in relation to this topic, as we have an on going issue with way to many Guests popping in and out as just the other night within 1 hour there was a totol of 227 guests, which in all turns, would on a normal basis hamper the User of a Free Domain. We do not have the issue of Limitations, and our Domain is unlimited in sql, bandwidth, space....etc. I guess my point is a Module that would allow the CEO/Admin to limit the guest / visitor traffic etc....Any ideas ?? I do like the idea above, thanks Tom. !! Jimbo Quote Link to comment Share on other sites More sharing options...
Tom Posted December 27, 2015 Report Share Posted December 27, 2015 I was curious if there is any payware per say Add on Modules yet in relation to this topic, as we have an on going issue with way to many Guests popping in and out as just the other night within 1 hour there was a totol of 227 guests, which in all turns, would on a normal basis hamper the User of a Free Domain. We do not have the issue of Limitations, and our Domain is unlimited in sql, bandwidth, space....etc. I guess my point is a Module that would allow the CEO/Admin to limit the guest / visitor traffic etc....Any ideas ?? I do like the idea above, thanks Tom. !! Jimbo Why would this hamper the use of your free domain? If you're not restricted on your usage I'm not sure why you'd want to limit people accessing your site - what if the person you limit was interested in signing up, and now goes elsewhere instead? Quote Link to comment Share on other sites More sharing options...
Heritage1 Posted December 27, 2015 Report Share Posted December 27, 2015 Thanks for the reply Tom, Good point Tom, is why I have decided against any re-direct of any of our sites. Valid point actually. Thank you though for your reply, much appreciated ! Anything I can do, let me know !! :) Jimbo WOW kewl, thanks for the links, 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.