<%@ LANGUAGE="VBSCRIPT" %>
<%response.buffer=true%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="functionuser.asp"-->
<LINK href="../css/style.css" rel="stylesheet">
<%
dim cookiepath
cookiepath="/index.html"
founderr=false

UserIP=Request.ServerVariables("REMOTE_ADDR")
	if request("username")="" then
		errmsg=errmsg+""+"请输入您的用户名"
		founderr=true
	else
		username=Checkin(trim(request("username")))
	end if
	if request("password")="" then
		errmsg=errmsg+""+" 请输入您的密码"
		founderr=true
	else
		password=Checkin(trim(request("password")))
	end if
set rs=server.createobject("adodb.recordset")
sql="select username,password,loginIP,Adddate,loginDate,lockuser,id from [user] where username='"&username&"' and password ='"+password+"' and lockuser=0"
rs.open sql,conn,1,3
	
	if rs.bof and rs.eof then
		errmsg=errmsg+""+" 用户名或密码错误"
		founderr=true
		
	
	else 
		rs("loginDate")=NOW()
		rs("loginIP")=Request.ServerVariables("REMOTE_ADDR")
		rs.update
		
		userid=rs("id")
		
		Response.Cookies("tt90music")("username") = username
		Response.Cookies("tt90music")("userid") = UserID
		Response.Cookies("tt90music")("password") = PassWord
	end if



if founderr=true then
    Response.Cookies("tt90music").path=cookiepath
	Response.Cookies("tt90music")("username")=""
	Response.Cookies("tt90music")("password")=""
	Response.Cookies("tt90music")("userid")=""
	Response.Cookies("tt90music")("usercookies")=""
	call error()
else
	response.redirect("userlogin.asp")
end if


%>






