Sessions Lost Oauth Debug Kit

2014-06-17 Thread Justin Harrison
Hi

Cake 2.4

I have a very strange problem and I am lost even though I have been working 
with Cake a number of years.

I have an app that I am integrating with XERO (An online accounting app) 
using OAuth.

Xero provided sample code https://github.com/XeroAPI/XeroOAuth-PHP that 
works fine on my server.

I messed with the sample code and using their libraries created the 
attached Controller. I have a dev area on my server and it works fine 
there. The user is directed to xero puts in their credentials and comes 
back with data from xero.

Cool. Demo to client, All good. Copy to production. No worky:(.

I eventually worked out that the test server has DebugKit and debug flag on 
but not in production notice in my controller I can turn debug on in line 
8. It works but this is not a good solution.

With debugging and DebugKit disabled the session is lost when it returns 
from the Xero server but with it enabled it does not!?!! 

Does anyone have any suggestions on where I can start looking? 

Any help appreciated.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
attachment: ApisController.php


Re: Sessions Lost Oauth Debug Kit

2014-06-17 Thread Justin Harrison


On Tuesday, June 17, 2014 7:43:25 PM UTC+12, Justin Harrison wrote:

 Hi

 Cake 2.4

 I have a very strange problem and I am lost even though I have been 
 working with Cake a number of years.

 I have an app that I am integrating with XERO (An online accounting app) 
 using OAuth.

 Xero provided sample code https://github.com/XeroAPI/XeroOAuth-PHP that 
 works fine on my server.

 I messed with the sample code and using their libraries created the 
 attached Controller. I have a dev area on my server and it works fine 
 there. The user is directed to xero puts in their credentials and comes 
 back with data from xero.

 Cool. Demo to client, All good. Copy to production. No worky:(.

 I eventually worked out that the test server has DebugKit and debug flag 
 on but not in production notice in my controller I can turn debug on in 
 line 8. It works but this is not a good solution.

 With debugging and DebugKit disabled the session is lost when it returns 
 from the Xero server but with it enabled it does not!?!! 

 Does anyone have any suggestions on where I can start looking? 

 Any help appreciated.



Solution ?!

I found that adding 

var $components = array('Filter.Filter'); 
var $filters = array(); 

To the top of my ApiController class fixed it dont know how but it works 
now. I know that is not a neat solution but I'm out of time.


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Broken Sessions When Using Firebug in CakePHP 2.3

2014-05-08 Thread gyrate360
ok,can u sent ur mail to my email:gytare...@gmail.com,
i'm using cakephp



--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Broken-Sessions-When-Using-Firebug-in-CakePHP-2-3-tp5714985p5718139.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Broken Sessions When Using Firebug in CakePHP 2.3

2014-05-06 Thread gyrate360
I face the same problem,how did u get there?



--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Broken-Sessions-When-Using-Firebug-in-CakePHP-2-3-tp5714985p5718117.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Broken Sessions When Using Firebug in CakePHP 2.3

2014-05-06 Thread Oliver John Tibi
gyrate360:

I've upgraded my Firebug many times after I posted my question, and
right now I'm using Firebug 1.12.8. It seems
that the Modify User-Agent String option is not available anymore.

Try upgrading your Firebug and reset your plugin settings using the
Firebug Addon Manager.



On Tue, May 6, 2014 at 2:03 PM, gyrate360 gyrate...@gmail.com wrote:
 I face the same problem,how did u get there?



 --
 View this message in context: 
 http://cakephp.1045679.n5.nabble.com/Broken-Sessions-When-Using-Firebug-in-CakePHP-2-3-tp5714985p5718117.html
 Sent from the CakePHP mailing list archive at Nabble.com.

 --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 You received this message because you are subscribed to a topic in the Google 
 Groups CakePHP group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/cake-php/vgdssORB-LI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Sessions break.. Easy fix?

2013-09-15 Thread Johnathan Davis
As we all know, Sessions will NOT carry across domains(Unless you 
serialize all the data and start a new one on the other side using that 
data and some sort of Factory()). What then, can one do about users 
entering a site that choose to use http://www.example.com  Instead of 
example.com? For Example...

Lets say I send out a mass email and in it is the following link: 

http://www.myCakeSite.com/Do/Something

Assuming that some people are weary of clicking links inside of emails they 
may choose to type the link into their address bar like so:

myCakeSite.com/Do/Something

OR EVEN:

www.myCakeSite.com/Do/Something

PHP's session handler sees all of these as DIFFERENT domains.. So if the 
site has an internal link NOT mapped to a controller or action
ie.

'a href=Blah.php alt=Go to BlahRead About Blah!!!/a'

This destroys the session. Losing all data and user info in the process. 

QUESTION:
Is the only way around this to change ALL LINKS to map to a controller 
action? So instead it would be:

$this-redirect(array('controller' = 'read', 'action' = 'blah'));

Then create a view for each file needing to be rendered while retaining the 
session data?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


IE6 and IE7 losing sessions - can't log in - solved

2013-08-15 Thread Jeremy Burns
I'm posting this as I had a problem that was driving me nuts. I know IE7 is 
ancient, so there are some posts on this subject from 2008/9, but none 
solved it for me. I have a global banking client trying my software and 
their standard browser is IE6. That is not at all uncommon in large 
corporates; upgrading a browser version is a big task and when you have 
hundreds or thousands of web apps that 'work' in IE6 retesting them is a 
major project. Microsoft even have a special IE6 support arrangement with 
them.

IE6 was proving a step too far for anything approaching a modern web site 
(that - as you'd expect - works perfectly in modern browsers) so they have 
agreed to limit it to users with IE7, which had some residual problems that 
also occurred in IE6.

Anyhow, that's the background, here's the problem and the solution. I just 
hope it helps at least one other person with this issue.

I'm using CakePHP version 2.3.9, but I suspect this would work in previous 
2.x versions too.

*The problem*

Users can log in with any browser but not IE6/7. Even if the right 
credentials work (and you know by using debug statements that the user is 
being logged in) they are constantly returned to the login screen as not 
logged in. Tracking it back, it's all good until the user is redirected, 
when for some reason the session fails, losing the logged in state. For the 
record, I am using database sessions - not sure how relevant this is to 
other session variants.

*The solution*

Add these lines to core.php:

Configure::write(
'Session',
array(
'defaults' = 'database',
'cookie' = '[something]',
'cookieTimeout' = 0,
'checkAgent' = false,
'ini' = array (
'session.cookie_secure' = false,
'session.referer_check' = false
)
)
);

Note that you need to add something relevant as the cookie name. I'd 
recommend avoiding underscores and special characters as there are other IE 
issues related to domain names that contain underscores and - even if they 
have nothing to do with this issues - I prefer to avoid them.

You cannot imagine my joy when I was able to log in after applying this fix.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Advices on sessions in multi app environment

2013-07-09 Thread Ernesto
Hi all

my working environment has 3 branches (dev, test, prod).
every branch has 5 apps, a shared cake core and a folder containing some 
shared classes

i'm having some troubles on logging the same app in different branches.
for example if i log into dev/app1 i lose the prod/app1 session.

what's the best practice to keep every app session indipendent from each 
other?

i'm using Cake 2.3.7

Thanks in advance

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Broken Sessions When Using Firebug in CakePHP 2.3

2013-05-23 Thread OJ Tibi - @ojtibi
Works for me, thanks!

On Thursday, May 23, 2013 9:23:27 AM UTC+8, SpazzyV wrote:

 You may want to set checkAgent = false, as Firefox will present as one 
 User Agent but then FireBug could show up as a different User Agent. The 
 default is true, and if the user agent changes with the same session key 
 will break the session - I believe.

 Thanks,
 Vinnie


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Broken Sessions When Using Firebug in CakePHP 2.3

2013-05-23 Thread OJ Tibi - @ojtibi
It's worth noting that the FirePHP add-on on Firefox was modifying my 
user-agent string. To turn it off, click on the FirePHP icon on your 
Firebug panel - Options - Modify User-Agent String.

On Thursday, May 23, 2013 5:23:09 PM UTC+8, OJ Tibi - @ojtibi wrote:

 Works for me, thanks!

 On Thursday, May 23, 2013 9:23:27 AM UTC+8, SpazzyV wrote:

 You may want to set checkAgent = false, as Firefox will present as one 
 User Agent but then FireBug could show up as a different User Agent. The 
 default is true, and if the user agent changes with the same session key 
 will break the session - I believe.

 Thanks,
 Vinnie



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Broken Sessions When Using Firebug in CakePHP 2.3

2013-05-22 Thread SpazzyV
You may want to set checkAgent = false, as Firefox will present as one User 
Agent but then FireBug could show up as a different User Agent. The default is 
true, and if the user agent changes with the same session key will break the 
session - I believe.

Thanks,
Vinnie

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Broken Sessions When Using Firebug in CakePHP 2.3

2013-05-20 Thread euromark
Isn't this covered in the docs?
http://book.cakephp.org/2.0/en/development/sessions.html

I imagine it could be ession.autoRegenerate


Am Montag, 20. Mai 2013 04:54:47 UTC+2 schrieb OJ Tibi - @ojtibi:

 Hi all, this is a fairly straightforward question.

 In previous versions, the behavior where CakePHP generates a new session 
 when folks like us inspect the page using Firebug can be mitigated by 
 setting the 'Security.level' to 'medium' via the core config.

 How can we stop CakePHP 2.3 from regenerating the session?

 Cheers,
 OJ


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Broken Sessions When Using Firebug in CakePHP 2.3

2013-05-20 Thread OJ Tibi - @ojtibi
Unfortunately, it doesn't work. The CakePHP core sets 
Session.autoRegenerate as 'false' for the default functionality.


On Monday, May 20, 2013 9:59:02 PM UTC+8, euromark wrote:

 Isn't this covered in the docs?
 http://book.cakephp.org/2.0/en/development/sessions.html

 I imagine it could be ession.autoRegenerate


 Am Montag, 20. Mai 2013 04:54:47 UTC+2 schrieb OJ Tibi - @ojtibi:

 Hi all, this is a fairly straightforward question.

 In previous versions, the behavior where CakePHP generates a new session 
 when folks like us inspect the page using Firebug can be mitigated by 
 setting the 'Security.level' to 'medium' via the core config.

 How can we stop CakePHP 2.3 from regenerating the session?

 Cheers,
 OJ



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Broken Sessions When Using Firebug in CakePHP 2.3

2013-05-19 Thread OJ Tibi - @ojtibi
Hi all, this is a fairly straightforward question.

In previous versions, the behavior where CakePHP generates a new session 
when folks like us inspect the page using Firebug can be mitigated by 
setting the 'Security.level' to 'medium' via the core config.

How can we stop CakePHP 2.3 from regenerating the session?

Cheers,
OJ

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Sessions expiring when they should not

2012-09-27 Thread Chris Cinelli
BTW, another problem of setting the cookie in 6 hours is that if the user
has a clock that is not synced (i.e. more than 6 hours ahead), the browser
will expire the session cookie and the user cannot stay logged in.

Best,
  Chris

On Tue, Sep 4, 2012 at 3:07 PM, Chris Cinelli 
chris.cine...@formativelearning.com wrote:

 It looks like the code is in CakeSession.php

 I think I solved the cookie expiration problem with this in the core.php:
 Configure::write('Session', array(
 'defaults' = 'php',
 'cookieTimeout' = 0,   //Lives until the browser is closed.
 'checkAgent'  = false  //To fix a little the Chrome Frame problem
 ));

 Pretty much all main website manage the session expiration using a session
 cookie (that get removed when the browser is closed). Exceptions are
 website that keep you loggedin like Facebook. They set the cookie
 expiration to a month after login (but the user actually have to check the
 box - keep me logged in).

 I think though that setting by default the cookie expiration to 6h (I
 think it is the PHP session default) and NEVER updated it is a *BUG*. If
 the user is on the website for 6h, he should not be forced to logging
 again. This is a major problem if the user is writing some very long text
 into a page that save the text with Ajax calls.*
 *
 BTW, the default behavior can actually create more security problems that
 leave the cookie expire with the session. In fact if the user is on a
 public computer and close the browser to finish his/her session, the
 following user that connect before the 6h limit is going to be able to
 reconnect to the website under the previous user credentials.*

 *Best, Chris
 *
 *
 On Tue, Sep 4, 2012 at 12:19 PM, Chris Cinelli 
 chris.cine...@formativelearning.com wrote:

 Anybody that know at least what it is the expected behavior?
 Is it normal that the CAKEPHP cookie has 6h expiration after login and
 never get updated?

 Best,
 Chris


 On Fri, Aug 31, 2012 at 2:20 PM, Chris Cinelli 
 chris.cine...@formativelearning.com wrote:

 We are using CakePHP 2.2.1 on Ubuntu 12.04 but I notice this behavior
 also on my Mac running on XAMPP and as far as I know we have always had
 this problem.

 I would expect that:

1. The session expires if after a certain amount of time if there
are no more calls to the server.
2. Activity on the server should update the expiring time.


 Instead we noticed that after a certain amount of time, the user get
 logged out and he has to log back in even if he accessed a page just a a
 minute before.
 I actually put even a hertbeat AJAX call that is been called every 20
 minutes that was supposed to prevent the session to expire, but sessions
 keep getting lost.

 Is this the intended behavior?

 If it not I am not sure if the problem is on the frontend's cookie or
 the backend;s session. I noticed that the CAKEPHP cookie has 6h expiration
 time since I log in and it never get renewed.

 Best,
Chris



 --
 --Everything should be made as simple as possible, but not simpler
 (Albert Einstein)




 --
 --Everything should be made as simple as possible, but not simpler
 (Albert Einstein)




 --
 --Everything should be made as simple as possible, but not simpler (Albert
 Einstein)




-- 
--Everything should be made as simple as possible, but not simpler (Albert
Einstein)

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




do database sessions still use cookies?

2012-09-07 Thread John Moses
I'm trying to save data via the session in an iframe using the database
defaults.  Is there anyway to store sessions to the database bypassing
cookies?  I tried ini_set use_cookies to 0 and that didn't work.

Thanks.

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Sessions expiring when they should not

2012-09-04 Thread Chris Cinelli
Anybody that know at least what it is the expected behavior?
Is it normal that the CAKEPHP cookie has 6h expiration after login and
never get updated?

Best,
Chris

On Fri, Aug 31, 2012 at 2:20 PM, Chris Cinelli 
chris.cine...@formativelearning.com wrote:

 We are using CakePHP 2.2.1 on Ubuntu 12.04 but I notice this behavior also
 on my Mac running on XAMPP and as far as I know we have always had this
 problem.

 I would expect that:

1. The session expires if after a certain amount of time if there are
no more calls to the server.
2. Activity on the server should update the expiring time.


 Instead we noticed that after a certain amount of time, the user get
 logged out and he has to log back in even if he accessed a page just a a
 minute before.
 I actually put even a hertbeat AJAX call that is been called every 20
 minutes that was supposed to prevent the session to expire, but sessions
 keep getting lost.

 Is this the intended behavior?

 If it not I am not sure if the problem is on the frontend's cookie or the
 backend;s session. I noticed that the CAKEPHP cookie has 6h expiration time
 since I log in and it never get renewed.

 Best,
Chris



 --
 --Everything should be made as simple as possible, but not simpler (Albert
 Einstein)




-- 
--Everything should be made as simple as possible, but not simpler (Albert
Einstein)

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Sessions expiring when they should not

2012-09-04 Thread Chris Cinelli
It looks like the code is in CakeSession.php

I think I solved the cookie expiration problem with this in the core.php:
Configure::write('Session', array(
'defaults' = 'php',
'cookieTimeout' = 0,   //Lives until the browser is closed.
'checkAgent'  = false  //To fix a little the Chrome Frame problem
));

Pretty much all main website manage the session expiration using a session
cookie (that get removed when the browser is closed). Exceptions are
website that keep you loggedin like Facebook. They set the cookie
expiration to a month after login (but the user actually have to check the
box - keep me logged in).

I think though that setting by default the cookie expiration to 6h (I think
it is the PHP session default) and NEVER updated it is a *BUG*. If the user
is on the website for 6h, he should not be forced to logging again. This is
a major problem if the user is writing some very long text into a page that
save the text with Ajax calls.*
*
BTW, the default behavior can actually create more security problems that
leave the cookie expire with the session. In fact if the user is on a
public computer and close the browser to finish his/her session, the
following user that connect before the 6h limit is going to be able to
reconnect to the website under the previous user credentials.*

*Best, Chris*
*
On Tue, Sep 4, 2012 at 12:19 PM, Chris Cinelli 
chris.cine...@formativelearning.com wrote:

 Anybody that know at least what it is the expected behavior?
 Is it normal that the CAKEPHP cookie has 6h expiration after login and
 never get updated?

 Best,
 Chris


 On Fri, Aug 31, 2012 at 2:20 PM, Chris Cinelli 
 chris.cine...@formativelearning.com wrote:

 We are using CakePHP 2.2.1 on Ubuntu 12.04 but I notice this behavior
 also on my Mac running on XAMPP and as far as I know we have always had
 this problem.

 I would expect that:

1. The session expires if after a certain amount of time if there are
no more calls to the server.
2. Activity on the server should update the expiring time.


 Instead we noticed that after a certain amount of time, the user get
 logged out and he has to log back in even if he accessed a page just a a
 minute before.
 I actually put even a hertbeat AJAX call that is been called every 20
 minutes that was supposed to prevent the session to expire, but sessions
 keep getting lost.

 Is this the intended behavior?

 If it not I am not sure if the problem is on the frontend's cookie or the
 backend;s session. I noticed that the CAKEPHP cookie has 6h expiration time
 since I log in and it never get renewed.

 Best,
Chris



 --
 --Everything should be made as simple as possible, but not simpler
 (Albert Einstein)




 --
 --Everything should be made as simple as possible, but not simpler (Albert
 Einstein)




-- 
--Everything should be made as simple as possible, but not simpler (Albert
Einstein)

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Sessions expiring when they should not

2012-08-31 Thread Chris Cinelli
We are using CakePHP 2.2.1 on Ubuntu 12.04 but I notice this behavior also
on my Mac running on XAMPP and as far as I know we have always had this
problem.

I would expect that:

   1. The session expires if after a certain amount of time if there are no
   more calls to the server.
   2. Activity on the server should update the expiring time.


Instead we noticed that after a certain amount of time, the user get logged
out and he has to log back in even if he accessed a page just a a minute
before.
I actually put even a hertbeat AJAX call that is been called every 20
minutes that was supposed to prevent the session to expire, but sessions
keep getting lost.

Is this the intended behavior?

If it not I am not sure if the problem is on the frontend's cookie or the
backend;s session. I noticed that the CAKEPHP cookie has 6h expiration time
since I log in and it never get renewed.

Best,
   Chris



-- 
--Everything should be made as simple as possible, but not simpler (Albert
Einstein)

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




New video tutorial: CakePHP basics part 3 - Basic authentication, Sessions, Callbacks, Routing

2012-08-23 Thread frederikjacques
Hi cake lovers,

I've just uploaded part 3 of my cakePHP basics tutorial series.
In this one we create a login form via the FormHelper, check it with the 
database by using a ordinary find method and using magical (oehh :)) find 
methods.
We'll check out sessions and some callback methods like beforeFilter in the 
appcontroller to check every request if the user is logged in.

http://blog.the-nerd.be/2012/08/cakephp-basics-tutorial-part-3/

Hope you like it!

Cheers,
Frederik

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: New video tutorial: CakePHP basics part 3 - Basic authentication, Sessions, Callbacks, Routing

2012-08-23 Thread soda sonic
nice.

2012/8/23 frederikjacques thenerd...@gmail.com

 Hi cake lovers,

 I've just uploaded part 3 of my cakePHP basics tutorial series.
 In this one we create a login form via the FormHelper, check it with the
 database by using a ordinary find method and using magical (oehh :)) find
 methods.
 We'll check out sessions and some callback methods like beforeFilter in
 the appcontroller to check every request if the user is logged in.

 http://blog.the-nerd.be/2012/08/cakephp-basics-tutorial-part-3/

 Hope you like it!

 Cheers,
 Frederik

 --
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en-US.






-- 
Sincerely

Noom .  086 688 5686

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: New video tutorial: CakePHP basics part 3 - Basic authentication, Sessions, Callbacks, Routing

2012-08-23 Thread Chetan Patel
Again g+1

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Database sessions garbage collection issue

2012-08-01 Thread Crazy
I'm having some issues with my sessions.

It's probably configuration somewhere, but don't know what to change/where 
to look.

I'm using database sessions for my cake application, these sessions are not 
getting cleaned up.

The app in question I have the issue on is an old one written on 1.3.10 
running with php version 5.3.5. The garbage collection function in the 2.x 
branch is the same so don't think the framework version will matter.

I've tracked down the issue to the function __gc located in the CakeSession 
class and that function is registered there in the php 
session_set_save_handler function, this is the function in question:

/**
 * Helper function called on gc for database sessions.
 *
 * @param integer $expires Timestamp (defaults to current time)
 * @return boolean Success
 * @access private
 */function __gc($expires = null) {
$model = ClassRegistry::getObject('Session');

if (!$expires) {
$expires = time();
}

$return = $model-deleteAll(array($model-alias . .expires  = 
$expires), false, false);
return $return;
}

Now, the comments say that $expires is a timestamp, but this isn't correct 
according to the php docs:


gc($lifetime)
The garbage collector callback is invoked internally by PHP periodically in 
order to purge old session data. The frequency is controlled by 
session.gc_probability and session.gc_divisor. The value of lifetime which is 
passed to this callback can be set in session.gc_maxlifetime. Return value 
should be TRUE for success, FALSE for failure.

The value for $lifeime, so gc_maxlifetime in php.ini is the following:


; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.session.gc_maxlifetime = 3600

So this results in a query that never deletes anything:

delete from cake_sessions where expires  3600;

Could someone clarify what I'm doing wrong or if this is an issue in cake 
itself?


I've posted this on ask.cakephp.org as well, when I find the answer I'll 
make sure to update both locations.

http://ask.cakephp.org/questions/view/database_sessions_garbage_collection_issue
 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Auth sessions not working in firefox or ie7

2012-08-01 Thread Tharanga Amaratunga
Im having the same problem with cakePHP2+ . Please let me know if you have 
found a solution.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Database sessions garbage collection issue

2012-08-01 Thread majna
By default there is 1% chance for gc to be called by PHP.
If you want to test if gc() is fired, increase *session.gc_probability *close 
to *divisor*:
http://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability
Then watch SQL log for that query.

Anyway, expires should be current timestamp + Session.timeout config
I know, PHP and sessions - nothing but sorcery :D

On Wednesday, August 1, 2012 9:12:13 AM UTC+2, Crazy wrote:

 I'm having some issues with my sessions.

 It's probably configuration somewhere, but don't know what to change/where 
 to look.

 I'm using database sessions for my cake application, these sessions are 
 not getting cleaned up.

 The app in question I have the issue on is an old one written on 1.3.10 
 running with php version 5.3.5. The garbage collection function in the 2.x 
 branch is the same so don't think the framework version will matter.

 I've tracked down the issue to the function __gc located in the 
 CakeSession class and that function is registered there in the php 
 session_set_save_handler function, this is the function in question:

 /**
  * Helper function called on gc for database sessions.
  *
  * @param integer $expires Timestamp (defaults to current time)
  * @return boolean Success
  * @access private
  */function __gc($expires = null) {
 $model = ClassRegistry::getObject('Session');

 if (!$expires) {
 $expires = time();
 }
 
 $return = $model-deleteAll(array($model-alias . .expires  = 
 $expires), false, false);
 return $return;
 }

 Now, the comments say that $expires is a timestamp, but this isn't correct 
 according to the php docs:


 gc($lifetime)
 The garbage collector callback is invoked internally by PHP periodically in 
 order to purge old session data. The frequency is controlled by 
 session.gc_probability and session.gc_divisor. The value of lifetime which is 
 passed to this callback can be set in session.gc_maxlifetime. Return value 
 should be TRUE for success, FALSE for failure.

 The value for $lifeime, so gc_maxlifetime in php.ini is the following:


 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.session.gc_maxlifetime = 3600

 So this results in a query that never deletes anything:

 delete from cake_sessions where expires  3600;

 Could someone clarify what I'm doing wrong or if this is an issue in cake 
 itself?


 I've posted this on ask.cakephp.org as well, when I find the answer I'll 
 make sure to update both locations.


 http://ask.cakephp.org/questions/view/database_sessions_garbage_collection_issue
  


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Database sessions garbage collection issue

2012-08-01 Thread Crazy
The function is located here:
http://api13.cakephp.org/view_source/cake-session/#l-784 

The value passed is the one from the php config,  session.gc_maxlifetime, 
so in my case 3600.


On Wednesday, August 1, 2012 7:58:09 PM UTC+2, cricket wrote:

 Where is __gc() called and what value is passed to it? 

 On Wed, Aug 1, 2012 at 3:12 AM, Crazy wrote: 
  I'm having some issues with my sessions. 
  
  It's probably configuration somewhere, but don't know what to 
 change/where 
  to look. 
  
  I'm using database sessions for my cake application, these sessions are 
 not 
  getting cleaned up. 
  
  The app in question I have the issue on is an old one written on 1.3.10 
  running with php version 5.3.5. The garbage collection function in the 
 2.x 
  branch is the same so don't think the framework version will matter. 
  
  I've tracked down the issue to the function __gc located in the 
 CakeSession 
  class and that function is registered there in the php 
  session_set_save_handler function, this is the function in question: 
  
  /** 
   * Helper function called on gc for database sessions. 
   * 
   * @param integer $expires Timestamp (defaults to current time) 
   * @return boolean Success 
   * @access private 
   */ 
  function __gc($expires = null) { 
  $model = ClassRegistry::getObject('Session'); 
  
  if (!$expires) { 
  $expires = time(); 
  } 
  
  $return = $model-deleteAll(array($model-alias . .expires  = 
  $expires), false, false); 
  return $return; 
  } 
  
  Now, the comments say that $expires is a timestamp, but this isn't 
 correct 
  according to the php docs: 
  
  gc($lifetime) 
  The garbage collector callback is invoked internally by PHP periodically 
 in 
  order to purge old session data. The frequency is controlled by 
  session.gc_probability and session.gc_divisor. The value of lifetime 
 which 
  is passed to this callback can be set in session.gc_maxlifetime. Return 
  value should be TRUE for success, FALSE for failure. 
  
  The value for $lifeime, so gc_maxlifetime in php.ini is the following: 
  
  ; After this number of seconds, stored data will be seen as 'garbage' 
 and 
  ; cleaned up by the garbage collection process. 
  session.gc_maxlifetime = 3600 
  
  So this results in a query that never deletes anything: 
  
  delete from cake_sessions where expires  3600; 
  
  Could someone clarify what I'm doing wrong or if this is an issue in 
 cake 
  itself? 
  
  
  I've posted this on ask.cakephp.org as well, when I find the answer 
 I'll 
  make sure to update both locations. 
  
  
 http://ask.cakephp.org/questions/view/database_sessions_garbage_collection_issue
  
  
  -- 
  Our newest site for the community: CakePHP Video Tutorials 
  http://tv.cakephp.org 
  Check out the new CakePHP Questions site http://ask.cakephp.org and 
 help 
  others with their CakePHP related questions. 
  
  
  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 


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Database sessions garbage collection issue

2012-08-01 Thread Crazy
The function is getting called just fine, that's not the problem.
At first I thought it was something with the php settings or cake settings.
But the session_save_handlers are pure php, and I have the default settings 
+ nothing cake related is put in between in the gc function.


On Wednesday, August 1, 2012 9:32:38 PM UTC+2, majna wrote:

 By default there is 1% chance for gc to be called by PHP.
 If you want to test if gc() is fired, increase *session.gc_probability *close 
 to *divisor*:

 http://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability
 Then watch SQL log for that query.

 Anyway, expires should be current timestamp + Session.timeout config
 I know, PHP and sessions - nothing but sorcery :D

 On Wednesday, August 1, 2012 9:12:13 AM UTC+2, Crazy wrote:

 I'm having some issues with my sessions.

 It's probably configuration somewhere, but don't know what to 
 change/where to look.

 I'm using database sessions for my cake application, these sessions are 
 not getting cleaned up.

 The app in question I have the issue on is an old one written on 1.3.10 
 running with php version 5.3.5. The garbage collection function in the 2.x 
 branch is the same so don't think the framework version will matter.

 I've tracked down the issue to the function __gc located in the 
 CakeSession class and that function is registered there in the php 
 session_set_save_handler function, this is the function in question:

 /**
  * Helper function called on gc for database sessions.
  *
  * @param integer $expires Timestamp (defaults to current time)
  * @return boolean Success
  * @access private
  */function __gc($expires = null) {
 $model = ClassRegistry::getObject('Session');

 if (!$expires) {
 $expires = time();
 }
 
 $return = $model-deleteAll(array($model-alias . .expires  = 
 $expires), false, false);
 return $return;
 }

 Now, the comments say that $expires is a timestamp, but this isn't 
 correct according to the php docs:


 gc($lifetime)
 The garbage collector callback is invoked internally by PHP periodically in 
 order to purge old session data. The frequency is controlled by 
 session.gc_probability and session.gc_divisor. The value of lifetime which 
 is passed to this callback can be set in session.gc_maxlifetime. Return 
 value should be TRUE for success, FALSE for failure.

 The value for $lifeime, so gc_maxlifetime in php.ini is the following:


 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.session.gc_maxlifetime = 3600

 So this results in a query that never deletes anything:

 delete from cake_sessions where expires  3600;

 Could someone clarify what I'm doing wrong or if this is an issue in cake 
 itself?


 I've posted this on ask.cakephp.org as well, when I find the answer I'll 
 make sure to update both locations.


 http://ask.cakephp.org/questions/view/database_sessions_garbage_collection_issue
  



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Database sessions garbage collection issue

2012-08-01 Thread majna
Oh, It's  in 1.3, but yeah, it's kind of a bug
It should be time() + $expires as PHP passes gc_maxlifetime to callback so
it never deletes old sessions.

But Cake fires gc() in __close() method too:
http://api13.cakephp.org/view_source/cake-session/#l-709

Try to test by increasing $probability var to 150


2012/8/1 Crazy crazy...@gmail.com

 The function is getting called just fine, that's not the problem.
 At first I thought it was something with the php settings or cake settings.
 But the session_save_handlers are pure php, and I have the default
 settings + nothing cake related is put in between in the gc function.


 On Wednesday, August 1, 2012 9:32:38 PM UTC+2, majna wrote:

 By default there is 1% chance for gc to be called by PHP.
 If you want to test if gc() is fired, increase *session.gc_probability *close
 to *divisor*:
 http://www.php.net/manual/en/**session.configuration.php#ini.**
 session.gc-probabilityhttp://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability
 Then watch SQL log for that query.

 Anyway, expires should be current timestamp + Session.timeout config
 I know, PHP and sessions - nothing but sorcery :D

 On Wednesday, August 1, 2012 9:12:13 AM UTC+2, Crazy wrote:

 I'm having some issues with my sessions.

 It's probably configuration somewhere, but don't know what to
 change/where to look.

 I'm using database sessions for my cake application, these sessions are
 not getting cleaned up.

 The app in question I have the issue on is an old one written on 1.3.10
 running with php version 5.3.5. The garbage collection function in the 2.x
 branch is the same so don't think the framework version will matter.

 I've tracked down the issue to the function __gc located in the
 CakeSession class and that function is registered there in the php
 session_set_save_handler function, this is the function in question:

 /**
  * Helper function called on gc for database sessions.
  *
  * @param integer $expires Timestamp (defaults to current time)
  * @return boolean Success
  * @access private
  */function __gc($expires = null) {
 $model = ClassRegistry::getObject('**Session');

 if (!$expires) {
 $expires = time();
 }

 $return = $model-deleteAll(array($model**-alias . .expires  = 
 $expires), false, false);
 return $return;
 }

 Now, the comments say that $expires is a timestamp, but this isn't
 correct according to the php docs:


 gc($lifetime)
 The garbage collector callback is invoked internally by PHP periodically in 
 order to purge old session data. The frequency is controlled by 
 session.gc_probability and session.gc_divisor. The value of lifetime which 
 is passed to this callback can be set in session.gc_maxlifetime. Return 
 value should be TRUE for success, FALSE for failure.

 The value for $lifeime, so gc_maxlifetime in php.ini is the following:


 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.session.gc_maxlifetime = 3600

 So this results in a query that never deletes anything:

 delete from cake_sessions where expires  3600;

 Could someone clarify what I'm doing wrong or if this is an issue in
 cake itself?


 I've posted this on ask.cakephp.org as well, when I find
 the answer I'll make sure to update both locations.

 http://ask.cakephp.org/**questions/view/database_**
 sessions_garbage_collection_**issuehttp://ask.cakephp.org/questions/view/database_sessions_garbage_collection_issue


  --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Database sessions garbage collection issue

2012-08-01 Thread majna
If you need to run gc more often, you can create Session model and override 
deleteAll() to fix that $expires

On Wednesday, August 1, 2012 11:21:23 PM UTC+2, majna wrote:

 Oh, It's  in 1.3, but yeah, it's kind of a bug
 It should be time() + $expires as PHP passes gc_maxlifetime to callback 
 so it never deletes old sessions.

 But Cake fires gc() in __close() method too:
 http://api13.cakephp.org/view_source/cake-session/#l-709

 Try to test by increasing $probability var to 150


 2012/8/1 Crazy crazy...@gmail.com

 The function is getting called just fine, that's not the problem.
 At first I thought it was something with the php settings or cake 
 settings.
 But the session_save_handlers are pure php, and I have the default 
 settings + nothing cake related is put in between in the gc function.


 On Wednesday, August 1, 2012 9:32:38 PM UTC+2, majna wrote:

 By default there is 1% chance for gc to be called by PHP.
 If you want to test if gc() is fired, increase *session.gc_probability 
 *close 
 to *divisor*:
 http://www.php.net/manual/en/**session.configuration.php#ini.**
 session.gc-probabilityhttp://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability
 Then watch SQL log for that query.

 Anyway, expires should be current timestamp + Session.timeout config
 I know, PHP and sessions - nothing but sorcery :D

 On Wednesday, August 1, 2012 9:12:13 AM UTC+2, Crazy wrote:

 I'm having some issues with my sessions.

 It's probably configuration somewhere, but don't know what to 
 change/where to look.

 I'm using database sessions for my cake application, these sessions are 
 not getting cleaned up.

 The app in question I have the issue on is an old one written on 1.3.10 
 running with php version 5.3.5. The garbage collection function in the 2.x 
 branch is the same so don't think the framework version will matter.

 I've tracked down the issue to the function __gc located in the 
 CakeSession class and that function is registered there in the php 
 session_set_save_handler function, this is the function in question:

 /**
  * Helper function called on gc for database sessions.
  *
  * @param integer $expires Timestamp (defaults to current time)
  * @return boolean Success
  * @access private
  */function __gc($expires = null) {
 $model = ClassRegistry::getObject('**Session');

 if (!$expires) {
 $expires = time();
 }
 
 $return = $model-deleteAll(array($model**-alias . .expires  = 
 $expires), false, false);
 return $return;
 }

 Now, the comments say that $expires is a timestamp, but this isn't 
 correct according to the php docs:


 gc($lifetime)
 The garbage collector callback is invoked internally by PHP periodically 
 in order to purge old session data. The frequency is controlled by 
 session.gc_probability and session.gc_divisor. The value of lifetime which 
 is passed to this callback can be set in session.gc_maxlifetime. Return 
 value should be TRUE for success, FALSE for failure.

 The value for $lifeime, so gc_maxlifetime in php.ini is the following:


 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.session.gc_maxlifetime = 
 3600

 So this results in a query that never deletes anything:

 delete from cake_sessions where expires  3600;

 Could someone clarify what I'm doing wrong or if this is an issue in 
 cake itself?


 I've posted this on ask.cakephp.org as well, when I find 
 the answer I'll make sure to update both locations.

 http://ask.cakephp.org/**questions/view/database_**
 sessions_garbage_collection_**issuehttp://ask.cakephp.org/questions/view/database_sessions_garbage_collection_issue
  

  -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
  
  
 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




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Database sessions garbage collection issue

2012-08-01 Thread Crazy
It's the same code in the 2.x branch, I'll log a ticket, just wanted to be 
100% sure before I did.

In the close method it only gets called when using cache, not when using 
database sessions.

I'll patch the function, thanks for the help.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


A session problem using database(cake-sessions)

2012-06-01 Thread Murray
I'm planning to use the database session mode in cake 1.3 for load
balance through servers. However, in one of my servers, the session
expires immediately while i write a session value, and the records in
the database is odd and very very long.(The records from other servers
are short). It's something like this:

Config|N;s:9:amp;amp;quot;userAgentamp;amp;quot;;s:
0:amp;amp;quot;amp;amp;quot;;s:4:amp;amp;quot;timeamp;amp;quot;;i:
1339560686;s:7:amp;amp;quot;timeoutamp;amp;quot;;i:10;}s:
9:amp;amp;amp;quot;userAgentamp;amp;amp;quot;;s:
0:amp;amp;amp;quot;amp;amp;amp;quot;;s:
4:amp;amp;amp;quot;timeamp;amp;amp;quot;;i:1339560681;s:
7:amp;amp;amp;quot;timeoutamp;amp;amp;quot;;i:10;}s:
9:amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;quot;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;quot;timeamp;amp;amp;amp;quot;;i:1339560681;s:
7:amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;quot;;i:10;}s:
9:amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;quot;;i:
1339560681;s:
7:amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;quot;;i:10;}s:
9:amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;quot;;i:
1339560681;s:
7:amp;amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;amp;quot;;i:
10;}s:
9:amp;amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;amp;quot;;i:
1339560681;s:
7:amp;amp;amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;amp;amp;quot;;i:
10;}s:
9:amp;amp;amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
1339560680;s:
7:amp;amp;amp;amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
10;}s:
9:amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
1339560637;s:
7:amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
10;}s:
9:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
1339560636;s:
7:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
10;}s:
9:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
1339560636;s:
7:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
10;}s:
9:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
1339560635;s:
7:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
10;}s:
9:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
1339560634;s:
7:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeoutamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
10;}s:
9:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;userAgentamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
0:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;s:
4:amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;timeamp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;i:
1339560633;s:

Re: Doubt regarding sessions in cakephp

2012-03-31 Thread euromark
I don't like session approaches, at least if it not correctly coded (the 
keys in the session must not overwrite themselves using several tabs at the 
same time). this really annoys people because they always 
get unnecessarily black-holed due to this concurrency problem.

if it doesnt have to be highest security you can also use the session-less 
approach:
http://www.dereuromark.de/2010/08/09/how-to-implement-captchas-properly/ 
as a math captcha it also tries to do justice to all frontend users (I got 
some positive feedback from handycapped people on my cake based social 
network site saying that they could work with this thousand times better 
than those image things).
you can always combine it with the Security component to maximize security.


Am Samstag, 31. März 2012 03:09:56 UTC+2 schrieb Gabriel Vila Real:

 Hi Litto

 It looks like some php.ini configuration has to be done. Compare your 
 local php.ini file with production php.ini file, and check the session 
 configurations.

 -- 
 Gabriel Vila Real



 On Thu, Mar 29, 2012 at 02:39, LITTO CHACKO li...@axtecindia.com wrote:

 hai, buddies iam currently working in a project which contains as
 many forms.. so i have to attach captcha to each form for ensuring
 security... so the problem is that... actually captcha is working with
 help of sessions... u all know.. whwn iam testing it on local server
 it works fine with captcha and submitting form.. but whwn i do the
 same in main server.. i didn't get the value of captcha stored in
 session??? pls anyone clear this doubt by giving effective
 solutions??? beacuse of this pblm by project is in vain

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.


 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




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Doubt regarding sessions in cakephp

2012-03-30 Thread Gabriel Vila Real
Hi Litto

It looks like some php.ini configuration has to be done. Compare your local
php.ini file with production php.ini file, and check the session
configurations.

-- 
Gabriel Vila Real



On Thu, Mar 29, 2012 at 02:39, LITTO CHACKO li...@axtecindia.com wrote:

 hai, buddies iam currently working in a project which contains as
 many forms.. so i have to attach captcha to each form for ensuring
 security... so the problem is that... actually captcha is working with
 help of sessions... u all know.. whwn iam testing it on local server
 it works fine with captcha and submitting form.. but whwn i do the
 same in main server.. i didn't get the value of captcha stored in
 session??? pls anyone clear this doubt by giving effective
 solutions??? beacuse of this pblm by project is in vain

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: CakePHP Controller Testing with DB Sessions

2012-03-29 Thread Mike Griffin
Have you tried creating the cake_sessions table in your test database?

I think you have to manually create the tables in the test database
before you can use them.

Mike.

On Wed, Mar 28, 2012 at 20:57, jcrens8392 runner1...@gmail.com wrote:
 Hi all,

 I'm new to Cake and had controller test cases working fine.

 However, I just recently switched to DB sessions and now all my controller
 test cases throw a MissingTableException:

 Table cake_sessions for model Session was not found in datasource test.

 I have no idea even where to begin on this. Any ideas!

 Thanks!

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: CakePHP Controller Testing with DB Sessions

