管理员登录_ASP教程-查字典教程网
管理员登录
管理员登录
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:

复制代码 代码如下:<>

<>

<>

<%dimobj

setobj=Newadmin_login

callobj.Main()

setobj=nothing

classadmin_login

PrivateFounderr,errmsg,Mesky

PrivateSubClass_Initialize()

Founderr=False

SetMesky=NewCls_Main

EndSub

PrivateSubClass_Terminate()

SetMesky=Nothing

EndSub

PublicSubMain()

Response.Write"<!DOCTYPEHTMLPUBLIC""-//W3C//DTDHTML4.01Transitional//EN""

""http://www.w3.org/TR/html4/loose.dtd"">"&vbCrLf

Response.Write"<html>"&vbCrLf

Response.Write"<head>"&vbCrLf

Response.Write"<metahttp-equiv=""Content-Type""content=""text/html;charset=gb2312"">"&vbCrLf

Response.Write"<title>管理员登录PoweredBy:Www.Mesky.Net</title>"&vbCrLf

Response.Write"</head>"&vbCrLf

Response.Write"<styletype=text/css>"&vbCrLf

Response.Write"body{"&vbCrLf

Response.Write"background:#EFEFEF;"&vbCrLf

Response.Write"font-size:12px;"&vbCrLf

Response.Write"margin-top:0px;"&vbCrLf

Response.Write"}"&vbCrLf

Response.WritevbCrLf

Response.Write"INPUT{"&vbCrLf

Response.WritevbCrLf

Response.Write"FONT-SIZE:12px;"&vbCrLf

Response.Write"font-family:""宋体"";"&vbCrLf

Response.Write"}"&vbCrLf

Response.Write"SPAN{"&vbCrLf

Response.Write"FONT-SIZE:12px;POSITION:static"&vbCrLf

Response.Write"}"&vbCrLf

Response.Write"a:link,a:visited{"&vbCrLf

Response.Write"color:#0033FF;"&vbCrLf

Response.Write"text-decoration:none;"&vbCrLf

Response.Write"}"&vbCrLf

Response.Write"</style>"&vbCrLf

Response.Write"<p></p>"&vbCrLf

Response.Write"<p></p>"&vbCrLf

Response.Write"<tablealign=centerwidth=380border:outset3px;""cellpadding=0cellspacing=0

ID=""Table1"">"&vbCrLf

Response.Write"<tr>"&vbCrLf

Response.Write"<tdpadding:3px;background-color:blue;color:white;"">LoginMeskyDMSV3

PoweredBy:Www.Mesky.Cn</td>"&vbCrLf

Response.Write"</tr>"&vbCrLf

Response.Write"<trvalign=top>"&vbCrLf

Response.Write"<td><imgsrc=""images/admin_title.gif""width=""100%""></td>"&vbCrLf

Response.Write"</tr>"&vbCrLf

Response.Write"<tr>"&vbCrLf

Response.Write"<tdpadding:15px;"">"&vbCrLf

Dimusername

Dimpassword

Dimip

DimBrowserType

SelectCaseRequest("action")

Case"chklogin"

Callchklogin

IfFounderrThen

Response.Write(errmsg)

Response.Write("<br><br><<=<ahref=""admin_login.asp"">返回管理员登录页</a>")

EndIf

Case"logout"

Calllogout

CaseElse

Calllogin

EndSelect

Response.Write"</td>"&vbCrLf

Response.Write"</tr>"&vbCrLf

Response.Write"<tr><tdpadding:10px;"">"&vbCrLf

SetBrowserType=NewCls_Browser

Response.Write("客户端操作系统:"&BrowserType.platform&"<br>客户端浏览器:"&BrowserType.Browser

&BrowserType.Version)&vbCrLf

SetBrowserType=Nothing

Response.Write"</td></tr>"&vbCrLf

Response.Write"</table><br><br>"&vbCrLf

Response.Write"</body>"&vbCrLf

Response.Write"</html>"&vbCrLf

EndSub

Sublogout()'用户退出

Session("adminName")=""

Session("adminPass")=""

Calllogin

EndSub

Sublogin()'用户登录

OnErrorResumeNext

DimAdos,GetCode

'Ados=Server.CreateObject("Adodb.Stream")

IfErrThen

GetCode=9999

EndIf

Response.Write"<scriptlanguage=""Javascript""><start_of_saved_settings-->"&vbCrLf

Response.Write"<>"&vbCrLf

Response.Write"<>"&vbCrLf

Response.Write"<>"&vbCrLf

Response.Write"<>"&vbCrLf

Response.Write"vartheForm=document.loginform;"&vbCrLf

Response.Write"varnumRE=/^d+$/;"&vbCrLf

Response.Write"varerrMsg="""";"&vbCrLf

Response.Write"varsetfocus="""";"&vbCrLf

Response.WritevbCrLf

Response.Write"if(!numRE.test(theForm['verifycode'].value)){"&vbCrLf

Response.Write"errMsg=""请填写右边的确认密码。"";"&vbCrLf

Response.Write"setfocus=""['verifycode']"";"&vbCrLf

Response.Write"}"&vbCrLf

