会话自动过期时将用户状态更改为脱机 [英] change user status to offline when session automatically expires

查看:113
本文介绍了会话自动过期时将用户状态更改为脱机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!
我想在会话自动到期时更改用户的状态.我有一个具有字段状态的表用户.当用户登录时,我将其状态更改为联机,而当用户注销时,状态更改为脱机.
但是当会话自动过期时,状态保持在线...我想将其状态更改为离线..我知道页面加载中,我可以检查session ["username"] == null的时间,然后在该代码块中编写代码..但我需要会话变量的值..以便将其传递给函数并针对该用户名更改状态..有没有办法将会话变量的值存储在其他地方,以便会话过期即使这样我也可以获取会话变量的值

hi!
i want to change the status of user when the session automatically expires.i have a table user with field status.when the user logins i change its status to online and when the user log off the status is changed to offline.
but when the session automatically expires the status remains online ...i want to change its status to offline..i know in page load i can check when session["username"]==null then in that block i will write the code..but i need the value of session variable..so that i pass it to the function and change the status against that username....is there any way to store that value of session variable some where else so that when session expires even then i could get the value of session variable

推荐答案

Update my DB Table on Session Timeout[^] - Article seems to reference what you are wanting.


这篇关于会话自动过期时将用户状态更改为脱机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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