2012-03-29 Thread Rodrigo Rodrigues Moyle
Mock you SessionComponent to not access the database.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: CakePHP Controller Testing with DB Sessions

2012-03-29 Thread jcrens8392
That was just the quick fix I needed right now. Thanks!

On Mar 29, 3:51 am, Mike Griffin griff...@gmail.com wrote:
 Have you tried creating the cake_sessions table in your test database?

 I think you have to manually create the tables in the test database
 before you can use them.

 Mike.







 On Wed, Mar 28, 2012 at 20:57, jcrens8392 runner1...@gmail.com wrote:
  Hi all,

  I'm new to Cake and had controller test cases working fine.

  However, I just recently switched to DB sessions and now all my controller
  test cases throw a MissingTableException:

  Table cake_sessions for model Session was not found in datasource test.

  I have no idea even where to begin on this. Any ideas!

  Thanks!

  --
  Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
  others with their CakePHP related questions.

  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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: CakePHP Controller Testing with DB Sessions

2012-03-29 Thread jcrens8392
Thanks for the tip. I'm sure this is the more Cakey way to do it. I
used the quick fix above for now but will definitely look into this in
the future. Thanks!

On Mar 29, 1:49 pm, Rodrigo Rodrigues Moyle rodrig...@gmail.com
wrote:
 Mock you SessionComponent to not access the database.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


CakePHP Controller Testing with DB Sessions

2012-03-28 Thread jcrens8392
Hi all,

I'm new to Cake and had controller test cases working fine.

However, I just recently switched to DB sessions and now all my controller 
test cases throw a MissingTableException:

Table cake_sessions for model Session was not found in datasource test.

I have no idea even where to begin on this. Any ideas!

Thanks!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Doubt regarding sessions in cakephp

2012-03-28 Thread LITTO CHACKO
hai, buddies iam currently working in a project which contains as
many forms.. so i have to attach captcha to each form for ensuring
security... so the problem is that... actually captcha is working with
help of sessions... u all know.. whwn iam testing it on local server
it works fine with captcha and submitting form.. but whwn i do the
same in main server.. i didn't get the value of captcha stored in
session??? pls anyone clear this doubt by giving effective
solutions??? beacuse of this pblm by project is in vain

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Problems with sessions

2012-01-06 Thread jholcomb
Hello all,

I am trying to add a menu system to my project so that it appears on all my
pages. The one I was able to find that looked good to me is found here,
http://www.palivoda.eu/2008/04/dynamic-menu-in-cakephp/ 

The problem I am running into is after doing everything the site said to do
I get the following error.

Fatal error: Call to a member function read() on a non-object in
C:\UniServer\www\new_company_test\app\View\Layouts\default.ctp on line 41 

line 41 of my default.ctp file is echo
$this-Menu-render($this-Session-read('Menu.main')); 
exactly like the site said to do it.

It looks like this was written in 2008 so I assume this was written for 1.2
or 1.3. 

I have looked at the 2.0 documentation to try and figure out what needs to
change to make it work in 2.0 with no luck.  Is there anyone that can point
me in the right direction to get this resolved? Any help is appreciated.

Thanks
Jamie

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Problems-with-sessions-tp5125948p5125948.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Problems with sessions

2012-01-06 Thread jholcomb
never mind I figured out my problem.  I needed to add the Session to my
helpers array in my app controller. Found it after reading the manual for
the forth time.

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Problems-with-sessions-tp5125948p5125998.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cakephp 2.0.3: Troubles with Sessions...

2011-12-02 Thread ava
SOLVED: removing the ?  at the end of the controller solved the
problem. Weird.

On Nov 27, 7:30 pm, ava avon...@gmx.net wrote:
 @euromark

 how is the test case set up? Well, I call it several times by clicking
 on the link in the view.  I don't know if this answers your
 question...

 Anyway, I tried to get aSessionID, but this doesn't return a value:

 function testsession() {
       if ($scounter = $this-Session-read('scounter')) {
           $scounter++;
       } else {
           $scounter = 1;
       }
       $this-Session-write('scounter', $scounter);
       $this-set('scounter', $scounter);

       $this-log('SessionID: ' . $this-Session-id());      // no
 SessionID is outputed...

 }

 On Nov 27, 1:57 pm, euromark dereurom...@googlemail.com wrote:







  you can simplify the condition to
  if ($scounter = $this-Session-read('scounter')) {}

  but besides that
  how is the test case set up?
  because it is possible that it resets itself after each run
  therefore thesessionwould always be emptied afterwards...

  On 27 Nov., 11:38,avaavon...@gmx.net wrote:

   Hi

   I'm struggling with sessions in cakephp 2.0.3.

   In this testcase the counter should be incremented with each click on
   the link.  The counter always remains 1.

   // CONTROLLER
   ?php
   class Test01sController extends AppController {

      public $components = array('Session');

      function testsession() {
         $scounter = 1;
         if ($this-Session-check('scounter')) {
             $scounter = $this-Session-read('scounter');
             $scounter++;
         }
         $this-Session-write('scounter', $scounter);
         $this-set('scounter', $scounter);
       }

   }

   //MODEL
   ?php
   class Test01 extends AppModel {
      var $name = 'Test01';
      var $useTable = false;}

   ?

   // VIEW
   ?php
   echo $scounter;
   ?
   br/a href=/test01s/testsessiontestsession/a

   // CORE
   Configure::write('Session', array(
       'defaults' = 'php',
       'cookie' = 'vportal',
       'ini' = array('session.gc_divisor' =
   1000,'session.cookie_httponly' = true),
       'timeout' = 4320  //3 days
   ));

   I also dumped the $_SESSION array. This array is always empty.

   Any help or hints are appreciated.

   -- Andre

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Updating application source without breaking sessions

2011-11-28 Thread Ernesto
Hi all

i have a multi-app, single-core environment.
how can i update the source code without resetting sessions?
a friend of mine told me to not overwrite the tmp folder. Is this enough?


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Updating application source without breaking sessions

2011-11-28 Thread Ernesto
oh i forgot to say i'm using cake session handler

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Cakephp 2.0.3: Troubles with Sessions...

2011-11-27 Thread ava
Hi

I'm struggling with sessions in cakephp 2.0.3.

In this testcase the counter should be incremented with each click on
the link.  The counter always remains 1.

// CONTROLLER
?php
class Test01sController extends AppController {

   public $components = array('Session');

   function testsession() {
  $scounter = 1;
  if ($this-Session-check('scounter')) {
  $scounter = $this-Session-read('scounter');
  $scounter++;
  }
  $this-Session-write('scounter', $scounter);
  $this-set('scounter', $scounter);
}
}


//MODEL
?php
class Test01 extends AppModel {
   var $name = 'Test01';
   var $useTable = false;
}
?


// VIEW
?php
echo $scounter;
?
br/a href=/test01s/testsessiontestsession/a


// CORE
Configure::write('Session', array(
'defaults' = 'php',
'cookie' = 'vportal',
'ini' = array('session.gc_divisor' =
1000,'session.cookie_httponly' = true),
'timeout' = 4320  //3 days
));




I also dumped the $_SESSION array. This array is always empty.

Any help or hints are appreciated.

-- Andre




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cakephp 2.0.3: Troubles with Sessions...

2011-11-27 Thread euromark
you can simplify the condition to
if ($scounter = $this-Session-read('scounter')) {}

but besides that
how is the test case set up?
because it is possible that it resets itself after each run
therefore the session would always be emptied afterwards...



On 27 Nov., 11:38, ava avon...@gmx.net wrote:
 Hi

 I'm struggling with sessions in cakephp 2.0.3.

 In this testcase the counter should be incremented with each click on
 the link.  The counter always remains 1.

 // CONTROLLER
 ?php
 class Test01sController extends AppController {

    public $components = array('Session');

    function testsession() {
       $scounter = 1;
       if ($this-Session-check('scounter')) {
           $scounter = $this-Session-read('scounter');
           $scounter++;
       }
       $this-Session-write('scounter', $scounter);
       $this-set('scounter', $scounter);
     }

 }

 //MODEL
 ?php
 class Test01 extends AppModel {
    var $name = 'Test01';
    var $useTable = false;}

 ?

 // VIEW
 ?php
 echo $scounter;
 ?
 br/a href=/test01s/testsessiontestsession/a

 // CORE
 Configure::write('Session', array(
     'defaults' = 'php',
     'cookie' = 'vportal',
     'ini' = array('session.gc_divisor' =
 1000,'session.cookie_httponly' = true),
     'timeout' = 4320  //3 days
 ));

 I also dumped the $_SESSION array. This array is always empty.

 Any help or hints are appreciated.

 -- Andre

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cakephp 2.0.3: Troubles with Sessions...

2011-11-27 Thread ava
@euromark

how is the test case set up? Well, I call it several times by clicking
on the link in the view.  I don't know if this answers your
question...

Anyway, I tried to get a Session ID, but this doesn't return a value:

function testsession() {
  if ($scounter = $this-Session-read('scounter')) {
  $scounter++;
  } else {
  $scounter = 1;
  }
  $this-Session-write('scounter', $scounter);
  $this-set('scounter', $scounter);

  $this-log('SessionID: ' . $this-Session-id());  // no
SessionID is outputed...
}



On Nov 27, 1:57 pm, euromark dereurom...@googlemail.com wrote:
 you can simplify the condition to
 if ($scounter = $this-Session-read('scounter')) {}

 but besides that
 how is the test case set up?
 because it is possible that it resets itself after each run
 therefore the session would always be emptied afterwards...

 On 27 Nov., 11:38, ava avon...@gmx.net wrote:







  Hi

  I'm struggling with sessions in cakephp 2.0.3.

  In this testcase the counter should be incremented with each click on
  the link.  The counter always remains 1.

  // CONTROLLER
  ?php
  class Test01sController extends AppController {

     public $components = array('Session');

     function testsession() {
        $scounter = 1;
        if ($this-Session-check('scounter')) {
            $scounter = $this-Session-read('scounter');
            $scounter++;
        }
        $this-Session-write('scounter', $scounter);
        $this-set('scounter', $scounter);
      }

  }

  //MODEL
  ?php
  class Test01 extends AppModel {
     var $name = 'Test01';
     var $useTable = false;}

  ?

  // VIEW
  ?php
  echo $scounter;
  ?
  br/a href=/test01s/testsessiontestsession/a

  // CORE
  Configure::write('Session', array(
      'defaults' = 'php',
      'cookie' = 'vportal',
      'ini' = array('session.gc_divisor' =
  1000,'session.cookie_httponly' = true),
      'timeout' = 4320  //3 days
  ));

  I also dumped the $_SESSION array. This array is always empty.

  Any help or hints are appreciated.

  -- Andre

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Sessions working on Local dev but not on server

2011-10-12 Thread JTiki
I resolved the problem.

Whatever the issue was it stopped when I updated the /cake folder on
the server.

