SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Keep a $_SESSION after the header(), THEN unset() it

    I am stumped on this, you can see the diagram below okay..



    Example..
    index.php is loaded so,
    1. Models is processed,
    2. Controllers is processed,
    3. Views are processed
    4. And the session status is unset.

    So from the views,
    say you click something to perform an action and it goes to the Models.
    This passes a header(location: index.php)

    The page reloads and has a SESSION Status now,

    It should reload everything and pop it into the views,
    Then it should unset it after the views are loaded.

    Im using Smarty for views by the way.

    Am I missing something here? It is showing up blank.
    Is the header() actually reloading the page twice or something?

  2. #2
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, you probably missing something
    I'd suggest some debugging

  3. #3
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you have exit; command right after header(location?
    if not - put ith there

    also, try session_write_colose() before header

    also, check if server sends session cookie
    and if browser sends it back

  4. #4
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay I didnt have an exit after that header, but this took hours to fix and I finally got it..

    I will checkout what you suggested shrapnal, but here it is if it makes sense to what I was doing:


    App loads Everything, a Status message is created way deep in $App once something happens, then comes out below in a $SESSION[statusMSG]

    PHP Code:
    /*    Objects    */
    $smarty    = new Smarty;
    $App    = new App

    /* Assignment */
    $smarty->assign('App'$App);


    /* Status Message */
    if (empty($_SESSION['statusMsg'])) {
        
    $_SESSION['statusMsg'] = NULL;
    }
            
    $_SESSION['status'] = $_SESSION['statusMsg'];
    Status::Clear();    // Clears the statusMsg (Which will also set the status empty for next page load)


    // View stuff............
    /* Status:Msg     */    
    $smarty->assign('status'$_SESSION['status']);

    /* tpl Display      */
    $smarty->display('mine.tpl'); 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •