Page 1 of 1

Sessions inside modules

Posted: Wed Mar 09, 2005 3:52 pm
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

Re: Sessions inside modules

Posted: Thu Mar 10, 2005 5:29 pm
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

Re: Sessions inside modules

Posted: Thu Mar 10, 2005 5:54 pm
by Krol
ok, thanks very much!