I need to get the client browser issued with a new session_id (PHPSESSID) without closing the browser. Is there a way to do it. Please reply ASAP, this is urgent.
Thanks
well the only thing that comes to mind is to destory a session and start a new one with a different session name.. hope that helps you
I dont think this will work as I am just registering a session and using the session_id(). If I try to destroy, I get an error of trying to destory and uninitialized session. 🙁
you need to session_start("session_name"); then unregister etc...
for it to work..
OK! What I am doing is:
session_start(); echo session_id();
this gives me session id. This is perfect and preferable i would not like to register any session with a particular name here.
Any ideas how to destroy this session?
i wouldnt exactly call that a registered session.. So in other words you never registered a session and dont need to destroy it, you can create a new session but by registering it with a name
Actually the structure of the entire application is so that we are using just the session_id whereever we want.
well heres another thing... if your using a link.. dont even put session_start();
just have $phpsessid it will have the session id without registering or starting one... unfortunetly you cannot destroy them.
Thanks! But I think I worked it out this way.
if(isset($COOKIE[session_name()])) { session_start(); // To be able to use session_destroy session_destroy(); // To delete the old session file unset($COOKIE[session_name()]); }
Thanks again!
Thanks tabarry - that's exactly the right solution (at least it's the only thing I've found that worked).