Hi,
Have a strange one, see the code below, the same session id is printed each time the page is loaded, does anybody know whats going on?
Thanks..Code:session_destroy(); session_start(); $sessionid = session_id(); echo $sessionid;
| SitePoint Sponsor |


Hi,
Have a strange one, see the code below, the same session id is printed each time the page is loaded, does anybody know whats going on?
Thanks..Code:session_destroy(); session_start(); $sessionid = session_id(); echo $sessionid;
you have to start the session before destroying it
my mobile portal
ghiris.ro


Thanks, I tried this and its still the same
Code:session_start(); session_destroy(); session_start(); $sessionid = session_id(); echo $sessionid;
if you have cookies enabled in browser, the session id is stored in the cookie
and the session_start will resume the session
my mobile portal
ghiris.ro





Take a look at session_regenerate_id()
[read: PHP Sec. | CSRF | PCRE Mods | Encryption | Form Proc. | File Val.]
[tools: PHPEd | PHP Docs | jQuery | CI | SwiftMailer | CKEditor | reCAPTCHA]



[read: PHP Sec. | CSRF | PCRE Mods | Encryption | Form Proc. | File Val.]
[tools: PHPEd | PHP Docs | jQuery | CI | SwiftMailer | CKEditor | reCAPTCHA]
my mobile portal
ghiris.ro


It really makes no difference to the user, i need to write info to a database. This information is then taken by a process running on another machine, i pass this process the session id. I later use the same session Id to get a returned value from the process running on the other machine. This seems ok ?
An idea
or you can store it on the filesystem (could be also NAS) and make a CRON to store it to database ;-)PHP Code:class my_data_class{
//bla bla
public function __destruct(){
// before that a html should be posted to client
// then you can store your session to mySql and not slow the response
}
}


Ok guys, thanks for the advice. I've dumped the session id idea and am now handling the issue with internal ID's.
Thanks
Bookmarks