Re: How can I get the current session?

2009-12-03 Thread Mario
Hi Nick,

I will definitely take a look, even if my aim right now is to track
unregistered users for days and in between different sessions, imagine
shopping carts for e-commerce or any other implementation where the
registration process is delayed or completed step by step at different
times.

Regarding substituting IPs with sessions, my previous reply to Dave
might contain a possible solution.

Best,

Mario

On 3 Dic, 03:29, nurvzy  wrote:
> Hi Mario,
>
>   I've repackaged my little who's online utility as a plugin.  It
> works well enough for my purposes basing off IP, its easy to track
> test and get at easily.  /shrug
>
> If you're interested, I wrote about 
> it:http://www.webtechnick.com/blogs/view/227/CakePHP_Who_s_Online_Plugin
>
> You can dig around in the source to see how it works, if you come up
> with a better way feel free to add to it/etc... =)
>
> Nick

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


Re: How can I get the current session?

2009-12-03 Thread Mario
Hi Dave,

thank you for help.

I moved forward a little bit on the issue.

With PHP function session_id() I can get the session id, and it
appears to be the same exact value stored in the 'CAKEPHP' cookie (or
whatever name you configure 'Session.cookie').

I just wonder, even if it is not an issue, if there is any method in
CakePHP Session to get the same.

Best,

Mario


On 3 Dic, 01:11, Dave  wrote:
> You can use the session id as the key as well if you prefer
>
> You just need to be sure to change the Security.level value in your core.php
> to at most medium.  On high it regenerates the session id every request.

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


Re: How can I get the current session?

2009-12-02 Thread nurvzy
Hi Mario,

  I've repackaged my little who's online utility as a plugin.  It
works well enough for my purposes basing off IP, its easy to track
test and get at easily.  /shrug

If you're interested, I wrote about it:
http://www.webtechnick.com/blogs/view/227/CakePHP_Who_s_Online_Plugin

You can dig around in the source to see how it works, if you come up
with a better way feel free to add to it/etc... =)

Nick

On Dec 2, 11:08 am, Mario  wrote:
> 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  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  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


Re: How can I get the current session?

2009-12-02 Thread Dave
Ps.  I think that previous statement that Session is a client side object is
incorrect.  Sessions = server side, Cookies = client side

If I am not mistaken... which happens plenty heh

On Wed, Dec 2, 2009 at 7:11 PM, Dave  wrote:

> You can use the session id as the key as well if you prefer
>
> You just need to be sure to change the Security.level value in your
> core.php to at most medium.  On high it regenerates the session id every
> request.
>
>
> On Wed, Dec 2, 2009 at 1:08 PM, Mario  wrote:
>
>> 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  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  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.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>

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


Re: How can I get the current session?

2009-12-02 Thread Dave
You can use the session id as the key as well if you prefer

You just need to be sure to change the Security.level value in your core.php
to at most medium.  On high it regenerates the session id every request.

On Wed, Dec 2, 2009 at 1:08 PM, Mario  wrote:

> 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  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  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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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


Re: How can I get the current session?

2009-12-02 Thread Mario
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  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  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


Re: How can I get the current session?

2009-12-02 Thread Mario
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  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  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


Re: How can I get the current session?

2009-12-01 Thread nurvzy
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  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