📄 loginaction.inc
字号:
<%
'************************************************************************************************
' 文件名: loginAction.inc
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'
' 创建人 : 周秋舫
' 日 期 : 2002-05-13
' 修改历史 :
' ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 用户登录有关函数
' btnLogin_OnClick : 用户点击登录按钮,检查用户输入是否有效,如果有效,则提交
' LoginAction : 用户验证,返回用户信息
' FormLoginPanel : 提供用户输入用户名和密码的窗口
' 版 本 :
'************************************************************************************************
%>
<script language="javascript">
function forgetpwd(sys)
{
if(sys=="1")
{
window.open("../common/forgetpwd.asp","wForget", "width=350,height=124,top=300,left=300");
return;
}
else
{
window.open("../../wuye/include/forgetpwd.asp","wForget", "width=350,height=124,top=300,left=300");
return;
}
}
function btnLogin_OnClick()
{
var loginname, password,sys;
// 判断登录名是否为空
loginname = document.all.loginname.value;
if (loginname == "")
{
document.all.loginname.focus();
alert("对不起,您没有输入用户名!");
return false;
}
// 判断密码是否为空
password = document.all.password.value;
if (password == "")
{
document.all.password.focus();
alert("对不起,您没有输入密码!");
return false;
}
document.all.loginname.value = loginname;
document.all.password.value = password;
sys=document.all.system.value;
if (sys=="1")
{
FormLogin.action="../common/home.asp";
}
else
{
FormLogin.action="../../wuye/include/home.asp";
}
FormLogin.submit();
}
</script>
<%
Sub LoginAction(sLoginname, sLoginPwd)
' on error resume next
' 检查用户名和密码是否为空
Dim sError
sError = ""
if IsEmpty(sLoginName) then sError = "对不起,请输入用户名!"
if IsEmpty(sLoginPwd) then sError = sError & vbLF & "对不起,请输入用户密码!"
' 验证用户名和登录密码,根据验证结果分别作处理
Dim sClientHost, sSQL, iPass
if sError = "" then
sClientHost = Request.ServerVariables("REMOTE_HOST")
sSQL = "proc_Login " & ToSQL(sLoginName,"Text") & "," & ToSQL(sLoginPwd,"Text") & "," & ToSQL(sClientHost,"Text")
iPass = ExecuteSP(dbLocal,sSQL)
' 用户验证不成功的处理
if iPass < 0 then
sError = "对不起,用户名或密码错,或该账号已经锁住(拥有该账号的员工已离职)!"
end if
end if
'' 如果用户验证成功,则设置用户全局性的用户信息,并且同时清空该用户的留言信息
if sError = "" then
sError = SetUserInfor(sLoginname)
EmptyLeaveInfor(sLoginname)
end if
if sError<>"" then
Response.Write("<script language=""JavaScript"">alert(""" & sError & """)</script>")
Response.write "<script language=""javascript"">window.navigate(""home.asp"")</script>"
response.end
end if
'' 检查该用户是否有过期未还的书,有则,调用CommonSendMsg(msg_type, parent_msg_id, subject, content, sender, receiver)发送一条消息
dim sMsgSubject, sMsgContent, sReceiver, sBookName, sBookId
sSQL = "select * from t_library where username = " & GetEmpSerial & " and realdate < " & ToSQL(date, "Text")
'response.write sSQL & "<br>" : response.end
dim crs : set crs = New CRecordset
dim rs : set rs = crs.Open(dbLocal, sSQL)
while not rs.EOF
sBookId = crs.GetValue("id")
sBookName = crs.GetValueHTML("name")
sMsgSubject = "请您还书《" & sBookName & "》"
sMsgContent = "您所借阅的《" & sBookName & "》已超期,请您与管理员联系。" & vbLF & _
"这是一封系统自动发送的消息,请您不要回复。谢谢。"
'response.write sMsgSubject & ", " & sMsgContent & "<br>"
'' 下次提醒时间为10天后
call ExecuteSQL(dbLocal, "update t_library set realdate = DATEADD(day, 10, realdate) where id = " & sBookId)
call CommonSendMsg(MSG_COMMON, "", sMsgSubject, sMsgContent, "", GetEmpSerial)
rs.movenext
wend
crs.Close()
' response.end
Server.Transfer("../common/main.asp")
' on error goto 0
End Sub
Sub FormLoginPanel()
Response.Write("<form method=post name=""FormLogin"" onsubmit=""return(btnLogin_OnClick());"">")
Response.Write("<table width=""300"" border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"">")
Response.Write("<tr>")
Response.Write("<td align=""right"">")
'------------------------------------
' 以下为输入用户名和密码的表格
Response.Write("<table cellspacing=0 cellpadding=0 id=""tblLogin"" border=0 valign=top width=200>")
Response.Write("<tr>")
Response.Write("<td colspan=3 align=left style=""border-color:#E2EC91;""> <img border=0 src=""../images/key.gif""><b> 用户登录</b></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td class=noborder width=""75""><div align=""right"">用户名:</div></td>")
Response.Write("<td class=noborder width=""75"">")
Response.Write("<input type=""text"" size=12 maxlength=20 id=""loginname"" name=""loginname"" style=""border:solid 1px black""></td>")
Response.Write("<td class=noborder width=""50""> </td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td class=noborder width=""75""><div align=""right"">口 令:</div></td>")
Response.Write("<td class=noborder width=""75"">")
Response.Write("<input type=""password"" size=12 maxlength=20 id=""password"" name=""password"" style=""border:solid 1px black""></td>")
Response.Write("<td class=noborder width=""50""></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td class=noborder width=""75""><div align=""right"">选择系统:</div></td>")
Response.Write("<td class=noborder width=""75"">")
Response.Write("<select name=system style=""width:95px""><option value=1 selected>OA</option><option value=2>物业管理</option></select></td>")
Response.Write("<td class=noborder width=""50""><img width=2px><input type=""image"" name=""btnLogin"" border=0 src=""../images/login.gif""></td>")
Response.Write("</tr>")
Response.Write("<tr height=25px><td colspan=3>")
Response.Write("</tr>")
Response.Write("<tr height=25px>")
Response.Write("<td class=noborder colspan=3 align=center>")
Response.Write("<font color=""#FFFFFF"">忘记密码:</font> ")
Response.Write("<a style=""color:white;cursor:hand"" OnClick=""JavaScript:forgetpwd(1);"">OA</a> ")
Response.Write("<a style=""color:white;cursor:hand"" OnClick=""JavaScript:forgetpwd(2);"">物业管理</a>")
Response.Write(" ")
Response.Write("<a style=""color:gray;cursor:hand;visibility:hidden""><font color=""#FFFFFF"">新用户注册</font></a></td>")
Response.Write("</tr>")
Response.Write("</table>")
' 以上为输入用户名和密码的表格
'------------------------------------
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("</table>")
Response.Write("<input type=""hidden"" name=""LoginAction"">")
Response.Write("</form>")
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -