<!--#include file="../inc/admin_conn.asp"-->
<!--#include file="nosql.asp" -->
<!--#include file="../MD5/md5.asp" -->

<%
dim sql
dim rs
dim name
dim companyid
dim pwd
dim errmsg
dim founderr
dim yz

name=nosql(request("name"))
	pwd=md5(nosql(Request("pwd")))
	yz=clng(request("yz"))
        ok=clng(session("ok"))
	usersia_log = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	userip2 = Request.ServerVariables("REMOTE_ADDR")
	
	if not yz=ok then
	  Response.Write "<script language=JavaScript>{window.alert('填入的验证码错误，请重新输入!');window.history.go(-1);}</script>"
	  response.end
    end if

founderr=false
FoundUser=false
name=replace(trim(request("name")),"'","")
pwd=replace(trim(Request("pwd")),"'","")
if name="" or pwd="" then
response.write"<script>alert('帐号密码不能为空！');history.back();</Script>"
response.end
end if
pwd=md5(pwd)


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 ylmv_deng (sess,postdate,user,ip) values('" & sessionID & "','" & now() & "','"&userid&"','"&ip&"')"
conn.Execute (sql2)



set rs=server.createobject("adodb.recordset")
sql="select * from ylmv_admin where name='"&name&"'"
rs.open sql,conn,1,1
 if not(rs.bof and rs.eof) then
 if pwd=rs("pwd") and name=rs("name") then
   Session("admin")="online"
   session("flag")=rs("flag")
   response.redirect "admin.asp"

 else
      response.write "<script>alert('您输入名字和密码不对，请输入正确的名字和密码，方可进入管理页面');history.back();</Script>"
end if
else
response.write "<script>alert('您输入名字和密码不对，请输入正确的名字和密码，方可进入管理页面');history.back();</Script>"
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>