« ShareName 属性mssql转移到word »

同一个用户不允许同时登陆两次

ASP程序中同一个用户不允许同时登陆两次
登陆页login.asp:
<%
if request.Form.count>0 then
session("username")=request("username")
application(session("username"))=session.SessionID
response.Redirect("index.asp")
end if
%>
<form method=post action="">
<input type="text" name="username"><input type="submit">
</form>

其他需要认证的页面index.asp:

<%
if application(session("username"))=session.SessionID then
response.Write("已经登陆")
else
response.Write("没有登陆")
end if
%>

这个程序最后一点没写好。

大致意思就是限制同一个帐户在不同的位置同时登陆。
实现的方法就是将已经登陆的帐户的id保留在application中,但是程序没有解决意外退出的问题,如果需要实现这个目标,请参考程序思路自行研究。
最好的办法是使用global.asa
原创文章如转载,请注明:转载自悠悠博客 [ http://www.ajaxstu.com/ ]

相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。