Sessions inside modules

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Krol

Sessions inside modules

Post by Krol »

Hi!

I'm still in the learning phase (php) and would like to know if I have to use sessions inside modules in any special way to make them work.
I want to have a flood protection. Is it the right way to use sessions in this case?

Krol
100rk

Re: Sessions inside modules

Post by 100rk »

Krol wrote: if I have to use sessions inside modules in any special way
No, there is no 'special way' how to use session variables in module. You only have to be careful and do not name Your session variable equally as any session variable which is used by CMSMS (or by other module). To be absolutely sure, combine Your session variable name with $id of Your module. Best way for set/access session variable is using of PHP superglobal variable $_SESSION - in this way Your script will work regardless of 'register_globals' setting of Your PHP environment.
Old way by PHP function session_register() is not recommended.
Take a look here: http://www.php.net/manual/en/reserved.v ... es.session
Last edited by 100rk on Thu Mar 10, 2005 5:35 pm, edited 1 time in total.
Krol

Re: Sessions inside modules

Post by Krol »

ok, thanks very much!
Post Reply

Return to “Developers Discussion”