On Oct 10, 10:22 pm, JTiki jeremyt...@gmail.com wrote:
 I've recently been working on a project for a client. Its a simple E-
 Commerce site and I decided to use Sessions for the cart.

 I got everything set-up and working 100% on my local dev area, but for
 some reason when I went over to the server the sessions are not
 carrying...

 I set-up a test under the action where I add items to the cart (/
 mycart/add) and it is showing that the sessions are created and
 displays them correctly. However when refreshing the page, or going to
 a different page (like /mycart/) the session seems to be destroyed! I
 cannot figure this out... Can anyone help?

 I've set up an example below...
 Session just added and showing 
 up:http://country.tikiwebproductions.com/mycart/add/2
 Then move to another page and it 
 disappears:http://country.tikiwebproductions.com/mycart/other

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Sessions working on Local dev but not on server

2011-10-11 Thread flo.kl...@googlemail.com
Have you checked the db or filesystem if the session data is stored?
You also have to have cookies enabled, othetwise the session cant be tracked.



JTiki jeremyt...@gmail.com schrieb:

I've recently been working on a project for a client. Its a simple E-
Commerce site and I decided to use Sessions for the cart.

I got everything set-up and working 100% on my local dev area, but for
some reason when I went over to the server the sessions are not
carrying...

I set-up a test under the action where I add items to the cart (/
mycart/add) and it is showing that the sessions are created and
displays them correctly. However when refreshing the page, or going to
a different page (like /mycart/) the session seems to be destroyed! I
cannot figure this out... Can anyone help?

I've set up an example below...
Session just added and showing up:
http://country.tikiwebproductions.com/mycart/add/2
Then move to another page and it disappears:
http://country.tikiwebproductions.com/mycart/other

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


redirect and sessions not working

2011-10-11 Thread cakii
i,

i have a few problems i can't solve ..

im using cake 2.0.0-RC3 and PHP Version 5.3.1
cake default layout , debug 2

in my controller i only have one simple line: (the corresponding view
is completly empty)

$this-redirect('http://http://www.cakephpforum.net/');


but nothing happens, just a white page.

same with:

$this-redirect(array('controller' = 'test', 'action' = 'view'));



also i cant get the sessions working.

i have this line in my appcontroller:

public $components = array('Session');

(is this line needed ? and/or anything else to use sessions? )

in my controller (extend appcontroller) the only 3 lines are:


echo $this-Session-check('lastVisit');
$this-Session-write('lastVisit', time());
echo $this-Session-check('lastVisit');
debug($this-Session-read());

-- no output just an empty cakephp layout without any content

any idea whats the problem ?


Thanks in advance..

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: redirect and sessions not working

2011-10-11 Thread majna


On Tuesday, October 11, 2011 11:10:55 AM UTC+2, cakii wrote:

 i, 

 i have a few problems i can't solve .. 

 im using cake 2.0.0-RC3 and PHP Version 5.3.1 
 cake default layout , debug 2 

 in my controller i only have one simple line: (the corresponding view 
 is completly empty) 

 $this-redirect('http://http://www.cakephpforum.net/'); 


This is invalid URL, but redirection is worknig
 



 but nothing happens, just a white page. 

 same with: 

 $this-redirect(array('controller' = 'test', 'action' = 'view')); 



 also i cant get the sessions working. 

 i have this line in my appcontroller: 

 public $components = array('Session'); 

 (is this line needed ? and/or anything else to use sessions? ) 

 
  No, Session is already attached to Controller (parent class)


 in my controller (extend appcontroller) the only 3 lines are: 


 echo $this-Session-check('lastVisit'); 
 $this-Session-write('lastVisit', time()); 
 echo $this-Session-check('lastVisit'); 
 debug($this-Session-read()); 

 
 Works for me in AppController::beforeFilter()
 


 -- no output just an empty cakephp layout without any content 

 any idea whats the problem ? 


You can try with latest 2.0 and clean app install to isolate just this 
problem (from other app code and config).
 



 Thanks in advance..

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: redirect and sessions not working

2011-10-11 Thread cakii
hmm, in my project just nothing happens, if i put my code in 
AppController::beforeFilter(), just an empty debug:
 *app\Controller\AppController.php* (line *14*)

for a clean app its enough to use latest download in another directory eg 
htdocs/test2, right ?!


in the meantime i had another strange problem:

call from CONTROLLER:
$this-Testmodel-id = 11;
$this-Testmodel-test();

