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.
>
> <?php
> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---