📄 loginaction.inc
字号:
<%
'************************************************************************************************
' 文件名: loginAction.inc
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'
' 创建人 : 周秋舫
' 日 期 : 2002-05-13
' 修改历史 :
' ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 用户登录有关函数
' btnLogin_OnClick : 用户点击登录按钮,检查用户输入是否有效,如果有效,则提交
' LoginAction : 用户验证,返回用户信息
' FormLoginPanel : 提供用户输入用户名和密码的窗口
' 版 本 :
'************************************************************************************************
%>
<script language="javascript">
function forgetpwd()
{
window.open("../include/forgetpwd.asp","wForget", "width=350,height=124,top=300,left=300");
return;
}
function btnLogin_OnClick()
{
var loginname, password;
// 判断登录名是否为空
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;
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 rs,sSQL,iRtn
Dim sClientHost
if sError = "" then
sClientHost = Request.ServerVariables("REMOTE_HOST")
sSQL = "proc_Login " & ToSQL(sLoginName,"Text") & "," & ToSQL(sLoginPwd,"Text") & "," & ToSQL(sClientHost,"Text")
set rs = conn.Execute(sSQL)
sError = ProcessError(conn)
if sError <> "" then
'Response.Clear
Response.Write("调用ExecuteSP函数出错,参考信息如下:<br>" & vbLF & _
"SQL语句:<span style=""color:blue;font-size:9pt"">" & sSQL & "</span><br>" & _
"出错信息:<span style=""color:red;font-size:9pt"">" & sError & "</span><br>" & _
"解决办法:<span style=""color:blue;font-size:9pt"">请仔细检查SQL语句,可以在SQL查询分析器中测试一下其正确性(确定存储过程返回rtn_code字段)!</span><br>")
Response.end
end if
iRtn = rs("rtn_code")
' 用户验证不成功的处理
if iRtn < 0 then
sError = "对不起,用户名或密码错,或该账号已经锁住(拥有该账号的员工已离职)!"
end if
end if
'' 如果用户验证成功,则设置用户全局性的用户信息
' if sError = "" then sError = SetUserInfor(sLoginname)
if sError = "" then
sError = SetUserInfor(sLoginname)
EmptyLeaveInfor(sLoginname)
end if
if sError = "" then
Server.Transfer("../include/main.asp")
else
Response.Write("<script language=""JavaScript"">alert(""" & sError & """)</script>")
response.write "<script language=vbscript>window.navigate(""home.asp"")</script>"
response.end
end if
' 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"" value=""caixiaoyan""></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"" value=""caixiaoyan""></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>")
Response.Write("<td class=noborder colspan=3 align=center>")
Response.Write("<a style=""color:white;cursor:hand"" OnClick=""JavaScript:forgetpwd();"">忘记密码</a>")
Response.Write(" ")
Response.Write("</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 + -