Sessions and Persistent Sessions

Permalink 1 user found helpful
I recently had the need to be able to add sessions to a site I was building in concrete, but this was needed to be done outside of the concrete environment - I had a php script that was called, this would then need to check if the $_SESSION['uID'] was set or not, then depending on this it would then create a new session. This new session would need to be accessible from within the concrete5 environment.

I noticed that after creating this script I couldn't access any concrete created sessions from within the script, nor could any session that I created within my script be accessible within the concrete environment.

I spent a fair amount of time browsing the forums trying to find out if anyone had had this problem before and if it was ever resolved.

I found that doing this:

session_id($_COOKIE['CONCRETE5']);
session_start();


Would fix the problem, however this would only fix it if you had already been on the concrete environment. I was back to square one.

Then I worked out the solution. If I did this:

session_name('CONCRETE5');
session_start();


Then all the sessions that I create I will be able to access within the concrete5 environment. Problem solved!

Where 'CONCRETE5' is the value of the global variable SESSION set in the config/base.php file.


I hope that this helps anyone encountering a similar issue to what I had.

adz
 
barnabynorman replied on at Permalink Reply
barnabynorman
Something also to consider that stumped me for a number of hours is that the location of the concrete5 session could be stored in another location to the session in you external systems.