📄 leaveaction.asp
字号:
<%
'************************************************************************************************
' 文件名: LeaveAction.asp
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'
' 创建人 : 周秋舫
' 日 期 : 2002-05-13
' 修改历史 :
' ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 用户留言信息leave_infor写入数据库
' 版 本 :
'************************************************************************************************
option explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<!-- #include file="../include/config.inc" -->
<!-- #include file="../include/debug.inc" -->
<!-- #include file="../include/db.inc" -->
<!-- #include file="../include/datahandle.inc" -->
<!-- #include file="../include/common.inc" -->
<%
'****************************************************************************
' 本页面必须是由其它页面打开的,因此如果直接在地址栏输入地址,就跳转到出错页面
'****************************************************************************
%>
<script language="javascript">
<!--
if ( typeof(window.opener) == "undefined" )
{
window.location.href = "../common/error.asp"
}
//-->
</script>
<%
'****************************************************************************
' 如果用户尚未登录,或已经登录但Session或Cookie过期导致用户信息失效,则其opener跳转到登录页面
' 这里已经排除了opener为undefined的情况,不需要再对window.opener进行判断了
'****************************************************************************
If Not IsLogin then
Response.Clear()
Response.Write( _
"<script language=""javascript"">" & vbLF & _
"<!--" & vbLF & _
" window.opener.location.href=""../common/home.asp"";" & vbLF & _
" window.close();" & vbLF & _
"//-->" & vbLF & _
"</script>")
Response.end
End if
%>
<%
'****************************************************************************
' 检查输入参数,如果没有leaveinfor参数,那说明地址又可能是从地址栏输入的,跳转到出错页面,
' 其实这种情况应该是不会出现的,因为前面已经从window.opener就可以判断是否从其它页面打开的
'****************************************************************************
Dim sLeaveInfor, sAction
sAction = GetParam("leaveaction")
sLeaveInfor = GetParam("leaveinfor")
''if IsEmpty(sLeaveInfor) then
if IsEmpty(sAction) then
Response.Clear()
Server.Transfer("../common/error.asp")
Response.end
end if
'****************************************************************************
' 根据传入参数判断是暂时离开还是退出系统
'****************************************************************************
'sAction = Left(sLeaveInfor, 1)
if sAction = "0" then
call CloseIt()
elseif sAction = "1" then ' 暂时离开
''sLeaveInfor = right(sLeaveInfor, len(sLeaveInfor) - 1)
call UpdateLeaveInfor(sLeaveInfor)
elseif sAction = "2" then ' 退出系统
''sLeaveInfor = right(sLeaveInfor, len(sLeaveInfor) - 1)
call Logout(sLeaveInfor)
else
call CloseIt()
end if
%>
<%
'********************************************************************
' 关闭本窗口
'********************************************************************
Sub CloseIt()
Response.Write("<script language=""javascript"">window.close();</script>")
Response.End
End Sub
'********************************************************************
' 暂时离开,将留言写入数据库,执行完毕后锁定窗口
'********************************************************************
Sub UpdateLeaveInfor(sLeaveInfor)
Dim sSQL, sTemp
'' 更新数据库
sSQL = "update T_OnlineStatus" & _
" set login_status=1" & _
", online_status=0" & _
", leave_infor = " & ToSQL(sLeaveInfor,"Text") & _
", leave_time = " & ToSQL(now, "Text") & _
" where account_id = " & ToSQL(GetUserId,"Text")
call ExecuteSQL(dbLocal, sSQL)
'' 更新在岗状态
SetOffline()
' 将Tab和换行回车符均转化成空格
sLeaveInfor = Replace(sLeaveInfor, chr(9), " ") ' vbTab
sLeaveInfor = Replace(sLeaveInfor, chr(10), " ") ' vbLF
sLeaveInfor = Replace(sLeaveInfor, chr(13), " ") ' vbCr
'Response.Write("<script language=""javascript"">window.opener.document.all.liuyan.innerHTML="" 您的留言:" & sLeaveInfor & """;</script>")
'Response.Write("<script language=""javascript"">window.opener.document.all.leave_action.innerText=""我回来了"";</script>")
Response.Write("<script language=""javascript"">window.opener.location.href=""/oa/common/main.asp"";</script>")
Response.Write("<script language=""javascript"">window.close();</script>")
End Sub
'********************************************************************
' 退出系统,仍将留言写入数据库,执行完毕后进入登录页面
'********************************************************************
Sub Logout(sLeaveInfor)
'-------------------------------------------------
' 更新T_OnlineStatus表
Dim sSQL, sLeaveTime
if sLeaveInfor <> "" then sLeaveTime = now() '' 有留言信息的时候,同时更新留言时间
sSQL = "update T_OnlineStatus" & _
" set login_status=0" & _
", online_status=0" & _
", leave_time = " & ToSQL(sLeaveTime,"Text") & _
", leave_infor = " & ToSQL(sLeaveInfor,"Text") & _
", logout_time=" & ToSQL(now,"Text") & _
" where account_id = " & ToSQL(GetUserId,"Text")
call ExecuteSQL(dbLocal, sSQL)
'-------------------------------------------------
'-------------------------------------------------
' 清除全局性的用户信息
call EmptyUserInfor()
'-------------------------------------------------
'-------------------------------------------------
' 父窗口跳转到登录页面,本窗口关闭
Response.Write("<script language=""javascript"">window.opener.location.href=""/oa/common/home.asp"";</script>")
Response.Write("<script language=""javascript"">window.close();</script>")
'-------------------------------------------------
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -