[Solved] Issues with $_SESSION

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.
Post Reply
campey
Forum Members
Forum Members
Posts: 10
Joined: Tue Jan 24, 2012 9:35 pm

[Solved] Issues with $_SESSION

Post by campey »

I have attempted to find an answer on the forums however I can't find one that directly answers my question.

I have a basic little captcha (this is an external PHP file) which I have on a contact page of my site. When I mocked it up pre-CMS Made Simple it worked fine. Now I can't get it working, the reason is the $_SESSION variable is always blank.

My question is why does CMS Made Simple "appear" to blank out session variables and can someone provide me with a solution on how to pass session information between external PHP and CMS Made Simple?
Last edited by campey on Thu Jul 12, 2012 4:51 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Issues with $_SESSION

Post by Dr.CSS »

Have you tried using formbuilder with the captcha module?...
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Issues with $_SESSION

Post by calguy1000 »

My question is why does CMS Made Simple "appear" to blank out session variables and can someone provide me with a solution on how to pass session information between external PHP and CMS Made Simple?
Sessions in php are configured with the session_name() and session_start() (and a few other functions, and settings. CMSMS sets the session name to something unique for the site and server. Though your session data from your other PHP files probably still exist CMSMS cannot see them because they are under a different session name.

You would need to modify your other php file(s) to use the same session name as CMSMS in order to share session data between scripts.

Telling you how to modify your other scripts, or how to modify CMSMS to share session data is beyond the scope of our product
support. All I can tell you is to read up on sessions in the php manual.

Additionally, CMSMS has a couple of good captcha modules that work properly, it is recommended that you use those if possible, rather than trying to re-invent the wheel.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
campey
Forum Members
Forum Members
Posts: 10
Joined: Tue Jan 24, 2012 9:35 pm

Re: Issues with $_SESSION

Post by campey »

Ah! Thanks for the feedback (I love the CGContentUtils by the way!)

I think i'll just do as you said an use an existing captcha.

I was just curious on why!

Will resolve this issue
Thijs
New Member
New Member
Posts: 6
Joined: Mon Jun 06, 2011 9:11 pm

Re: [Solved] Issues with $_SESSION

Post by Thijs »

Perhaps not relevant anymore but i had the same issue and i noticed that the session cookie was set with the 'Secure' flag which prevents it from being sent over unencrypted HTTP sessions. Since i used my site (and most people do) only over HTTP i could never use the $_SESSION. Changing the parameter session.cookie_secure to 0 in php.ini fixed the issue and i can use $_SESSION in UDT again.
Post Reply

Return to “CMSMS Core”