<!--#include file="../setting/conn.asp"--><!--#include file="../inc/md5.asp"-->
<%
If Not SoonBiz.ismaster Then SoonBiz.Errormess(3000)
Select Case SoonBiz.ract():Case "":loginform():Case "login":SoonBiz.title="管理员登陆":login():End Select:SoonBiz.AdFoot():setallnothing:Sub loginForm():Dim sql:SoonBiz.LoadTemplatesAdmin("admin_login"):sql="select * from ["& sheethead &"_user] where id="&SoonBiz.userid:SoonBiz.topplus="<style type=""text/css"">.main {width:500px;padding:150px 0 0 0;}</style>":SoonBiz.title="管理员登录":SoonBiz.AdHead():HtmlStr=SoonBiz.ReplaceMdb("",sql,template.html(1),"",1):HtmlStr=Replace(HtmlStr,"{$codestr}",SoonBiz.codestr):Response.Write HtmlStr:End Sub:Sub Login():Dim user_name,user_pass:Dim errnum:Dim sql,rs,arrs:SoonBiz.CodeIsTrue:user_name=SoonBiz.RequestStr("用户名称" ,"user_name" ,"post",1,1,16,40,1):user_pass=SoonBiz.RequestStr("登录密码" ,"ad_pass","post",1,1,16,40,1):showerr(""):user_pass=md6(user_name,user_pass):sql="select id,user_pass,setting,user_err,user_logintime from "& sheethead &"_admin where user_name='"&SoonBiz.Checkstr(user_name)&"'":Set rs=SoonBiz.execute(sql)
If rs.bof And rs.eof Then
arrs="":rs.close:Set rs=Nothing
Else:arrs=rs.getrows(1):rs.close:Set rs=Nothing
End If:id=arrs(0,0):errnum=arrs(3,0)
If isdate(arrs(4,0)) Then 
If datediff("d",now,arrs(4,0))=0 Then 
If arrs(3,0) >=loginerr Then
ShowErr("您在今天错误登录次数已经超过"& loginerr &"次,请明天才试")
End If'::_:muchthis~then:aboutcouldmake'butbetweenshouldthese:our
Else:errnum=0:SoonBiz.execute("update "& sheethead &"_admin set user_err=0,user_logintime="& soonbizcom &" where id="&id)
End If
Else :errnum=0:SoonBiz.execute("update "& sheethead &"_admin set user_err=0,user_logintime="& soonbizcom &" where id="&id)
End If
If arrs(1,0)<>user_pass Then 
SoonBiz.execute("update "& sheethead &"_admin set user_err=user_err+1 where id="&id):ShowErr("登录密码错误,今天还可以尝试次数:"& loginerr-errnum):Response.End''did?:onsame"nowstill::might:anotheranother::'#
Else:SoonBiz.execute("update "& sheethead &"_admin set user_err=0 where id="&id)
If Not SoonBiz.ins(Application(CacheName & "_admin"),SoonBiz.user_name&SoonBiz.usertrueip) Then
application.lock:Application(CacheName & "_admin")=Application(CacheName & "_admin") & "," & SoonBiz.user_name&SoonBiz.usertrueip:application.unlock
End If
If savelog=1 Then
sql="insert into "& sheethead &"_login (user_id,user_name,user_nickname,user_pass,user_ip,stime) values (":sql=sql & id:sql=sql & ",'"& user_name & "'":sql=sql & ",'"& SoonBiz.user_nickname & "'":sql=sql & ",'"& user_pass & "'":sql=sql & ",'"& SoonBiz.UserTrueIP &"'":sql=sql & "," & soonbizcom:sql=sql & ")":SoonBiz.execute(sql)'*;more"most$should:take'::'"alsoonly:"
End If:Session("codestr")=empty:response.Redirect "admin_index.asp"
End If:End Sub
%>