yes, read a book
On Mar 24, 8:41 am, Aurelius <[email protected]> wrote:
> Thanks!
> One more problem, when it is going live, the Allow from would be a
> domain like "service.mydomain.de" and not a IP address, any solutions
> for that?
>
> thx
> Aurelius
>
> On 24 Mrz., 01:22, Graham Weldon <[email protected]> wrote:
>
> > class AppController extends Controller {
>
> > var $allowedHosts = array('127.0.0.1', '::1', '85.127.249.210');
> > var $accessDeniedRedirect = ... // Define your action to redirect to
> > here.
>
> > function beforeFilter() {
> > if (!in_array(env('REMOTE_ADDR'), $this->allowedHosts)) {
> > $this->redirect($this->accessDeniedRedirect);
> > die();
> > }
> > }
>
> > }
>
> > That would cover it.
> > The only thing I have not considered is that you need to allow anyone
> > access to the $accessDeniedRedirect address.
> > So you will need a check in or around your if statement in the
> > beforeFilter there to ensure unrestricted access to whatever you set
> > $accessDeniedRedirect is set to.
> > But I will leave that for you to sort out. Can't give you all the
> > solutions. That would be boring!
>
> > Cheers,
> > Graham
>
> > Aurelius wrote:
> > > Hi!
>
> > > I Would like to limit the access to a controller function in the same
> > > way as .htaccess would do it with these lines:
> > > Order deny,allow
> > > Deny from all
> > > Allow from 85.127.249.210
>
> > > How can I achieve that?
>
> > > thx
> > > Aurelius
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---