Why don't you use Cake's session messaging?
controller:
$this->Session->setFlash('...');
$this->redirect(array(...));
view:
<?php if ($session->check('Message.flash')) $session->flash(); ?>
On Tue, Sep 8, 2009 at 2:28 AM, Spence<[email protected]> wrote:
>
> Hi fellow developers,
>
> I am encountering a hard-to-debug session problem where a session
> variable is sometimes not being set. The following is the correct
> scenario:
>
> 1) Users clicks submit on a form page and the following controller
> code is executed:
> 2) $_SESSION['sess_var_msg'] = "You have successfully registered.";
> $this->redirect("/businessprofile/");
> exit;
> 3) The session variable is displayed on the redirected page.
> <? if ($_SESSION['sess_var_msg'] != "") { ?>
> ... <?=$_SESSION['sess_var_msg']?> ...
> <? $_SESSION['sess_var_msg'] = "";
> } ?>
>
> The problem is that the session variable is not always set or
> displayed, but after I execute the code again, it works fine and every
> time continuously afterward. The problem seems to occur after the
> session has been idle for a long time. However, the entire session
> itself is never lost or expired because all pages require the user to
> be logged in and I always see the user's name (another session
> variable) on each page.
>
> It seems like it can be a cache problem, but I am setting nocache in
> the beforeRender() function of my app_controller.php as follows:
> header("Cache-Control: no-store, no-cache, must-revalidate, post-
> check=0, pre-check=0"); // // HTTP/1.1
> header("Pragma: no-cache");
> header("Expires: Mon, 17 Dec 2007 00:00:00 GMT");
>
> -- ADDITIONAL INFO --
> Cake Version: 1.2.0.6311
> Core.php :: Session.save: PHP
> PHP Version: 5
> Browser: Firefox 1.3 (and using multiple tabs)
>
> Does anyone have any ideas?
>
> Thanks,
> Spence
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---