Welcome Guest, Not a member yet? Register   Sign In
SESSION data deleted when redirecting
#1

[eluser]Ecentric[/eluser]
Code:
function something
{
<when I print $_SESSION here, it is alright>
<redirect function here>
}



In the redirected page
Code:
function __construct()
{
<print $_SESSION, the data from the $_SESSION above is not here>
  .....

}
#2

[eluser]Rick Jolly[/eluser]
Are you calling "session_start();" first?
#3

[eluser]Ecentric[/eluser]
Well, yes.
I think that is not the problem.
When I enabled the error_reporting(E_ALL), here are the errors shown:
Code:
A PHP Error was encountered
Severity: Warning
Message: Unknown: write failed: No space left on device (28)
Filename: Unknown
Line Number: 0

Code:
A PHP Error was encountered
Severity: Warning
Message: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct ()
Filename: Unknown
Line Number: 0

I don't know these stuffs.
#4

[eluser]Rick Jolly[/eluser]
So php native sessions store session data in files within the windows or linux temp directory by default. You could try changing that directory:
Code:
// page 1
session_save_path(APPPATH . 'some_write_enabled_directory/');
session_start();
$_SESSION['something'] = 'something';

// page 2
session_save_path(APPPATH . 'some_write_enabled_directory/');
session_start();
echo($_SESSION['something']);
Alternatively you could use cookie or database session data storage either through CI's session class or one of the user contributed libraries you'll find in the wiki.
#5

[eluser]drewbee[/eluser]
It sounds like your garbage collection routine isn't working in PHP. I have had these issues too when the temporary sessions were not being cleaned out of the directory.




Theme © iAndrew 2016 - Forum software by © MyBB