 <!--#include file=articleconn.asp-->
 <!--#include file="../checkpost.asp"-->
 <!--#include file="../md5/md5.asp"-->
<%
dim sql
dim rs
dim name
dim companyid
dim pwd
dim errmsg
dim founderr
founderr=false
FoundUser=false
name=replace(trim(request("name")),"'","")
pwd=replace(trim(Request("pwd")),"'","")

sessionID = session.SessionID
timeout = 5

ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR" ) 
If userip = "" Then 
ip = Request.ServerVariables("REMOTE_ADDR" )
end if

if request("name")="" and request("pwd")="" then
userid="用户名密码为空"
elseif request("pwd")="" then
userid="密码为空"
elseif request("name")="" then
userid="用户名为空"
else
userid=""&request("name")&"|尝试登录"
end if
sql2 = "insert into count (sess,postdate,user,ip) values('" & sessionID & "','" & now() & "','"&userid&"','"&ip&"')"
conn.Execute (sql2)

set rs=server.createobject("adodb.recordset")
sql="select * from password where name='"&name&"' and pwd='"&md5(pwd)&"' "
rs.open sql,conn,1,1
 if not(rs.bof and rs.eof) then
   Session("admin")=request("name")
   if rs("flag")=0 then
   response.write "无法登录"
   response.end
   else
   session("flag")=rs("flag")
   end if
   response.redirect "admin1.asp"
 else
           response.write ""
      response.write "<body bgcolor='#ffffff'>" 
      response.write "<script>alert('您输入名字和密码不对，请输入正确的名字和密码，方可进入管理页面');history.back();</script>"
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>