Welcome Guest, Not a member yet? Register   Sign In
flashdata lost
#1

[eluser]caprican[/eluser]
I have two functions in my controller, let's call them confirm and proceed. Proceed can be called only after confirm's been called ... so I use flashdata to do the following:

Code:
public function confirm() {
    ...
    $this->session->set_flashdata('confirmed', 'yes');
    ...
}

public function proceed()
{
    ...
    if($this->session->flashdata('confirmed') == 'yes') {
        ...
        $this->session->set_flashdata('confirmed', 'yes');
        // do something
        ...
    }
    else {
        // do something
    }
}

I set the flashdata again in proceed function because I want users to be able to refresh the page while on proceed and still be able to access it.

The code worked for few days before today I found it not working anymore. Users are still able to access proceed right away from confirm but when they refresh the proceed page, the flashdata return FALSE.

Can anyone please tell me if there is anything wrong with the codes? Can't I re-set the flashdata?

Thank you.
#2

[eluser]InsiteFX[/eluser]
Code:
If you find that you need to preserve a flashdata variable through an additional request,
you can do so using the keep_flashdata() function.

$this->session->keep_flashdata('item');

Enjoy
InsiteFX
#3

[eluser]caprican[/eluser]
Thanks for your reply InsiteFX. Doesn't keep_flashdata() will convert it into a normal session just like when I set it using set_userdata()?

I don't want to do that ... I want the session cleared when users navigate to another page (other than proceed).
#4

[eluser]caprican[/eluser]
Reading the documentation once again, I was made aware that keep_flashdata only keep the session for another request ... so that's good ... but my flashdata was still killed ... gone somehow.

After fiddling around with it, I found that the current changes made to the layout of the page caused the lost of flashdata ... here is the javascript for layout fix that caused all this:

Code:
// Workaround to fix transparent images for IE6
        DD_belatedPNG.fix('#agency a, #local img, #main .viewport');

    /**
     * The following workarounds for IE must occur in head of document
     */
        // Workaround to fix IE6 flicker
        // @see http://www.mister-pixel.com/index.php?Content__state=is_that_simple
            try {
              document.execCommand("BackgroundImageCache", false, true);
            } catch(err) {}

        // Workaround to fix IE6 treatment of abbr tag
            document.createElement('abbr');

Any idea why that will mess with server session? If I removed this js block from the page ... flashdata works fine.
#5

[eluser]cahva[/eluser]
I find that very hard to believe that piece of javascript could kill your flashdata. Are you storing sessions in database or cookie?




Theme © iAndrew 2016 - Forum software by © MyBB