登陆asp class

2018-09-06 12:37

阅读:982

  复制代码 代码如下:
<!--#includefile=conn.asp-->
<!--#includefile=cls_main.asp-->
<!--#includefile=cls_md5.asp-->
<%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
Response.Write<html>&vbCrLf
Response.Write<head>&vbCrLf
Response.Write<metahttp-equiv=Content-Typecontent=text/html;charset=gb2312>&vbCrLf
Response.Write<title>动感下载系统V3.0——管理员登录PoweredBy:</title>&vbCrLf
Response.Write</head>&vbCrLf
Response.Write<styletype=text/css>&vbCrLf
Response.Writebody{&vbCrLf
Response.Writebackground:#EFEFEF;&vbCrLf
Response.Writefont-size:12px;&vbCrLf
Response.Writemargin-top:0px;&vbCrLf
Response.Write}&vbCrLf
Response.WritevbCrLf
Response.WriteINPUT{&vbCrLf
Response.WritevbCrLf
Response.WriteFONT-SIZE:12px;&vbCrLf
Response.Writefont-family:宋体;&vbCrLf
Response.Write}&vbCrLf
Response.WriteSPAN{&vbCrLf
Response.WriteFONT-SIZE:12px;POSITION:static&vbCrLf
Response.Write}&vbCrLf
Response.Writea:link,a:visited{&vbCrLf
Response.Writecolor:#0033FF;&vbCrLf
Response.Writetext-decoration:none;&vbCrLf
Response.Write}&vbCrLf
Response.Write</style>&vbCrLf
Response.Write<p></p>&vbCrLf
Response.Write<p></p>&vbCrLf
Response.Write<tablealign=centerwidth=380style=border:outset3px;cellpadding=0cellspacing=0ID=Table1>&vbCrLf
Response.Write<tr>&vbCrLf
Response.Write<tdstyle=padding:3px;background-color:blue;color:white;>LoginMeskyDMSV3PoweredBy:lt;/td>&vbCrLf
Response.Write</tr>&vbCrLf
Response.Write<trvalign=top>&vbCrLf
Response.Write<td><imgsrc=images/admin_title.gifwidth=100%></td>&vbCrLf
Response.Write</tr>&vbCrLf
Response.Write<tr>&vbCrLf
Response.Write<tdstyle=padding:15px;>&vbCrLf
Dimusername
Dimpassword
Dimip
DimBrowserType


SelectCaseRequest(action)
Casechklogin
Callchklogin
IfFounderrThen
Response.Write(errmsg)
Response.Write(<br><br><<=<ahref=admin_login.asp>返回管理员登录页</a>)
EndIf
Caselogout
Calllogout
CaseElse
Calllogin
EndSelect
Response.Write</td>&vbCrLf
Response.Write</tr>&vbCrLf
Response.Write<tr><tdstyle=padding: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><!--&vbCrLf
Response.WritefunctionVF_loginform(){//v2.0&vbCrLf
Response.Write<!--start_of_saved_settings-->&vbCrLf
Response.Write<!--type,text,name,verifycode,required,true,isNum,errMsg,请填写右边的确认密码。-->&vbCrLf
Response.Write<!--type,password,name,password,required,true,errMsg,请填写登录密码!-->&vbCrLf
Response.Write<!--type,text,name,username,required,true,errMsg,请填写登录用户名!-->&vbCrLf
Response.Write<!--end_of_saved_settings-->&vbCrLf
Response.WritevartheForm=document.loginform;&vbCrLf
Response.WritevarnumRE=/^\d+$/;&vbCrLf
Response.WritevarerrMsg=;&vbCrLf
Response.Writevarsetfocus=;&vbCrLf
Response.WritevbCrLf
Response.Writeif(!numRE.test(theForm[verifycode].value)){&vbCrLf
Response.WriteerrMsg=请填写右边的确认密码。;&vbCrLf
Response.Writesetfocus=[verifycode];&vbCrLf
Response.Write}&vbCrLf
Response.Writeif(theForm[password].value==){&vbCrLf
Response.WriteerrMsg=请填写登录密码!;&vbCrLf
Response.Writesetfocus=[password];&vbCrLf
Response.Write}&vbCrLf
Response.Writeif(theForm[username].value==){&vbCrLf
Response.WriteerrMsg=请填写登录用户名!;&vbCrLf
Response.Writesetfocus=[username];&vbCrLf
Response.Write}&vbCrLf
Response.Writeif(errMsg!=){&vbCrLf
Response.Writealert(errMsg);&vbCrLf
Response.Writeeval(theForm+setfocus+.focus());&vbCrLf
Response.Write}&vbCrLf
Response.WriteelsetheForm.submit();&vbCrLf
Response.Write}//-->&vbCrLf
Response.Write</script>&vbCrLf
Response.Write<tableborder=0>&vbCrLf
Response.Write<formaction=?action=chkloginmethod=postname=loginformonsubmit=VF_loginform();returnfalse;>&vbCrLf
Response.Write<tr>&vbCrLf
Response.Write<td><spanstyle=width:80px;>用户名:</span></td>&vbCrLf
Response.Write<td><inputmaxlength=20type=textname=usernamestyle=width:200px;tabindex=1></td>&vbCrLf
Response.Write</tr>&vbCrLf
Response.Write<tr>&vbCrLf
Response.Write<td><spanstyle=width:80px;>密码:</span></td>&vbCrLf
Response.Write<td><inputmaxlength=20type=passwordname=passwordstyle=width:200px;></td>&vbCrLf
Response.Write</tr>&vbCrLf
Response.Write<tr>&vbCrLf
Response.Write<td><spanstyle=width:80px;>验证码:</span></td>&vbCrLf
Response.Write<td><inputname=verifycodetype=textstyle=width:60px;value=
IfGetCode=9999ThenResponse.Write9999
Response.Writemaxlength=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=submitvalue=登录...name=btnSubmitstyle=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)=9999Then
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>请<ahref=admin_login.asp>重新输入</a>您的密码。
ExitSub
Else
IfTrim(Rs(password))<>passwordThen
Founderr=True
errmsg=errmsg+<br>+<li>您输入的用户名和密码不正确或者您不是系统管理员。<br><li>请<ahref=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%>


评论


亲,登录后才可以留言!