开发者

Manipulating session file

开发者 https://www.devze.com 2023-03-31 05:48 出处:网络
So I want to know, is it very bad to manipulate session files. What bad things I have to expect for doing that?

So I want to know, is it very bad to manipulate session files. What bad things I have to expect for doing that?

In my website every开发者_开发百科time user logs in, he gets session id, and that ID is writen to DB. And every time when user logs out I delete that session id from DB and file system and regenerate new one for guest mode.

So how bad is: @unlink(session_save_path().'/sess_'.$old_sess);

Thank you.


Session data may not always be on disk(you can store session data in memcache or shared memory)

Why bother deleting the file in the first place?

http://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability can be tuned to do what you want


Since you write the session ids in a database anyway, you should write your own session handler that doesn't depend on the file system. Otherwise - yes, it is a bad idea.

0

精彩评论

暂无评论...
验证码 换一张
取 消