Jump to content

Phpvms - Restrict website #SOLVED


Fernando

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 9 months later...

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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