Welcome Guest, Not a member yet? Register   Sign In
RA_Session - Version 2.3 Updated

Found my error. First I thought my if statements where all screwy (which they were, I don't like using elseif statements everywhere but it appears I did).

Secondly, is something I'm not fulling grasping (I'll grab that coffee).

In the function persistant_session - the following statement is used to determine if the user is just checking to see if it's there.

if ($time_to_stay_active == '' OR $time_to_stay_active == NULL) {
Where in actual fact - I should possibly be using === (checks that the variables are the same type, not just the equal the same). This is a first for me actually... Previously I must have constructed my functions in such a way that the '' and NULL statements were always last.

Anyway - I was going to use is_null() but according to a little script I ran from james (who posted on PHP) suggested that === is 30x faster than using is_null. And I confirm - spot on james!

I shall adjust my functions now - and give you an update very shortly.


[i]Ps: You don't need to unset the userdata anymore - it's not done for you. I saw that if it's not handled by the sess_Destory function - which the session itself holds the correct value (nothing) on destroying it - the array userdata still does for one more page. Again, thanks for your help Smile

This is the tiny script I wrote to test your query (let me know if it needs to change)
$i = $this->ra_session->userdata('user_id') + 1;
$this->ra_session->set_userdata('user_id', $i);
echo $this->ra_session->userdata('user_id');

I uncommented those two lines to see the different results when used together/separately etc.

The wiki is updated for you - all working (as intended now).

Thanks again Joe. http://codeigniter.com/wiki/RA_session/

Thanks for your very quick response on this....I'm now getting the following error (the library is autoloaded so i get this on every page)

Message: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/vhosts/blaa blaa/httpdocs/application/libraries/RA_session.php:513)

Filename: libraries/RA_session.php

Line Number: 94

Did I leave an echo "rawr" somewhere? hehehe.. Let me check.

Looks like a missing ?> tag on my script - is the only thing on line 513.

Make sure that line 94 doesn't have any echo/printing code in it before changes to the persistant session occur (as a new cookie is sent).

nothing immediately pops out...I'll check too

Whitespace is not our friend when dealing with headers/sessions. Even an empty line at the end of a PHP file can cause that.

I'm off to bed. 2am here and I'm low on coffee.

MEMO to self: In need of more coffee.

Thanks again for your help tonight Smile I appreciate it.

Thanks to you too, I was expecting a few days wait!....I can't see anything obvious breaking the output, but I'll keep looking.

thanks again.



It seems flashdata is not working properly since the data still lingers even though more than one requests have been made. After looking at CI_Session, I found out that this can be fixed by adding
var $flashdata_key = 'flash';
to RA_Session.


I'm getting that headers error commented in a previous post.
I've tried installing a fresh CI 1.6.1, copied RA_Session to libraries folder, and put it on the autoload.
And I get the errors:

A PHP Error was encountered

Severity: Warning

Message: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /data/www/vanilla_ci/system/application/libraries/RA_Session.php:513)

Filename: libraries/RA_Session.php

Line Number: 95
A PHP Error was encountered

Severity: Warning

Message: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /data/www/vanilla_ci/system/application/libraries/RA_Session.php:513)

Filename: libraries/RA_Session.php

Line Number: 95

Welcome to CodeIgniter!

The page you are looking at is being generated dynamically by CodeIgniter.

If you would like to edit this page you'll find it located at:

Could this be related to some PHP configuration param?
Or maybe some CI file contains a blank line at the end?

I've looked for it without success.


Theme © iAndrew 2016 - Forum software by © MyBB