Re: How to access Cake Session Variables from a Stand Alone PHP script
We have hybrid legacy application/cake application and do this frequently. Here's how I do it: In my core.php: define('CAKE_SESSION_SAVE', 'php'); define('CAKE_SESSION_COOKIE', 'PHPSESSID'); #This is the default PHP cookie name, if you changed the default make this match define('CAKE_SECURITY', 'medium'); # We were having probelms with cake constantly regenerating the cookie. This stops that. In the legacy apps just call session_start() I think setting session_name to that string in the core.php file is a mistake. We don't do that. Setting CAKE_SESSION_COOKIE is sufficient for php to find the cookie that has the session id of the session store. Good luck. Integrating legacy code with cake code can be tricky, but it can be done. On May 7, 3:50 am, "bharath kumar" <[EMAIL PROTECTED]> wrote: > Hi All, > > Can anyone letme know, how to access the cakesession variables from a stand > alone script. I have tried something like this and its not working. I have > placed php script directly under var/www/html/test.php and and cake > application under var/www/html/vhosts/cakeexample. > > session_name('DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'); //random > string of used in session.this is set in core.php > session_start(); > if(empty($_SESSION['CURRENT_USER'])) > { > $_SESSION['loggedin'] = 1; > echo 'OK!';} > > else { > echo 'Not okay'; > } > ?> > > once if i login to my application and and try to run this script, i still > get Not Okay, that i am unable to access the cake's session variables. In > Core.php i have set define('CAKE_SESSION_SAVE', 'php'); > > Does anyone know how can we access the session variables from this > standalone script. I think i have missed out something in php script or need > to add/edit in core.php file. > > It would be very helpful , if anyone has a solution for this. > > Thanks in Advance > Bharath kumar --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to access Cake Session Variables from a Stand Alone PHP script
Well providing your are starting your session and using the same session id, then you should be able to access CURRENT_USER. I am not sure if this will work with database sessions. -Erik On May 8, 2:11 am, "bharath kumar" <[EMAIL PROTECTED]> wrote: > Hi Sliv, > > In Login controller i have set the user details using this line. > $this->Session->write('CURRENT_USER', $someone['User']); > > and in the php script, which is oustside the cake directory, i am trying to > use the CURRENT_USER in the php script using $_SESSION. which i couldn > access > > On Thu, May 8, 2008 at 11:23 AM, Lakshmi <[EMAIL PROTECTED]> wrote: > > > -- Forwarded message ------ > > From: Sliv <[EMAIL PROTECTED]> > > Date: May 7, 2008 6:08 PM > > Subject: Re: How to access Cake Session Variables from a Stand Alone > > PHP script > > To: CakePHP > > > What variables are you trying to access that are not available through > > $_SESSION? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to access Cake Session Variables from a Stand Alone PHP script
Hi Sliv, In Login controller i have set the user details using this line. $this->Session->write('CURRENT_USER', $someone['User']); and in the php script, which is oustside the cake directory, i am trying to use the CURRENT_USER in the php script using $_SESSION. which i couldn access On Thu, May 8, 2008 at 11:23 AM, Lakshmi <[EMAIL PROTECTED]> wrote: > > > -- Forwarded message -- > From: Sliv <[EMAIL PROTECTED]> > Date: May 7, 2008 6:08 PM > Subject: Re: How to access Cake Session Variables from a Stand Alone > PHP script > To: CakePHP > > > What variables are you trying to access that are not available through > $_SESSION? > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to access Cake Session Variables from a Stand Alone PHP script
What variables are you trying to access that are not available through $_SESSION? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to access Cake Session Variables from a Stand Alone PHP script
Hi All, Can anyone letme know, how to access the cakesession variables from a stand alone script. I have tried something like this and its not working. I have placed php script directly under var/www/html/test.php and and cake application under var/www/html/vhosts/cakeexample. once if i login to my application and and try to run this script, i still get Not Okay, that i am unable to access the cake's session variables. In Core.php i have set define('CAKE_SESSION_SAVE', 'php'); Does anyone know how can we access the session variables from this standalone script. I think i have missed out something in php script or need to add/edit in core.php file. It would be very helpful , if anyone has a solution for this. Thanks in Advance Bharath kumar --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---