The methodology to work with sessions is:

// for reading
$myVar = $this->Session->read('varName');

// for writing
$this->Session->write('varName', $varValue)

// for debugging the session array
$mySessionVars = $this->Session->read();
debug( $mySessionVars );

I hope this helps.


On 22 abr, 14:15, "b logica" <[EMAIL PROTECTED]> wrote:
> You're going to wince when you see this ...
>
> $session->id()http://api.cakephp.org/1.2/class_session_component.html#e1692bdb30d58...
>
> Yeah, it's odd that debug($session) shows an empty 'id' field and that
> you need to use the method. I'm sure it's much safer that way but then
> why the array field?
>
> Because, if i do
>
> $session->id('foobar') // the method also accepts a param to set the var
> debug($session);
>
> the id field is still empty.
>
> On Tue, Apr 22, 2008 at 1:04 PM, MonkeyGirl <[EMAIL PROTECTED]> wrote:
>
> >  Hi again!
>
> >  I'm using the session component, as documented at
> >  http://manual.cakephp.org/view/173/sessions, and it's storing and
> >  retrieving all the session variables I set just fine.
>
> >  However, I'm trying to find the session ID - or anything else that's
> >  unique to each visitor, but doesn't change each time they load a new
> >  page - and I'm getting a bit stuck here.
>
> >  I've tried echoing out PHP's session ID, as documented 
> > atwww.php.net/session_id
> >  , but it seems to change each time a page is loaded. I'm assuming
> >  CakePHP is doing magical things with sessions that I just shouldn't
> >  interfere with lest I break something, but please correct me if I'm
> >  wrong about that.
>
> >  So I looked at what $this->Session is storing, figuring that maybe
> >  it's storing some kind of consistent ID somewhere. The closest I could
> >  find was $this->Session->_userAgent , but that appears to just be a
> >  hash of the browser name, nothing else, as someone else using the same
> >  browser even on a different network will get the same value.
>
> >  So is there anything that acts like a regular, consistent session ID?
>
> >  If not, I can just set a hash of the user's browser, IP address, and
> >  the current timestamp at the exact moment they visit the site and set
> >  that as a regular session variable (ie each time the user loads a
> >  page, check for this session variable, and if it's not set, generate
> >  and set it), but that seems a bit long winded and a case of
> >  reinventing the wheel when this is exactly what session IDs are for.
>
> >  Thanks for any suggestions,
> >  Zoe.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to