MODEL:
$this-id = '11';
debug($this-find('first', array('fields' = array('ip1', 'ip2';

and the result from debug is:

[Testmodel] = Array
(
[ip1] = 1
[ip2] = 1
[id] = 0582ef53-f030-11e0-ad60-524e8fe2be12
)

but i though if i set id (i know, setting it one time - only in model or 
controller - SHOULD be enough..) id should not be generated, only if id is 
empty.
But id is set, if i debug it after the find call (the right one, 11 ..).
Of course there is data with id 11 in the database. 
The sql query from cakeph is : ... WHERE 1 = 1


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: redirect and sessions not working

2011-10-11 Thread majna


On Tuesday, October 11, 2011 2:23:42 PM UTC+2, cakii wrote:

 hmm, in my project just nothing happens, if i put my code in 
 AppController::beforeFilter(), just an empty debug:
  *app\Controller\AppController.php* (line *14*)

 for a clean app its enough to use latest download in another directory eg 
 htdocs/test2, right ?!


Yes, https://github.com/cakephp/cakephp/zipball/2.0
 



 in the meantime i had another strange problem:

 call from CONTROLLER:
 $this-Testmodel-id = 11;
 $this-Testmodel-test();

 MODEL:
 $this-id = '11';
 debug($this-find('first', array('fields' = array('ip1', 'ip2';


$this-find('first', array('conditions' = array('id'=11), 'fields' = 
array('ip1', 'ip2')));
should work. 
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html?highlight=find%20first#find-first

or

$this-id = 11;
$this-read(array('ip1', 'ip2'));


 and the result from debug is:

 [Testmodel] = Array
 (
 [ip1] = 1
 [ip2] = 1
 [id] = 0582ef53-f030-11e0-ad60-524e8fe2be12
 )

 You are using UUIDs for table primary key, read 
http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html?highlight=uuid#model-and-database-conventions
but referring ID's as integer
 


 but i though if i set id (i know, setting it one time - only in model or 
 controller - SHOULD be enough..) id should not be generated, only if id is 
 empty.
 But id is set, if i debug it after the find call (the right one, 11 ..).
 Of course there is data with id 11 in the database. 
 The sql query from cakeph is : ... WHERE 1 = 1




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: redirect and sessions not working

2011-10-11 Thread cakii


$this-find('first', array('conditions' = array('id'=11), 'fields' = 
 array('ip1', 'ip2')));
 should work. 
 http://book.cakephp.org/2.0/en/models/retrieving-your-data.html?highlight=find%20first#find-first

 or

 $this-id = 11;
 $this-read(array('ip1', 'ip2'));

 yes, both works


 You are using UUIDs for table primary key, read 
 http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html?highlight=uuid#model-and-database-conventions
 but referring ID's as integer

yes, the int 11 is old test data but thats not the problem here, i just 
thought FIND hast the same functionalty READ has, regarding ids:
By default, the currently selected record, as specified by Model::$id,
but i was wrong sorry..

thank you very much!
i'll make a clean project later and hopefully get the other problems solved, 
thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Sessions working on Local dev but not on server

2011-10-11 Thread JTiki
How can i check?

On Oct 11, 3:38 am, flo.kl...@googlemail.com
flo.kl...@googlemail.com wrote:
 Have you checked the db or filesystem if the session data is stored?
 You also have to have cookies enabled, othetwise the session cant be tracked.

 JTiki jeremyt...@gmail.com schrieb:

 I've recently been working on a project for a client. Its a simple E-
 Commerce site and I decided to use Sessions for the cart.

 I got everything set-up and working 100% on my local dev area, but for
 some reason when I went over to the server the sessions are not
 carrying...

 I set-up a test under the action where I add items to the cart (/
 mycart/add) and it is showing that the sessions are created and
 displays them correctly. However when refreshing the page, or going to
 a different page (like /mycart/) the session seems to be destroyed! I
 cannot figure this out... Can anyone help?

 I've set up an example below...
 Session just added and showing 
 up:http://country.tikiwebproductions.com/mycart/add/2
 Then move to another page and it 
 disappears:http://country.tikiwebproductions.com/mycart/other

 --
 Our newest site for the community: CakePHP Video 
 Tutorialshttp://tv.cakephp.org
 Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others 
 with their CakePHP related questions.

 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Sessions working on Local dev but not on server

2011-10-10 Thread JTiki
I've recently been working on a project for a client. Its a simple E-
Commerce site and I decided to use Sessions for the cart.

I got everything set-up and working 100% on my local dev area, but for
some reason when I went over to the server the sessions are not
carrying...

I set-up a test under the action where I add items to the cart (/
mycart/add) and it is showing that the sessions are created and
displays them correctly. However when refreshing the page, or going to
a different page (like /mycart/) the session seems to be destroyed! I
cannot figure this out... Can anyone help?

I've set up an example below...
Session just added and showing up:
http://country.tikiwebproductions.com/mycart/add/2
Then move to another page and it disappears:
http://country.tikiwebproductions.com/mycart/other

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Configuring sessions on Memcached/Membase with CakePHP 2.0RC2 - Getting errors

2011-10-07 Thread José Lorenzo
Yes, your configuration looks fine. I would not advise using memcache for 
the _core_ cache configuration, it is better to use APC, although it will 
still work fine and fast with memcache.

CakePHP does not cache find() calls, that is a task left for the developer.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Configuring sessions on Memcached/Membase with CakePHP 2.0RC2 - Getting errors

2011-10-06 Thread Chris Cinelli
I tried to set up sessions with memchaced and I am getting an error (plus
sessions do not seem to work).
I read :
https://github.com/cakephp/docs/blob/master/en/development/sessions.rst

It does not talk of session on memcached in specific but maybe adding it to
the doc would be good ;-)
I tested memcached communication with php and it is working.
Also with php sessions everything work well.

As specified in the doc I tried with

Configure::write('Session', array(
'defaults' = 'cache',
'handler' = array(
'config' = 'session'
)

   Cache::config('session', array(
 'engine' = 'Memcache', //[required]
 'duration'= 7200, //[optional]
 'probability'= 100, //[optional]
  'prefix' = Inflector::slug(APP_DIR) . '_', //[optional]  prefix
every cache file with this string
  'servers' = array(
  '127.0.0.1:11211' // localhost, default port 11211
  ), //[optional]
  'persistent' = true, // [optional] set this to false for
non-persistent connections
  'compress' = false, // [optional] compress data in Memcache
(slower, but uses less memory)
 ));

But I am getting this error:
Fatal error: Access to undeclared static property: App::$_classMap in
/var/www/html/lib/Cake/Core/App.php on line 556

I tried to eliminate Cache::config('session', array( ... )); and leave
Configure::write('Session', array('defaults' = 'cache', ..);  , just in
case, but the error is still there.

I haven't update to RC3 yet.  I am actually waiting fro the final.

Is it a bug or I am doing something wrong?

Best,
   Chris

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Configuring sessions on Memcached/Membase with CakePHP 2.0RC2 - Getting errors

2011-10-06 Thread José Lorenzo
That looks like a very odd error. What version of php are you using? can you 
paste the complete core.php file in the cakephp bin?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Configuring sessions on Memcached/Membase with CakePHP 2.0RC2 - Getting errors

2011-10-06 Thread José Lorenzo
I can confirm this bug, I'll keep you posted

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Configuring sessions on Memcached/Membase with CakePHP 2.0RC2 - Getting errors

2011-10-06 Thread José Lorenzo
The bug was fixed in lastest commit in cakephp repo. Thanks a lot for 
reporting it.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Configuring sessions on Memcached/Membase with CakePHP 2.0RC2 - Getting errors

2011-10-06 Thread Chris Cinelli
Thank you. Just to be sure... What I wrote here, is it the right way to set
up cakephp to use memcached for sessions?
Also if I set _core_ Cache to use memcached, is cakephp going to use
memcache to cache the -find calls?
On Oct 6, 2011 8:41 PM, José Lorenzo jose@gmail.com wrote:
 The bug was fixed in lastest commit in cakephp repo. Thanks a lot for
 reporting it.

 --
 Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


How do I setup CakePHP 1.3.11 to use database sessions?

2011-09-21 Thread carichardson
Hello,

I'm currently switching from php sessions to database sessions in
cakePHP 1.3.11. I used the command line to create the cake_sessions
database table. I've got the following in my core.php file:

Configure::write('Session.save', 'database');

Configure::write('Session.table', 'cake_sessions');

Configure::write('Session.database', 'default');

The cake_sessions table exists in the default database, but I never
see any data in that table. Sessions are still working, but I assume
Cake is still using php sessions. I've cleared cache, cookies, and
cake cache, still nothing in the cake_sessions table in the database.

Can somebody please point our what I'm doing wrong?  Any help would be
much appreciated.

Thank you kindly,

Chris

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How do I setup CakePHP 1.3.11 to use database sessions?

2011-09-21 Thread arron

 * [Note: Session.table is deprecated as of CakePHP 1.3]
 */
// so get rid of it Configure::write('Session.table',
'cake_sessions');

try this

Configure::write('Session.save', 'database');

Configure::write('Session.model', 'Session');


Configure::write('Session.database', 'default');

works for me


On Sep 21, 7:07 am, carichardson carichard...@gmail.com wrote:
 Hello,

 I'm currently switching from php sessions to database sessions in
 cakePHP 1.3.11. I used the command line to create the cake_sessions
 database table. I've got the following in my core.php file:

 Configure::write('Session.save', 'database');

 Configure::write('Session.table', 'cake_sessions');

 Configure::write('Session.database', 'default');

 The cake_sessions table exists in the default database, but I never
 see any data in that table. Sessions are still working, but I assume
 Cake is still using php sessions. I've cleared cache, cookies, and
 cake cache, still nothing in the cake_sessions table in the database.

 Can somebody please point our what I'm doing wrong?  Any help would be
 much appreciated.

 Thank you kindly,

 Chris

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Sessions Best Practice Question

2011-09-18 Thread WebbedIT
Using the session data is fine, but no need to put it as a hidden
field, in fact that's a bad idea as anyone could look at source and
see the users id or worse change their user id value with FireBug and
add items to another users account.

Just inject the user_id into $this-data in the controller before
saving.

HTH, Paul
@phpMagpie

On Sep 18, 4:35 am, Media Affect themediaaff...@gmail.com wrote:
 I am trying to determine the best way to grab out the signed in
 user_id for adding items to another belongsto table. Is it ok to use
 the session data for this?

 I could easily use this as a hidden field in the form data.
 $session-read('Auth.User.id') ?

 But, does this belong in a controller? What is the best and most
 secure way to do this?

 I have a Users table with id, name and password
 I have a Authors table with id, user_id, address, city, state, zip

 Users won't be able to access each others account data. So after
 baking the app I would remove the User.name dropdown.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Sessions Best Practice Question

2011-09-17 Thread Media Affect
I am trying to determine the best way to grab out the signed in
user_id for adding items to another belongsto table. Is it ok to use
the session data for this?

I could easily use this as a hidden field in the form data.
$session-read('Auth.User.id') ?

But, does this belong in a controller? What is the best and most
secure way to do this?

I have a Users table with id, name and password
I have a Authors table with id, user_id, address, city, state, zip

Users won't be able to access each others account data. So after
baking the app I would remove the User.name dropdown.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Auth, ACL, proxy server mixed up sessions?

2011-07-12 Thread olafrv
Hi,

The problems is due to Microsoft proxy server mixing up plan session
data.

I resolved the problems accesing my CakePHP Web Application only vía
SSL (HTTPS).

Best regards.-

On Jun 30, 9:19 am, olafrv ola...@gmail.com wrote:
 Hi,

 With the (public)http://futbol.olafrv.comCakePHP (1.3) application I
 have a similar problem described here:

 http://groups.google.com/group/cake-php/browse_thread/thread/4eb24c59...

 And cited here:

 I am having trouble with sessions and a proxy server. My site uses
 Auth and ACL and it works fine in all my testing. However, now someone
 with Microsoft Proxy server is using it and the sessions are getting
 mixed up - when one user logs in they sometimes get another users info
 (i.e. the sessions are confused).

 By the way:

 All over the Internet with other proxies and without proxies my app
 works fine.

 Any ideas?

 Regards.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Auth, ACL, proxy server mixed up sessions?

2011-06-30 Thread olafrv
Hi,

With the (public) http://futbol.olafrv.com CakePHP (1.3) application I
have a similar problem described here:

http://groups.google.com/group/cake-php/browse_thread/thread/4eb24c599fe3f7fd/578ac0b8d3406eff?lnk=gstq=proxy#578ac0b8d3406eff

And cited here:

I am having trouble with sessions and a proxy server. My site uses
Auth and ACL and it works fine in all my testing. However, now someone
with Microsoft Proxy server is using it and the sessions are getting
mixed up - when one user logs in they sometimes get another users info
(i.e. the sessions are confused).

By the way:

All over the Internet with other proxies and without proxies my app
works fine.

Any ideas?

Regards.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Cake PHP 1.3.7 Database Sessions- I'm Unable login?

2011-05-05 Thread GordonM81
I have updated my core.php to use 'database' sessions and can see upon
'login', the session row being written into the cake_session table.
However my session does not seem to authenticate and i get suck at a
login.ctp loop and therefore i am unable to access the restricted
views.

is there a bug with databse sessions/authenitcation in 1.3.7? Or am i
doing something wrong?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Sessions expiring with `Security.level` set to low and the `Session.timeout` set to 12000

2011-04-30 Thread Jeremy Burns | Class Outfit
There's not much info to go on here. Presumably you are using the Auth 
component and the user is logged in? If so, is the action she is trying to 
access allowed? Look in $this-Auth-allow in the controller (or app_controller 
is allowed actions have been set there).

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 30 Apr 2011, at 04:15, mattalexx wrote:

 My client is complaining that she posts a form and gets kicked to her
 login. I have the following code in `app/config/core.php`:
 
Configure::write('Session.timeout', '12000');
Configure::write('Security.level', 'low');
 
 Sessions should last 1,000 hours with these settings, right? So what
 else is going on?
 
 I realize that the client might be reporting the bug to me incorrectly
 and that there may be other factors involved, but I'm not even sure
 what to ask her about.
 
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
 
 
 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Sessions expiring with `Security.level` set to low and the `Session.timeout` set to 12000

2011-04-30 Thread Dave
Have you set it so CakePHP controls your sessions? The default is PHP,
and the session timeout is controlled in the PhP.ini for that one.

It took me a long time to work this one out!

On Apr 30, 4:15 am, mattalexx mattal...@gmail.com wrote:
 My client is complaining that she posts a form and gets kicked to her
 login. I have the following code in `app/config/core.php`:

     Configure::write('Session.timeout', '12000');
     Configure::write('Security.level', 'low');

 Sessions should last 1,000 hours with these settings, right? So what
 else is going on?

 I realize that the client might be reporting the bug to me incorrectly
 and that there may be other factors involved, but I'm not even sure
 what to ask her about.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Sessions expiring with `Security.level` set to low and the `Session.timeout` set to 12000

2011-04-29 Thread mattalexx
My client is complaining that she posts a form and gets kicked to her
login. I have the following code in `app/config/core.php`:

Configure::write('Session.timeout', '12000');
Configure::write('Security.level', 'low');

Sessions should last 1,000 hours with these settings, right? So what
else is going on?

I realize that the client might be reporting the bug to me incorrectly
and that there may be other factors involved, but I'm not even sure
what to ask her about.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Saving state between visits (waking sessions back up)

2011-04-17 Thread Greg Skerman
Ok so I want to do something which I would imagine should be fairly straight
forward with sessions, but can't for the life of me find documentation to
support it.

Basically I want to be able to store the cake Session token in a cookie,
then wake the session matching that cookie back up on a subsequent visit.

Imagine the following scenario (not precisely what I'm doing, but a good
illustration none the less).

User visits an online store, and puts a bunch of items in their shopping
cart.
User then decides to leave the store, without going through the checkout
Weeks later, the user revisits the store

I want to be able to grab the shopping basket that the user had already
filled (stored in the session when the visited), and wake the session back
up so they don't have to go and fill their basket back up with stuff again.

I get that I have to somehow store the session token in a cookie, but how do
i wake expired sessions back up so that the state matches what it was when
they left the store in the first place?

Help!?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Saving state between visits (waking sessions back up)

2011-04-17 Thread Ryan Schmidt

On Apr 17, 2011, at 01:03, Greg Skerman wrote:

 Basically I want to be able to store the cake Session token in a cookie, then 
 wake the session matching that cookie back up on a subsequent visit.
 
 Imagine the following scenario (not precisely what I'm doing, but a good 
 illustration none the less).
 
 User visits an online store, and puts a bunch of items in their shopping cart.
 User then decides to leave the store, without going through the checkout
 Weeks later, the user revisits the store
 
 I want to be able to grab the shopping basket that the user had already 
 filled (stored in the session when the visited), and wake the session back up 
 so they don't have to go and fill their basket back up with stuff again.
 
 I get that I have to somehow store the session token in a cookie, but how do 
 i wake expired sessions back up so that the state matches what it was when 
 they left the store in the first place?

Session ids are already stored as a cookie. That's standard PHP, and CakePHP 
uses it too. That's not the problem. The problem is sessions are temporary. 
Depending on the settings in your php.ini, a session might only last 20 minutes 
for example. You can change the session lifetime, but you probably don't want 
to increase it very much (certainly not more than a day, usually much less than 
that) since, depending on how busy your site is, you'll quickly end up with 
tons of sessions lying around taking up disk space that aren't actually being 
used by anyone.

You could store the cart in your database in some tables of your own creation. 
Store that with the user id so you can bring it back when the user logs in 
again. If you're allowing unregistered (or not-logged-in) users to put things 
in a cart, and you want to save those too, then you'll probably have to store 
the cart based on some unique id you invent, and store that unique id in a 
longer-lived cookie. Then again, you're running into the same problem as a 
longer-lived session...


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Saving state between visits (waking sessions back up)

2011-04-17 Thread Yuka Poppe
Hi Greg, Ryan,

On Apr 17, 2011, at 01:03, Greg Skerman wrote:
 User visits an online store, and puts a bunch of items in their shopping cart.
 User then decides to leave the store, without going through the checkout
 Weeks later, the user revisits the store

Take a look at the builtin Session component, from your controller,
$this-Session-read('cart'); and $this-Session-write('cart',
$cart); is what you're looking for. Like ryan mentioned php and thus
cake already does this by default.

On Sun, Apr 17, 2011 at 8:43 AM, Ryan Schmidt
google-2...@ryandesign.com wrote:
 you'll quickly end up with tons of sessions lying around taking up disk space 
 that aren't actually being used by anyone.

Increase the session time as you see fit (to a responsible extent),
session storage eats up minor storage. Depending on server setup, they
usually become stale and stay around anyway, even if they are struck
in /tmp, servers arent meant to reboot ;-) Not something you want to
rely on as a developer. That means that the shorter the lifespan of a
session, the quicker new sessions are created and thus you'll have
more garbage then when you increase the expiry date and keep them
around longer, as they are reused more often. Also, most modern
session implementations automaticly generate the session as a security
measure, also resulting in stale sessions left around. You really
should implement session cleanup at regular intervals.

I usually store my sessions in memcache, its faster, its distributed,
and cleans up after itself.

Regards, Yuka

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Saving state between visits (waking sessions back up)

2011-04-17 Thread cricket
On Sun, Apr 17, 2011 at 2:03 AM, Greg Skerman gsker...@gmail.com wrote:
 Ok so I want to do something which I would imagine should be fairly straight
 forward with sessions, but can't for the life of me find documentation to
 support it.

 Basically I want to be able to store the cake Session token in a cookie,
 then wake the session matching that cookie back up on a subsequent visit.

 Imagine the following scenario (not precisely what I'm doing, but a good
 illustration none the less).

 User visits an online store, and puts a bunch of items in their shopping
 cart.
 User then decides to leave the store, without going through the checkout
 Weeks later, the user revisits the store

 I want to be able to grab the shopping basket that the user had already
 filled (stored in the session when the visited), and wake the session back
 up so they don't have to go and fill their basket back up with stuff again.

 I get that I have to somehow store the session token in a cookie, but how do
 i wake expired sessions back up so that the state matches what it was when
 they left the store in the first place?

It's not the session that you want to revive, exactly. A session is
simply some way to save state between page views. In your example that
includes the items that have been added to the cart but that's not the
entirety of the session. In any case, all you want is to get the list
of items chosen. A shopping cart can be as simple as serializing the
item IDs in the session cookie or more complicated, like storing them
in a carts table. Or even the complete item record in a separate
cart_items table, one row for each item. The latter has the benefit
that you need only fetch the records from cart_items, rather then get
the IDs, then make another find on the items table. Probably it would
be fine to just serialize the IDs in the carts table, though.

So you create a SHA1 token (CHAR(40) for your carts table) for each
cart and save that to the session, eg.
$this-Session-write('Cart.token', '...'). But you also write it to a
separate, long-lived cookie (called, eg. CartToken). Each time a user
visits the site, if they have an empty session you look for the
CartToken cookie. If it exists, find the cart record using the token.
If that exists, write the token to the session again.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Saving state between visits (waking sessions back up)

2011-04-17 Thread Greg Skerman
Thanks guys, that makes sense...
Wasn't entirely sure if sessions were the way to go or not...

one question Cricket, if the token is in a long lived cookie, why write just
the token to the session? isn't checking both a little redundant? that is
the token itself, not the rest of the data stored in the session...



On Mon, Apr 18, 2011 at 5:51 AM, cricket zijn.digi...@gmail.com wrote:

 On Sun, Apr 17, 2011 at 2:03 AM, Greg Skerman gsker...@gmail.com wrote:
  Ok so I want to do something which I would imagine should be fairly
 straight
  forward with sessions, but can't for the life of me find documentation to
  support it.
 
  Basically I want to be able to store the cake Session token in a cookie,
  then wake the session matching that cookie back up on a subsequent visit.
 
  Imagine the following scenario (not precisely what I'm doing, but a good
  illustration none the less).
 
  User visits an online store, and puts a bunch of items in their shopping
  cart.
  User then decides to leave the store, without going through the checkout
  Weeks later, the user revisits the store
 
  I want to be able to grab the shopping basket that the user had already
  filled (stored in the session when the visited), and wake the session
 back
  up so they don't have to go and fill their basket back up with stuff
 again.
 
  I get that I have to somehow store the session token in a cookie, but how
 do
  i wake expired sessions back up so that the state matches what it was
 when
  they left the store in the first place?

 It's not the session that you want to revive, exactly. A session is
 simply some way to save state between page views. In your example that
 includes the items that have been added to the cart but that's not the
 entirety of the session. In any case, all you want is to get the list
 of items chosen. A shopping cart can be as simple as serializing the
 item IDs in the session cookie or more complicated, like storing them
 in a carts table. Or even the complete item record in a separate
 cart_items table, one row for each item. The latter has the benefit
 that you need only fetch the records from cart_items, rather then get
 the IDs, then make another find on the items table. Probably it would
 be fine to just serialize the IDs in the carts table, though.

 So you create a SHA1 token (CHAR(40) for your carts table) for each
 cart and save that to the session, eg.
 $this-Session-write('Cart.token', '...'). But you also write it to a
 separate, long-lived cookie (called, eg. CartToken). Each time a user
 visits the site, if they have an empty session you look for the
 CartToken cookie. If it exists, find the cart record using the token.
 If that exists, write the token to the session again.

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Saving state between visits (waking sessions back up)

2011-04-17 Thread cricket
On Sun, Apr 17, 2011 at 11:02 PM, Greg Skerman gsker...@gmail.com wrote:
 Thanks guys, that makes sense...
 Wasn't entirely sure if sessions were the way to go or not...

 one question Cricket, if the token is in a long lived cookie, why write just
 the token to the session? isn't checking both a little redundant? that is
 the token itself, not the rest of the data stored in the session...

No, because they each serve different purposes. Better, I think, to
check the session between page requests, and the CartToken cookie
between vists.

At checkout time, you'd delete the CartToken cookie. You'd also
probably add some flag to the carts table once its been paid for.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Setting cookies or sessions in afterFilter()

2011-01-21 Thread popcorn
Hi

There seems to be a problem setting cookies or sessions in the
afterFilter().

I have selected controller/action combinations making use of the
afterFilter() in order to set a cookie. If you then go another page
that doesn't use the afterFilter() and try to read the cookie, no
problem. However, refresh that page and the cookie is gone. Exactly
the same problem with sessions.

I've made heavy use of the cookie and session components over the
years and this is clearly an isolated scenario.

Can anyone more familiar with the core confirm or deny this is normal
before I try to work out what's happening please?


Cheers


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How to manipulate cakephp's sessions table with sql

2010-12-01 Thread nightshadex101
Have you had any luck? I'm trying to do the same, and I'n not able to
delete row even with $this-Online-query()...

On Nov 25, 3:08 pm, Ish ish1...@gmail.com wrote:
 Hi Folks,

 I am using storing user sessions in database table sessions , and
 trying to manipulate (edit or delete) the sessions table from admin
 panel controls.

 // controllers/OnlinesController.php
 // e.g. $id = 'bk86c9argtdlqv7t12g8a0ugf6'
 $this-Online-delete($id); // doesn't work
 //
 // $this-Online-find('all'); // read operations work fine

 It's not letting me do that, anybody know's why ?

 In my core.php configurations, I have

 // config/core.php
 Configure::write('Session.save', 'database');
 Configure::write('Session.model', 'Session');
 Configure::write('Session.table', 'sessions');
 Configure::write('Session.database', 'default');
 Configure::write('Session.cookie', 'CAKEPHP');
 Configure::write('Session.timeout', '144');
 Configure::write('Session.start', true);
 Configure::write('Session.checkAgent', true);
 Configure::write('Security.level', 'medium');

 I have separate model Online to handle operations to sessions table.

 // models/online.php
 var $useTable = 'sessions';

 Any help is greatly appreciated
 - Thanks

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


How to manipulate cakephp's sessions table with sql

2010-11-26 Thread Ish
Hi Folks,


I am using storing user sessions in database table sessions , and
trying to manipulate (edit or delete) the sessions table from admin
panel controls.


// controllers/OnlinesController.php
// e.g. $id = 'bk86c9argtdlqv7t12g8a0ugf6'
$this-Online-delete($id); // doesn't work
//
// $this-Online-find('all'); // read operations work fine



It's not letting me do that, anybody know's why ?


In my core.php configurations, I have


// config/core.php
Configure::write('Session.save', 'database');
Configure::write('Session.model', 'Session');
Configure::write('Session.table', 'sessions');
Configure::write('Session.database', 'default');
Configure::write('Session.cookie', 'CAKEPHP');
Configure::write('Session.timeout', '144');
Configure::write('Session.start', true);
Configure::write('Session.checkAgent', true);
Configure::write('Security.level', 'medium');



I have separate model Online to handle operations to sessions table.


// models/online.php
var $useTable = 'sessions';



Any help is greatly appreciated
- Thanks

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: Sessions and http/https

2010-10-25 Thread dtemes
Thats another option, and by doing that you don't have to touch the
core code, I will take a look at it before upgrading to 1.3.5...


On 24 oct, 14:23, odd fihr87364hjkfhdjf6374hfz7z3h7...@trash-
mail.com wrote:
 dtemes schrieb:

  I tryed with a custom save handler, but then i moved to database
  driver sessions, so finally I decided to touch the cake core code
   and set session.cookie_secure to 0, I am not really fond of this kind
  of solutions and would prefer a way to set it up from a config file
  without having to change the framework code.

 Not sure what you mean, when using a custom save handler you can
 simply copy the core code in there, and add the ini_set call that
 sets cookie_secure to 0. So when using database sessions copy the
 code in database switch case (cake_session.php, line 503)

 ///
 if (empty($_SESSION)) {
         if (Configure::read('Session.model') === null) {
                 trigger_error(__(You must set the all 
 Configure::write('Session.*')
 in core.php to use database storage), E_USER_WARNING);
                 $this-_stop();
         }
         if ($iniSet) {
                 ini_set('session.use_trans_sid', 0);
                 ini_set('url_rewriter.tags', '');
                 ini_set('session.save_handler', 'user');
                 ini_set('session.serialize_handler', 'php');
                 ini_set('session.use_cookies', 1);
                 ini_set('session.name', Configure::read('Session.cookie'));
                 ini_set('session.cookie_lifetime', $this-cookieLifeTime);
                 ini_set('session.cookie_path', $this-path);
                 ini_set('session.auto_start', 0);
         }}

 session_set_save_handler(
         array('CakeSession','__open'),
         array('CakeSession', '__close'),
         array('CakeSession', '__read'),
         array('CakeSession', '__write'),
         array('CakeSession', '__destroy'),
         array('CakeSession', '__gc')
 );

 ini_set('session.cookie_secure', 0);
 ///

 Regards

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: Sessions and http/https

2010-10-24 Thread odd
dtemes schrieb:
 I tryed with a custom save handler, but then i moved to database
 driver sessions, so finally I decided to touch the cake core code
  and set session.cookie_secure to 0, I am not really fond of this kind
 of solutions and would prefer a way to set it up from a config file
 without having to change the framework code.


Not sure what you mean, when using a custom save handler you can
simply copy the core code in there, and add the ini_set call that
sets cookie_secure to 0. So when using database sessions copy the
code in database switch case (cake_session.php, line 503)

///
if (empty($_SESSION)) {
if (Configure::read('Session.model') === null) {
trigger_error(__(You must set the all 
Configure::write('Session.*')
in core.php to use database storage), E_USER_WARNING);
$this-_stop();
}
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('url_rewriter.tags', '');
ini_set('session.save_handler', 'user');
ini_set('session.serialize_handler', 'php');
ini_set('session.use_cookies', 1);
ini_set('session.name', Configure::read('Session.cookie'));
ini_set('session.cookie_lifetime', $this-cookieLifeTime);
ini_set('session.cookie_path', $this-path);
ini_set('session.auto_start', 0);
}
}
session_set_save_handler(
array('CakeSession','__open'),
array('CakeSession', '__close'),
array('CakeSession', '__read'),
array('CakeSession', '__write'),
array('CakeSession', '__destroy'),
array('CakeSession', '__gc')
);

ini_set('session.cookie_secure', 0);
///

Regards

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: Sessions and http/https

2010-10-23 Thread odd
Maybe the session.cookie_secure option is set to true/1 by default
in your PHP configuration (see php.ini), so uncommenting that line in
cakes session class wont have any effect. Or maybe you have some PHP
extension installed that automatically chooses to secure the cookie.

Instead of uncommenting that line, try changing it to set the option
to 0 and see if it makes any difference. If it works you'd probably
better do that using a custom session save handler.

Regards

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: Sessions and http/https

2010-10-23 Thread dtemes
I tryed with a custom save handler, but then i moved to database
driver sessions, so finally I decided to touch the cake core code
 and set session.cookie_secure to 0, I am not really fond of this kind
of solutions and would prefer a way to set it up from a config file
without having to change the framework code.



On 23 oct, 12:03, odd fihr87364hjkfhdjf6374hfz7z3h7...@trash-
mail.com wrote:
 Maybe the session.cookie_secure option is set to true/1 by default
 in your PHP configuration (see php.ini), so uncommenting that line in
 cakes session class wont have any effect. Or maybe you have some PHP
 extension installed that automatically chooses to secure the cookie.

 Instead of uncommenting that line, try changing it to set the option
 to 0 and see if it makes any difference. If it works you'd probably
 better do that using a custom session save handler.

 Regards

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


Sessions and http/https

2010-10-22 Thread Jeremy Burns
I can see lots of activity on this subject, but no clear working
answer; so excuse me if it's a broken record.

My users log in via an https page. They are logged in and the Auth
session variable is set. If they now go to an http page I would expect
them to still be logged in, but they are not.

I have this line:
Configure::write('Session.cookie_secure', false);
...in /app/config/core.php, but it doesn't change anything.

I have seen references to commenting out this line:
ini_set('session.cookie_secure', 1);
...in cake/libs/cake_session.php, but equally this has no effect.

What's clearly happening is that the session is secured and is only
available from within https pages.

How do I get a session that is accessible on both http and https pages?

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: CakePHP 1.3.4 Stable - Weird problem with sessions! HELP!

2010-10-14 Thread and


On 12 Okt., 15:04, 浪漫様 rohmand...@gmail.com wrote:
 In a normal world, the following code would work... you receive a
 variable on your function, and you save it on a session, then the next
 page is able to read it ( the SET is just to display it on the
 views )... however, in CakePHP 1.3.4 Stable seems to fail, i can see
 the variable on the initial function [ browse ], but is empty in the
 following function [ display ]

 function browse($variable) {
   $this-Session-write('mysession.variable', $variable);
   $this-set('variable', $variable);

 } // function: browse

 function display() {
   $this-set('variable', $this-Session-read('mysession.variable'));

 } // function: display

 More funny is that the following code DOES WORK:

 function browse() {
   $variable = 5;
   $this-Session-write('mysession.variable', $variable);
   $this-set('variable', $variable);

 } // function: browse

 function display() {
   $this-set('variable', $this-Session-read('mysession.variable'));

 } // function: display

 So seems the problem i'm experiencing is only with the variable you
 get through the functions parameters... anyone has a clue on what's
 going on? is driving me crazy and it makes no fuc*ing sense. I didn't
 seem to experience that behavior on CakePHP 1.2 though.
 thanks

 Rohman

what does your router say? you probably should use something like:

Router::connect('browser/:VAR', array('plugin' = '', 'controller' =
'yours', 'action' = 'browse', VAR);

i had lot's of problems without using the acronyms after the actions.
i have no idea why but with this router configuration it always worked.

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: CakePHP 1.3.4 Stable - Weird problem with sessions! HELP!

2010-10-13 Thread dtemes
what backend are you using for your sessions? I had similar issues
while working with database stored sessions, but using cake or php
sessions works fine.

On 12 oct, 20:52, cricket zijn.digi...@gmail.com wrote:
 On Tue, Oct 12, 2010 at 9:19 AM, 浪漫様 rohmand...@gmail.com wrote:
  no, i'm on HTTP only : )
  and the sessions works fine, the only problem is when using the
  $variable from the controller's function... then it turns to be empty.
  thanks

 And you can see the variable from the browse view? Are you certain
 that browse() is being passed a param?

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: CakePHP 1.3.4 Stable - Weird problem with sessions! HELP!

2010-10-13 Thread huoxito
Are you passing the $variable trough the url?

If so, Instead of using $variable try using this $this-params['pass']
[0] on the browser function:

It would be like:

function browse($variable) {
  $this-Session-write('mysession.variable', $this-params['pass']
[0]);
  $this-set('variable', $variable);
}

Also make sure that the param is passed through the url 


On 13 out, 03:22, dtemes dte...@gmail.com wrote:
 what backend are you using for your sessions? I had similar issues
 while working with database stored sessions, but using cake or php
 sessions works fine.

 On 12 oct, 20:52, cricket zijn.digi...@gmail.com wrote:



  On Tue, Oct 12, 2010 at 9:19 AM, 浪漫様 rohmand...@gmail.com wrote:
   no, i'm on HTTP only : )
   and the sessions works fine, the only problem is when using the
   $variable from the controller's function... then it turns to be empty.
   thanks

  And you can see the variable from the browse view? Are you certain
  that browse() is being passed a param?

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


CakePHP 1.3.4 Stable - Weird problem with sessions! HELP!

2010-10-12 Thread 浪漫様
In a normal world, the following code would work... you receive a
variable on your function, and you save it on a session, then the next
page is able to read it ( the SET is just to display it on the
views )... however, in CakePHP 1.3.4 Stable seems to fail, i can see
the variable on the initial function [ browse ], but is empty in the
following function [ display ]

function browse($variable) {
  $this-Session-write('mysession.variable', $variable);
  $this-set('variable', $variable);
} // function: browse

function display() {
  $this-set('variable', $this-Session-read('mysession.variable'));
} // function: display

More funny is that the following code DOES WORK:

function browse() {
  $variable = 5;
  $this-Session-write('mysession.variable', $variable);
  $this-set('variable', $variable);
} // function: browse

function display() {
  $this-set('variable', $this-Session-read('mysession.variable'));
} // function: display

So seems the problem i'm experiencing is only with the variable you
get through the functions parameters... anyone has a clue on what's
going on? is driving me crazy and it makes no fuc*ing sense. I didn't
seem to experience that behavior on CakePHP 1.2 though.
thanks

Rohman

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: CakePHP 1.3.4 Stable - Weird problem with sessions! HELP!

2010-10-12 Thread Jeremy Burns | Class Outfit
Are you using https?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 12 Oct 2010, at 14:04, 浪漫様 wrote:

 In a normal world, the following code would work... you receive a
 variable on your function, and you save it on a session, then the next
 page is able to read it ( the SET is just to display it on the
 views )... however, in CakePHP 1.3.4 Stable seems to fail, i can see
 the variable on the initial function [ browse ], but is empty in the
 following function [ display ]
 
 function browse($variable) {
  $this-Session-write('mysession.variable', $variable);
  $this-set('variable', $variable);
 } // function: browse
 
 function display() {
  $this-set('variable', $this-Session-read('mysession.variable'));
 } // function: display
 
 More funny is that the following code DOES WORK:
 
 function browse() {
  $variable = 5;
  $this-Session-write('mysession.variable', $variable);
  $this-set('variable', $variable);
 } // function: browse
 
 function display() {
  $this-set('variable', $this-Session-read('mysession.variable'));
 } // function: display
 
 So seems the problem i'm experiencing is only with the variable you
 get through the functions parameters... anyone has a clue on what's
 going on? is driving me crazy and it makes no fuc*ing sense. I didn't
 seem to experience that behavior on CakePHP 1.2 though.
 thanks
 
 Rohman
 
 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

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: CakePHP 1.3.4 Stable - Weird problem with sessions! HELP!

2010-10-12 Thread 浪漫様
no, i'm on HTTP only : )
and the sessions works fine, the only problem is when using the
$variable from the controller's function... then it turns to be empty.
thanks

Rohman

On Oct 12, 9:16 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 Are you using https?

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 12 Oct 2010, at 14:04, 浪漫様 wrote:



  In a normal world, the following code would work... you receive a
  variable on your function, and you save it on a session, then the next
  page is able to read it ( the SET is just to display it on the
  views )... however, in CakePHP 1.3.4 Stable seems to fail, i can see
  the variable on the initial function [ browse ], but is empty in the
  following function [ display ]

  function browse($variable) {
   $this-Session-write('mysession.variable', $variable);
   $this-set('variable', $variable);
  } // function: browse

  function display() {
   $this-set('variable', $this-Session-read('mysession.variable'));
  } // function: display

  More funny is that the following code DOES WORK:

  function browse() {
   $variable = 5;
   $this-Session-write('mysession.variable', $variable);
   $this-set('variable', $variable);
  } // function: browse

  function display() {
   $this-set('variable', $this-Session-read('mysession.variable'));
  } // function: display

  So seems the problem i'm experiencing is only with the variable you
  get through the functions parameters... anyone has a clue on what's
  going on? is driving me crazy and it makes no fuc*ing sense. I didn't
  seem to experience that behavior on CakePHP 1.2 though.
  thanks

  Rohman

  Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
  athttp://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: CakePHP 1.3.4 Stable - Weird problem with sessions! HELP!

2010-10-12 Thread cricket
On Tue, Oct 12, 2010 at 9:19 AM, 浪漫様 rohmand...@gmail.com wrote:
 no, i'm on HTTP only : )
 and the sessions works fine, the only problem is when using the
 $variable from the controller's function... then it turns to be empty.
 thanks

And you can see the variable from the browse view? Are you certain
that browse() is being passed a param?

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


Delete Sessions

2010-10-08 Thread Dave Maharaj
How do you delete sessions in the db based on user? 

I only want to allow each user to be logged in from 1 location at a time. 

So 1 user can not share their account info allowing multiple user access
under 1 account simultaneously.

 

So User1 logs in, another person (User2)logs in with User1 credentials then
delete all active sessions except for the last person who logged in. So when
User2 logs delete all other session(s) associated with User1 credentials.

 

Any ideas?

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


Invalid argument supplied for foreach() , when i use sessions

2010-07-28 Thread Tomfox Wiranata
hi everyone,

i write data in a session, which works perfectly well. but when i try
to loop through it with foreach the error appears

Invalid argument supplied for foreach()

i figured that only arrays can be looped. here is what i did:

filling the session:

$input_title = $this-data['Linkable']['notes'];
$this-Session-write('Linkable.title', $input_title);


setting:
$this-set('linkables', $this-Session-
read('Linkable.title'));


trying to echo data from my session in my view:

?php
foreach ($linkables as $linkable):
endforeach;
?

span id=data?php echo $linkable['linkable.title']; ?/span

what did i do wrong? i thought with $this-Session-
write('Linkable.title', $input_title); i already created an array?

i appreciate your help. as always ;)

thx

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: Invalid argument supplied for foreach() , when i use sessions

2010-07-28 Thread cricket
On Wed, Jul 28, 2010 at 1:17 PM, Tomfox Wiranata
tomfox.wiran...@gmail.com wrote:
 hi everyone,

 i write data in a session, which works perfectly well. but when i try
 to loop through it with foreach the error appears

 Invalid argument supplied for foreach()

 i figured that only arrays can be looped. here is what i did:

 filling the session:

        $input_title = $this-data['Linkable']['notes'];
        $this-Session-write('Linkable.title', $input_title);


 setting:
        $this-set('linkables', $this-Session-
read('Linkable.title'));


 trying to echo data from my session in my view:

 ?php
                foreach ($linkables as $linkable):
                endforeach;
 ?

You have an empty loop there.

 span id=data?php echo $linkable['linkable.title']; ?/span

 what did i do wrong? i thought with $this-Session-
write('Linkable.title', $input_title); i already created an array?

What does debug($linkables) show?

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: Invalid argument supplied for foreach() , when i use sessions

2010-07-28 Thread Tomfox Wiranata
cricket..thx for your help...the loop was empty as far as i could
tell...works now :)

 i appreciate it...

but i have sth else making me nuts.

when i echo data, it automatically makes a break with p and prints
the text into the next line...so my echo code is this in html:
span class=datapdesc/p/span

how can i make this p go away? cause my text wont appear where i
want it to be...i wanna print text without making a break

On 28 Jul., 20:03, cricket zijn.digi...@gmail.com wrote:
 On Wed, Jul 28, 2010 at 1:17 PM, Tomfox Wiranata



 tomfox.wiran...@gmail.com wrote:
  hi everyone,

  i write data in a session, which works perfectly well. but when i try
  to loop through it with foreach the error appears

  Invalid argument supplied for foreach()

  i figured that only arrays can be looped. here is what i did:

  filling the session:

         $input_title = $this-data['Linkable']['notes'];
         $this-Session-write('Linkable.title', $input_title);

  setting:
         $this-set('linkables', $this-Session-
 read('Linkable.title'));

  trying to echo data from my session in my view:

  ?php
                 foreach ($linkables as $linkable):
                 endforeach;
  ?

 You have an empty loop there.

  span id=data?php echo $linkable['linkable.title']; ?/span

  what did i do wrong? i thought with $this-Session-
 write('Linkable.title', $input_title); i already created an array?

 What does debug($linkables) show?

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: Invalid argument supplied for foreach() , when i use sessions

2010-07-28 Thread Tomfox Wiranata
so that is my original php code
span class=data?php echo $linkables_desc; ?/span

it turns into

span class=datapdesc/p/span

On 28 Jul., 20:33, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 cricket..thx for your help...the loop was empty as far as i could
 tell...works now :)

  i appreciate it...

 but i have sth else making me nuts.

 when i echo data, it automatically makes a break with p and prints
 the text into the next line...so my echo code is this in html:
 span class=datapdesc/p/span

 how can i make this p go away? cause my text wont appear where i
 want it to be...i wanna print text without making a break

 On 28 Jul., 20:03, cricket zijn.digi...@gmail.com wrote:

  On Wed, Jul 28, 2010 at 1:17 PM, Tomfox Wiranata

  tomfox.wiran...@gmail.com wrote:
   hi everyone,

   i write data in a session, which works perfectly well. but when i try
   to loop through it with foreach the error appears

   Invalid argument supplied for foreach()

   i figured that only arrays can be looped. here is what i did:

   filling the session:

          $input_title = $this-data['Linkable']['notes'];
          $this-Session-write('Linkable.title', $input_title);

   setting:
          $this-set('linkables', $this-Session-
  read('Linkable.title'));

   trying to echo data from my session in my view:

   ?php
                  foreach ($linkables as $linkable):
                  endforeach;
   ?

  You have an empty loop there.

   span id=data?php echo $linkable['linkable.title']; ?/span

   what did i do wrong? i thought with $this-Session-
  write('Linkable.title', $input_title); i already created an array?

  What does debug($linkables) show?

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: Invalid argument supplied for foreach() , when i use sessions

2010-07-28 Thread cricket
On Wed, Jul 28, 2010 at 2:33 PM, Tomfox Wiranata
tomfox.wiran...@gmail.com wrote:
 cricket..thx for your help...the loop was empty as far as i could
 tell...works now :)

  i appreciate it...

 but i have sth else making me nuts.

 when i echo data, it automatically makes a break with p and prints
 the text into the next line...so my echo code is this in html:
 span class=datapdesc/p/span

 how can i make this p go away? cause my text wont appear where i
 want it to be...i wanna print text without making a break

You must already have the text wrapped in P tags. Maybe whatever
you're using to enter the text into the DB is adding them. If you
debug the data, you likely won't see the p/p because the browser
will interpret them. Look at the data directly through a terminal
session or do something like (in the controller):

header('Content-type: text/plain');
die(debug($data));

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: debugging database sessions in cake 1.3.1

2010-07-17 Thread phpdeve
Hi,

I have even strange issue with session database. I have exactly same
configuration as mentioned here. My issue is that the sessions are
stored on both /tmp and the database cake_sessions table. Any idea how
to prevent storing session data in tmp folder?

On Jun 22, 1:38 pm, dtemes dte...@gmail.com wrote:
 bump, seems that nobody is having issues with sessions stored in
 database?

 On 18 jun, 09:44, dtemes dte...@gmail.com wrote:

  More information about the issue, since the database session uses a
  model to handle the reading/writing I inserted some lines to log data
  in model.php beforeSave function. The result is that almost after
  every call to session-Write I see two lines in the log files,
  beforeSave is being called twice!!

  Lets say I have a varible named myvar that I increment from 2 to 3,
  then  I see it's trying to save the session model twice, onw with the
  value myvar=3 and other with myvar=2. Sometimes it writes the correct
  value twice. There is only one action that writes that session
  variable. I thought it could be a cahce issue, but with caching
  disabled I get the same wrong results.

  regards

  On 18 jun, 00:10, dtemes dte...@gmail.com wrote:

   I have a strange issue with sessions while using database to store
   them, in some cases the session data is not being updated after a
   $this-Session-write.

   I put some $this-log() calls in the cake_sessions.php library file and
   the write function returns true but a mysql query shows the old value.
   I have tried to add some logging in the __write function that updates
   the session model but using $this-log is not possible in the write
   handler.

   On the other hand I can see some messages in the error log:

   2010-06-17 22:57:41 Warning: Warning (2): Cannot unset offset in a non-
   array variable in [/var/www/clients/client1/web15/cakephp-cakephp-
   f9c1d47/cake/libs/model/model.php, line 1285]
   2010-06-17 22:57:41 Warning: Warning (2): Invalid argument supplied
   for foreach() in [/var/www/clients/client1/web15/cakephp-cakephp-
   f9c1d47/cake/libs/model/model.php, line 1289]

   this does not happen if using php or cake sessions. Here are my cake
   settings:

   Configure::write('Session.save', 'database');
   Configure::write('Session.model', 'Session');
   Configure::write('Session.table', 'cake_sessions');
   Configure::write('Session.database', 'default');
   Configure::write('Session.cookie', 'ASDASDASD234234');
   Configure::write('Session.timeout', '120');
   Configure::write('Session.start', true);

   To make things even more difficult the problematic actions are called
   from within a flash application and return xml.

   Any hints to help me debug the issue will be appreciated

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


  1   2   3   4   5   >