Jump to content

What's the difference ? Setting Sessions?


phprocket

Recommended Posts

 

 

What is the difference between these ?

 

 


ini_set('session.name','PUMMS');
ini_set('session.cookie_lifetime',99992592000);
ini_set('session.gc_maxlifetime',99992592001);

 

 


session_name('PUMMS');
session_set_cookie_params(99992592000,'/',$pumms_domain_cookie);

 

 

Should one method be used over the other ?  I have seen other people use both by testing for a function ?  I could use some help understanding this.

 

 

The end goal is to change the session name and setup the session cookie not to expire when browser is closed.  My script will check the session value and determine to let the user in or not based by a configurable time set in the database.

 

 

Resources,

 

http://us2.php.net/manual/en/function.session-set-cookie-params.php

http://us2.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime

 

Thanks,

David

Link to comment
https://forums.phpfreaks.com/topic/108222-whats-the-difference-setting-sessions/
Share on other sites

session_set_cookie_params() is simply a built in function that sets the values instead of using individual ini_set() statements. There is no functional difference. Any value that could be prevented from being changed would be prevented using either method.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.