开发者

Auto logout jquery or what? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that 开发者_如何学Cit can be reopened, visit the help center. Closed 11 years ago.

I want to make an auto-logout system for my site for if someone unexpectetly closes browser or shuts-down computer so... what is the best way to make that system? im using php on my site for everything. thanks!


You can store your user's session datas via $_SESSION If user close browser, user's session datas will be removed.


if you unexpectedly shut down the browser or client system, the server will remain blissfully unaware of the event. Ultimately, the session will expire and the problem should cease to be a problem.

The only js-based autologout would be like a timeout, where after a certain period of inactivity, the client would redirect to the server's logout url... but of course this requires the client machine to be online.


php sessions are the way to go. By default: if someone closes their browser they are closing the session, and a timeout can be placed on the session so that inactive sessions are timed out, there is a default time-out of (someone correct me!) about 20 minutes.

But I guess from your level that you are confusing a number of concepts, and you might like to try to think about what it is you are trying to 'prevent'. Security is a much more complex subject area and "auto-log out" is just skirting around the edge of the subject.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