Add custom $_SESSION vars - Printable Version +- ispCP - Board - Support (http://www.isp-control.net/forum) +-- Forum: ispCP Omega Support Area (/forum-30.html) +--- Forum: Usage (/forum-34.html) +--- Thread: Add custom $_SESSION vars (/thread-12289.html) |
Add custom $_SESSION vars - Max13 - 11-30-2010 09:24 PM Hi everybody, I've just done the upgrade to 1.0.7 final. I'm adding some custom pages for a shell hosting i'm making. I want to be able to be able to modify the session params, for example, making the session available for 24 Hours by default, and "$_SESSION['ok']" (.../gui/include/ispCP/Initializer.php): PHP Code: session_name('ispCP'); I think it's working. But... I want to add such a params directely in a script (.../gui/index.php): PHP Code: $_SESSION['ok'] = 1; Unfortunately, this is only showing: Code: Array Any idea of why my own params are not "available", even if I put them on "environment.php", "Initializer.php", "ispcp-lib.php", or even directely in a page ? Thank you for your help. RE: Add custom $_SESSION vars - Max13 - 12-02-2010 07:04 AM up ? =) RE: Add custom $_SESSION vars - motokochan - 12-04-2010 01:57 AM It's because session_set_cookie_params() is setting internal PHP variables about a session cookie, it's not actually adding items to the $_SESSION superglobal array. If you want to see these details, you should use session_get_cookie_params(). It's a better idea to set these in php.ini as otherwise every page that handles the session needs that function called. Also, keep in mind that having such a long session length is a bad idea for security. Remember that the expiration is reset on each use of the session, so 24 hours means that it'll be kept active for 24 hours after the last action. |