How do i set persistent session using PHPSESSID?
Posted: Wed Mar 28, 2007 3:33 am
feyd | Please use
In above code I am setting the PHPSESSID expiry limit for 1 year. But if i again come and access the same page the else part gets executed and on session_start() the PHPSESSID expiry date again replaces according to php.ini settings.
if i comment session_start() in else part everything works fine, but i can't set or access session data.
Plz help me to solve this.
Thanks in advance
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
How do i set persistent session using PHPSESSID?
I have written following code:Code: Select all
/**************START**************/
if(!isset($_COOKIE['PHPSESSID']))
{
session_set_cookie_params(60*60*24*365);
session_start();
$tmp_sessionId = session_id();
}
else
{
session_start();
$tmp_sessionId = $_COOKIE['PHPSESSID'];
}
/***************END***************/if i comment session_start() in else part everything works fine, but i can't set or access session data.
Plz help me to solve this.
Thanks in advance
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]