
已解决问题
谷歌lonoh7540369用户在2016.04.22提交了关于“简爱asp完整登陆代码”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-12-25T17:57:40。希望大家能够帮助她。详细问题描述及疑问:期待您的答案,希望你能感受到,我最真诚的谢意 !
详细问题描述及疑问:期待您的答案,希望你能感受到,我最真诚的谢意 !
asp完整登陆代码
<%
optionexplicit
强
Response.Bu
Response.Expires=-1
Response.Exp
Response.Expires=0
Response.CacheCon
主要是使随机出
%>
<!-
<!DOCTYPE
<h**TML>
<h**E
<TITLE><%=rs_config("c_incname")%>-管理员登录</TITLE>
<metahttp-equiv="Content
<LINKhref="i
<basetarge
<style
<!--
.st
-->
</style>
<SC
<!
functionf
if(theForm.name.value==""){
alert("请输入用户名");
theForm.name.focus();
returnfalse;
}
if(theForm.pass.valu
a
theForm.pass.focus();
r
}
if(theForm.saf
alert("请输入
theForm.safecode.
returnfal
}
returntrue
}
//-->
</SCR
<linkrel="icon"href="/
<linkrel="shortcuticon"href="/f**icon.ico"type="image/x-icon"/>
<META
<LINK
href="images/WEI.css"type=text/cssrel=stylesheet>
<METAcontent="MicrosoftFrontPage4.0"name=GENERATOR>
</h**EAD>
<BODYbgColor=#ffffff>
<BR>
<br>
<br>
<br>
<br>
<BR>
<TABLEalign="center"cellSpacing=0cellPadding=0width=555border=0style="border-collapse:collapse"bordercolor="#111111">
<TBODY>
<TR>
<TDwidth="588">
<TABLEalign="center"cellSpacing=0cellPadding=0width=558border=0style="border-collapse:collapse"bordercolor="#111111">
<TBODY>
<TR>
<TDvAlign=topwidth=""height="104">
<FORMaction=logincheck.aspmethod=POSTtarget="_top">
<tablewidth="600"border="0"align="center"cellpadding="0"cellspacing="0">
<tr>
<tdcolspan="2"><imgsrc="images/Admin_Login1.gif"width="600"height="126"></td>
</tr>
<tr>
<tdwidth="508"valign="top"background="Images/Admin_Login2.gif"><tablewidth="508"border="0"cellspacing="0"cellpadding="0">
<tr>
<tdheight="37"colspan="6"></td>
</tr>
<tr>
<tdwidth="75"rowspan="2"></td>
<tdwidth="126"><fontcolor="#043BC9">用户名称:</font></td>
<tdwidth="39"rowspan="2"></td>
<tdwidth="131"><fontcolor="#043BC9">用户密码:</font></td>
<tdwidth="34"></td>
<tdwidth="103"><fontcolor="#043BC9">验码:<b><fontcolor=#ff0000><IMG
src="inc/Code.asp"width="40"height="10"align="ab**iddle"></font></b></font></td>
</tr>
<tr>
<td><inputname=nameid="name"size=15></td>
<td><inputname=passtype=passwordid="pass"size=12></td>
<td></td>
<td><INPUTname="safecode"type=textid="safecode"size=12></td>
</tr>
</table></td>
<td>
<inputtype="image"name="Submit"src="Images/Admin_Login3.gif"style="width:92px;h**EIGh**T:126px;"></td>
</tr>
</table>
</FORM>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</h**TML>
下面是asp处理文件
<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<!--#includefile="conn.asp"-->
<!--#includefile="md5.asp"-->
<%
functionChkPost()
dimserver_v1,server_v2
chkpost=false
server_v1=Cstr(Request.ServerVariables("h**TTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("**RVER_NAME"))
ifmid(server_v1,8,len(server_v2))<>server_v2then
chkpost=false
else
chkpost=true
Endif
Endfunction
session.Timeout=20
ifChkPost=falsethen
'emsg="请不要从其它站点提交表"
response.Redirect("login.asp?emsg=请不要从其它站点提交表")
Response.End()
Endif
dimaname,apass,FoundErr,ErrMsg
FoundErr=False
aname=replace(trim(request("name")),"'","")
apass=replace(trim(request("pass")),"'","")
safecode=replace(trim(Request("safecode")),"'","")
iflen(aname)>20orlen(aname)<3then
FoundErr=True
ErrMsg=ErrMsg&"用户名不对!nn"
Endif
iflen(apass)>20orlen(apass)<6then
FoundErr=True
ErrMsg=ErrMsg&"用户密码不对!nn"
Endif
ifSafecode=""then
FoundErr=True
ErrMsg=ErrMsg&"验码不能为空!nn"
endif
ifSession("Admin_GetCode")=""then
FoundErr=True
ErrMsg=ErrMsg&"你登录时间过长,请重新返回登录页面进行登录。nn"
endif
ifSafecode<>CStr(Session("Admin_GetCode"))then
FoundErr=True
ErrMsg=ErrMsg&"您输入的确认码和系统**生的不一致,请重新输入。nn"
endif
ifFoundErr=Truethen
CallLoginError(ErrMsg)
Conn.close
SetConn=Nothing
else
apass=md5(apass)
dimsql,rs
sql="selecta_name,a_pass,a_flagfromadminwherea_name='"&aname&"'anda_pass='"&apass&"'"
setrs=server.createobject("adodb.recordset")
***.opensql,conn,1,1
ifrs.BOFandrs.EOFthen
ErrMsg="用户名或是密码错误!"
CallLoginError(ErrMsg)
rs.close
setrs=Nothing
conn.close
setconn=Nothing
response.End
elseifNot(rs.BOForrs.EOF)then
session("aname")=rs("a_name")
session("admin_flag")="into"
session("admin_sys")=rs("a_flag")
response.Redirect("useradmin.asp")
rs.close
setrs=Nothing
conn.close
setconn=Nothing
response.End
Endif
endif
SubLoginError(EMsg)
response.write"<scriptlanguage='j**ascript'>"&chr(13)
response.write"alert('"&EMsg&"');"&Chr(13)
response.write"window.document.location.href='login.asp';"&Chr(13)
response.write"</script>"&Chr(13)
Response.End
EndSub
%>