如果用户处于活动状态,则防止会话过期 [英] Preventing session expiration if user active

查看:39
本文介绍了如果用户处于活动状态,则防止会话过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带基本登录系统的迷你内容管理系统.我想知道,如果用户为 ex 活跃,如何防止会话过期.输入内容或其他什么?有什么办法吗?每次发生交互时我如何重新准备会话?

I have mini content management sytem with basic login system. I wonder, how to prevent session expiration if user active for ex. typing content or something else? Is there any way to do it? How can i rearm the session every time an interaction takes place?

推荐答案

您需要将事件处理程序附加到某些用户交互事件上,例如鼠标移动、按键或类似事件.在事件中,您可以使用 ajax 从服务器请求某些内容.这将使会话保持活动状态.

You would need to attach an event handler to some user interaction event, such as mouse movement, or keyup, or something similar. On the event you could request something from the server using ajax. This would then keep the session alive.

这篇关于如果用户处于活动状态,则防止会话过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