![]() |
Session data keeps changing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Session data keeps changing (/showthread.php?tid=18444) |
Session data keeps changing - El Forum - 05-06-2009 [eluser]Zorrocaesar[/eluser] I have a very strange problem that involves sessions. Here's the code: the controller Code: function deleteImage() between the above and the below, sit a view file and a javascript file, which contain the the image file name and respectively make a request to another controller function(see below) with the file name. The $data['uuid'] value from above is also sent in the request via the POST method. the ajax function Code: function imageDelete() As you see, I am using a random generated number which I store in the session and also in the html page and than send via POST. The receiving function checks to see if the random number in the session is the same with the one sent via POST. This is to prevent unauthorized access to the image delete function. All works well. The image is deleted and the ok message is sent back to the browser via ajax. Only one problem though: after the ok message is displayed via ajax, the uuid value in the session changes, so another request to the ajax function will not be allowed. I have looked at the code over and over again, but I cannot figure it out why the value in the session changes. Please help! Session data keeps changing - El Forum - 05-06-2009 [eluser]Thorpe Obazee[/eluser] you could try to echo stuff as you are passing info and figure out where it is changing. you could also post the uuid function and the view. Session data keeps changing - El Forum - 05-08-2009 [eluser]Zorrocaesar[/eluser] The problem is fixed. It seems that the loading gif which was displayed before the ajax call was initiated had a relative path which caused the same controller to be loaded again. This, in turn, caused the uuid function to be called again and it's value assigned to the session. So, before the ajax callback script was accessing the session, it was already changed. |