You should store your variable "lock" into the Session Object (ei :
Session->write(), Session->check or read ). When reading just check the
existence of the variable and it's value (in beforeFilter)...

On Nov 8, 11:14 pm, "cypher543" <[EMAIL PROTECTED]> wrote:
> I have a one-user blog, so I don't have a big fancy authentication
> scheme. What I want to do is "lock" certain actions so that they are
> only visible if my session is set. Here's what I did... (without the
> session checks done)
>
> In app_controller.php, I defined the beforeFilter() function:
>
> <?php
> class AppController extends Controller {
>         function beforeFilter() {
>                 // if action is locked
>                 if ($this->locked) {
>                         $this->flash("This page is for admins only!", "/");
>                         $this->locked = false;
>                         exit();
>                 }
>         }}?>
>
> In entries_controller.php, under the "write" action, I did the
> following:
>
> $this->locked = true;
>
> When I visit /entries/write, I get:
>
> Notice: Undefined property: EntriesController::$locked in
> /home/---/cakeapps/---/app_controller.php on line 5
>
> Anyone have any ideas? Sorry if there are some dumb mistakes that that
> code. I haven't used PHP for awhile and I'm still new to CakePHP.
> 
> Thanks,
> David


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to