<!--#include file="conn.asp"-->
<!--#include file="func.asp"-->
<%dim adminloginsite,UserPassword,passcode
const adminkeycode="adminsdxsoft" '后台管理认证码，您可以修改成您的管理员认证码：×××××××××
adminloginsite=FormatSQL(replace(trim(request.form("admin")),"'",""))
UserPassword=md5(FormatSQL(replace(trim(request.Form("UserPassword")),"'","")))
adminkey=FormatSQL(replace(trim(request.Form("adminkey")),"'",""))
if adminloginsite="" or UserPassword="" then
response.Write "<script LANGUAGE='javascript'>alert('登录失败！请检查您的登录名和密码！');location.href='login.asp' ;</script>"
conn.Close
set conn=nothing
response.end
end if
if not isnumeric(request.form("passcode")) then
response.Write "<script LANGUAGE='javascript'>alert('登录失败！验证码必须是数字，请正写') ;location.href='login.asp';</script>"
conn.Close
set conn=nothing
response.end
end if
passcode=Cint(request.form("passcode"))
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from admin where UserPassword='"&UserPassword&"' and admin='"&adminloginsite&"' " ,conn,1,1
if rs.bof and rs.eof then
response.write "<script LANGUAGE='javascript'>alert('你的用户名或者密码错误，登录失败！');location.href='login.asp' ;</script>"
rs.Close
set rs=nothing
conn.Close
set conn=nothing
response.end
else
if passcode<>Session("GetCode") then
response.Write "<script LANGUAGE='javascript'>alert('登录失败！验证码错误！');location.href='login.asp' ;</script>"
rs.Close
set rs=nothing
conn.Close
set conn=nothing
response.end
end if
if adminkey<>adminkeycode then
response.Write "<script LANGUAGE='javascript'>alert('登录失败！管理验证码错误！');location.href='login.asp' ;</script>"
rs.Close
set rs=nothing
conn.Close
set conn=nothing
response.end
end if
if UserPassword=rs("UserPassword") and adminloginsite=rs("admin") then
session("admin")=trim(rs("admin"))
session("rank")=int(rs("rank"))
session.Timeout=30
response.Cookies("sundxshop")("admin")=trim(request.form("admin"))
rs.Close
set rs=nothing
conn.Close
set conn=nothing
response.Redirect "index.asp"
else
response.write "<script LANGUAGE='javascript'>alert('你的密码错误，登录失败！');location.href='login.asp';</script>"
rs.Close
set rs=nothing
conn.Close
set conn=nothing
end if
end if
%>