Jump to content

Recommended Posts

Posted

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.

Posted

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 :)

Posted

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.

Posted

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

  • Like 1
  • 9 months later...
Posted

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

Posted

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?

Posted

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, :)

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...