Hi Nick,

thank you for your reply, very interesting suggestion for the who's
online feature.

And yes, once I get hold of who is browsing, I want to store the data
in a table (may be 'users' with a status flag indicating they are not
registered).

But why rely on $_SERVER['REMOTE_ADDR'] (IPs aren't prone to
duplicates, two or more users behind the same firewall?), where
CakePHP automatically writes a 'CAKEPHP' (session, I think) cookie? I
mean, a part from not being to access to its value, just like
me :-) ...

Best,

Mario



On 2 Dic, 05:10, nurvzy <nur...@gmail.com> wrote:
> Hi Mario,
>
>   Well, if you want to use Sessions or Cookies I suggest reading the
> book on the two.  The problem you'll face is both cookie and session
> are client based objects.  So you can set all the sessions and cookies
> you want but you'll need a way to store them somewhere in either your
> server memory or a database so *you* can see it.   I suggest ditching
> the Session/Cookie idea and go with a database or flat-file.
>
>   The way I've tracked users in the past is create a database table
> ('onlines' for me).  Then in my Online model I just create a little
> method that delete's all entries greater than 10 minutes modified.  I
> then pass in $this->here to my Online's createOrUpdateUser model
> function, this is all in my beforeFilter() in my app_controller.php
>
> //app_controller beforeFilter()
> $this->Online->update();
> $this->Online->createOrUpdateUser($this->here);
>
> In createOrUpdateUser($currentPage = null) I use the IP ( $_SERVER
> ['REMOTE_ADDR'] ) as the key and just update/create where the user
> currently is in the app $this->here in the app_controller.
>
> This gives me a nice little Online table that I can look at to see
> who's online (for the last 10 minutes).
>
> Hope that helps,
> Nick
>
> On Dec 1, 11:50 am, Mario <mario.calli...@gmail.com> wrote:
>
> > Hi all,
>
> > I am dealing with unregistered users (no Auth login) and I want to
> > track them from page to page using sessions.
>
> > I see in my browser a cookie named 'CAKEPHP' and I thought I could
> > read it in a controller with
> > $this->Cookie->read(Configure::read('Session.cookie'))
> > [where in my config/core.php I have
> > Configure::write('Session.cookie', 'CAKEPHP');]
> > But it doesn't work, I get nothing.
>
> > Any hint or alternative method I could implement?
>
> > Thank you in advance.
>
> > Best,
>
> > Mario

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to