<!--#include file="conn.asp"-->
<!--#include file="inc/md5.asp"-->
<%
Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache"

passcode=request("passcode")
GetCode=replace(trim(session("GetCode")),"'","")
admin=replace(trim(request("namex")),"'","")
pass=replace(trim(request("passx")),"'","")
if Request.ServerVariables("HTTP_X_FORWARDED_FOR") = ""  then
ip=Request.ServerVariables("REMOTE_ADDR")
else
ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
'验证码错误！/////////////////////////////////////////////////////////////////////////////////
if not passcode=GetCode then
Response.Write "<script>alert('登陆失败，验证码错误！');location.href=""login.asp"";</script>"
response.end
else

set rs_rand=server.CreateObject("adodb.recordset")
sql= "select * from com_admin where com_xxx_admin='"&admin&"'"
rs_rand.open sql,conn,1,1
randostr=rs_rand("randchar")
password=md5(pass)
password=password&randostr
password=md5(password)
set rs=server.CreateObject("adodb.recordset")
sql= "select * from com_admin where com_xxx_admin='"&admin&"' and com_xxx_pass='"&password&"' "
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then

' 正确/////////////////////////////////////////////////////////////////

if admin=rs("com_xxx_admin") and password=rs("com_xxx_pass") then
session("admin_xyz")=trim(rs("com_xxx_admin"))
session("vip")=int(rs("vip"))
session("admin")=int(rs("admin"))
session("adminflag")=rs("flag")
session.timeout=1440
response.Redirect "index.asp"
end if
else
'密码或帐号错误////////////////////////////////////////////////////////////
response.write "<script LANGUAGE='javascript'>alert('登陆失败，请检查您的登陆名和密码！');location.href=""login.asp"";</script>"
end if
rs.Close
set rs=nothing

rs_rand.close
set rs_rand=nothing

conn.close
set conn=nothing
end if
%>