<!--#include file="UserConn.asp" -->
<%
Call Chkhttp()
Dim UserName,PassWord,addbox,reurl
action=Request.QueryString("action")
If action="" then
UserName=ReplaceBadChar(NoSqlHack(Request.Form("UserName")))
PassWord=md5(ReplaceBadChar(NoSqlHack(Request.Form("PassWord"))),32)
Reurl=Request.QueryString("reurl")
addbox=Cint(Request.form("addbox"))
If Len(UserName)<2 or len(PassWord)<6 Then
Call QvodCms_Err("请输入正确的用户名和密码")
Response.End()
Else
Set rs = Server.CreateObject("adodb.recordset")
    sql = "select * from qvodcms_user where upass='" & Password & "' and uname='" & UserName & "'"
    rs.Open sql, Conn, 1, 1
    If rs.bof And rs.EOF Then
        Call QvodCms_Err("用户名或密码错误！！！")
		Response.End()
    Else
        If Password <> rs("upass") Then
			Call QvodCms_Err("用户名或密码错误！！！")
			Response.End()
        End If
		Response.Cookies("qvodcms")("UserName") =Trim(rs("uname"))
		Response.Cookies("qvodcms")("Uid") =QvodCms_CLng(rs("Uid"))
        Response.Cookies("qvodcms")("Ujf") =QvodCms_CLng(rs("ujf"))
        Response.Cookies("qvodcms")("Ulc") =Trim(rs("ulc"))
        Response.Cookies("qvodcms")("Uvip") =rs("uvip")
		Response.Cookies("qvodcms")("UPic") =Trim(rs("upic"))
        Response.Cookies("qvodcms")("Utime") =Formatdatetime(rs("utime"),2)
		If addbox=0 then
		Response.Cookies("qvodcms").Expires=dateadd("n",30,now())
		Else
		Response.Cookies("qvodcms").Expires=Date+30
		End if
		rs.Close:Set rs=Nothing
		if Reurl<>"" then
		Response.Write "<script>window.parent.location.href='"&Reurl&"';</script>"
		Else
		Reurl="UserMian.Asp"
		Response.Write "<script>window.parent.location.href='"&Reurl&"';</script>"
		End if
		Response.End()
    End If
End If
Else
        Response.Cookies("qvodcms")("UserName") =""
		Response.Cookies("qvodcms")("Uid") =""
        Response.Cookies("qvodcms")("Ujf") =""
        Response.Cookies("qvodcms")("Ulc") =""
        Response.Cookies("qvodcms")("Uvip") =""
		Response.Cookies("qvodcms")("UPic") =""
        Response.Cookies("qvodcms")("Utime") =""
		if Reurl<>"" then
		Call QvodCms_Err_Url("成功安全退出！！！",Reurl)
		Else
	    Call QvodCms_Err_Url("成功安全退出！！！","../Index.asp")
		End If
		Response.End()
End If
Call CloseConn
%>
