I was trying to do something similar in an application of mine.  What
I ended up with came about somewhat accidentally.
A lot of actions in my application require checking different
attributes of the user, so I was grabbing the user by the username to
get the current user by a session variable, but before grabbing the
user I was checking that the session variable even existed:

$this->Session->check($variable);

I may be wrong, and I hope someone will correct me if I am, but if the
session variable wasn't there I assumed that the session timed out, at
which point I did a

$this->flash("You session has timed out, please login again.", "/
controller/login/", 5);

I informed the user, and redirected them to the login page.

HTH

theperk

On Jun 6, 4:19 pm, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote:
> On 6/6/07, Penfold <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi
>
> > You can you check to see if the session is valid $this-session-
> > >valid() (i think) if the session is has timed out, it will be
> > invalid.
>
> Hi,
>
> I looked into this topic quite a bit as well, as I wanted to display a
> similar message to the user. I tried using $this->Session->valid() but it
> didn't work out for me. It was a while ago, but I think it *always*
> displayed the error message for me instead of only doing it when the session
> timed out.
>
> The only solution I can see is to modify the session handling code to take
> into consideration that the session may have simply timed out, and not
> consider it "hijacked" just because it timed out. However, if anyone knows
> if a better solution, I'll be happy to hear it !
>
> - Gonzalo


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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