Response.Write"if(theForm['password'].value==""""){"&vbCrLf

Response.Write"errMsg=""请填写登录密码!"";"&vbCrLf

Response.Write"setfocus=""['password']"";"&vbCrLf

Response.Write"}"&vbCrLf

Response.Write"if(theForm['username'].value==""""){"&vbCrLf

Response.Write"errMsg=""请填写登录用户名!"";"&vbCrLf

Response.Write"setfocus=""['username']"";"&vbCrLf

Response.Write"}"&vbCrLf

Response.Write"if(errMsg!=""""){"&vbCrLf

Response.Write"alert(errMsg);"&vbCrLf

Response.Write"eval(""theForm""+setfocus+"".focus()"");"&vbCrLf

Response.Write"}"&vbCrLf

Response.Write"elsetheForm.submit();"&vbCrLf

Response.Write"}//-->"&vbCrLf

Response.Write"</script>"&vbCrLf

Response.Write"<tableborder=""0"">"&vbCrLf

Response.Write"<formaction=""?action=chklogin""method=""post""name=""loginform""

onsubmit=""VF_loginform();returnfalse;"">"&vbCrLf

Response.Write"<tr>"&vbCrLf

Response.Write"<td><spanwidth:80px;"">用户名:</span></td>"&vbCrLf

Response.Write"<td><inputmaxlength=20type=""text""name=""username""width:200px;""

tabindex=""1""></td>"&vbCrLf

Response.Write"</tr>"&vbCrLf

Response.Write"<tr>"&vbCrLf

Response.Write"<td><spanwidth:80px;"">密码:</span></td>"&vbCrLf

Response.Write"<td><inputmaxlength=20type=""password""name=""password""

width:200px;""></td>"&vbCrLf

Response.Write"</tr>"&vbCrLf

Response.Write"<tr>"&vbCrLf

Response.Write"<td><spanwidth:80px;"">验证码:</span></td>"&vbCrLf

Response.Write"<td><inputname=""verifycode""type=""text""width:60px;""value="""

IfGetCode=9999ThenResponse.Write"9999"

Response.Write"""maxlength=4>"&vbCrLf

Response.Write"请在验证码框输入:<imgsrc=""GetCode.asp""></td>"&vbCrLf

Response.Write"</tr>"&vbCrLf

Response.Write"<tr>"&vbCrLf

Response.Write"<td></td>"&vbCrLf

Response.Write"<tdalign=""right""></td>"&vbCrLf

Response.Write"</tr>"&vbCrLf

Response.Write"<tr>"&vbCrLf

Response.Write"<td></td>"&vbCrLf

Response.Write"<tdalign=""right""><inputtype=""submit""value=""登录...""name=""btnSubmit""

width:80px;font:menu;""ID=""Submit1""></td>"&vbCrLf

Response.Write"</tr>"&vbCrLf

Response.Write"</form>"&vbCrLf

Response.Write"</table>"&vbCrLf

EndSub

'检验用户登录

Subchklogin()

DimUserName,Password,IP

username=Trim(Replace(Request("username"),"'",""))

password=MD5(Trim(Replace(Request("password"),"'","")),16)

IfRequest("verifycode")=""Then

errmsg=errmsg+"<br>"+"<li>请返回输入确认码。"

Founderr=True

ElseIfSession("getcode")="9999"Then

Session("getcode")=""

ElseIfSession("getcode")=""Then

errmsg=errmsg+"<br>"+"<li>请不要重复提交,如需重新登陆请返回登陆页面。"

Founderr=True

ElseIfCStr(Session("getcode"))<>CStr(Trim(Request("verifycode")))Then

errmsg=errmsg+"<br>"+"<li>您输入的确认码和系统产生的不一致,请重新输入。"

Founderr=True

EndIf

Session("getcode")=""

Ifusername=""Orpassword=""Then

Founderr=True

errmsg=errmsg+"<br>"+"<li>请输入您的用户名或密码。<li>"

EndIf

IfFounderrThenExitSub

ip=Replace(Request.ServerVariables("REMOTE_ADDR"),"'","")

DimRs

SetRs=Mesky.Execute("select*fromMesky_SiteManagerwhereusername='"&username&"'")

IfRs.EOFAndRs.BOFThen

SetRs=Nothing

Founderr=True

errmsg=errmsg+"<br>"+"<li>您输入的用户名和密码不正确或者您不是系统管理员。<br><li>请<a

href=admin_login.asp>重新输入</a>您的密码。"

ExitSub

Else

IfTrim(Rs("password"))<>passwordThen

Founderr=True

errmsg=errmsg+"<br>"+"<li>您输入的用户名和密码不正确或者您不是系统管理员。<br><li>请<a

href=admin_login.asp>重新输入</a>您的密码。"

SetRs=Nothing

ExitSub

Else

Session("adminName")=Rs("UserName")

Session("adminPass")=Rs("Password")

Session.Timeout=45

Mesky.Execute("updateMesky_SiteManagersetLastLogin="&SqlNowString&",LastLoginIP='"&ip&

"',LastActive="&SqlNowString&",Logins=Logins+1whereusername='"&username&"'")

SetRs=Nothing

CallMesky.LoadSetting()

Response.Write"<script>location.href='"&Mesky.Setting(11)&"admin_index.asp'</script>"

EndIf

EndIf

EndSub

EndClass%>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类