Using sessions for non-logged-in users

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
aportale

Using sessions for non-logged-in users

Post by aportale »

Hi,

I am searching for a CMS that is easy to use for me (CMS N00b developer) and the later content editors. CMSms looks like a hot candidate. I need to know one thing:

Is there a PHP-session management in CMSms that also works as long the website visitor is not logged in?

I intend to use my own PHP code through user-defined tags. That PHP code needs to write and read session data, also if the website visitor is not logged in.
As far as I understood, I cannot initiate the PHP session management after some data was already sent to the browser. So I will not be able to initiate it from within a user-defined tag which will be embedded in the middle of a page.

The CMSms docs don't mention sessions anywhere. If such a feature is available, it is probably just not (yet) documented?

Thanks in advance,
Alessandro
Last edited by aportale on Mon Dec 05, 2005 1:02 am, edited 1 time in total.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Using sessions for non-logged-in users

Post by Ted »

Well, with 0.11, sessions are only made if you're logging into the admin or if CMSSESSID is in the GET parameters.

However, if you look at the top of incude.php, you'll see:

Code: Select all

#if(!@session_id()) {
if(!@session_id() && (isset($_REQUEST[session_name()]) || isset($CMS_ADMIN_PAGE))) {
If you want sessions all the time, change it to:

Code: Select all

if(!@session_id()) {
#if(!@session_id() && (isset($_REQUEST[session_name()]) || isset($CMS_ADMIN_PAGE))) {
Then you should be able to work with sessions as normal.

Hope that helps!
aportale

Re: Using sessions for non-logged-in users

Post by aportale »

Yes!

That's it. Thank you!  :)
Locked

Return to “CMSMS Core”