<%@ LANGUAGE="VBSCRIPT" %>
<%response.buffer=true%>
<!--#include file="../5233/conn1.asp"-->
<!--#include file="functionuser.asp"-->

<head>
<LINK href="../css/css.css" rel="stylesheet">
<%
dim cookiepath
cookiepath="/"
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,vipdate,Adddate,sex,loginDate,lockuser,id from [user] where username='"&username&"'"
rs.open sql,conn1,1,3
	
if rs.bof and rs.eof then
	errmsg=errmsg+""+"您输入的用户名并不存在或你的VIP资格尚未审核通过。<br><br><a href='reg.asp'>请先注册</a>"
	founderr=true
	
else
	if rs("password")<>password then
		errmsg=errmsg+""+"您输入的密码不正确。"
		founderr=true
else
dim isvip,usercookies
	isvip=cint(rs("vipdate")-datediff("d",rs("Adddate"),now()))
	if isvip<=0 then
	errmsg=errmsg+""+"你的资格已经到期，请您取得更多的日期。然后联系我们，我们马上帮你开通帐号！<br><br>"
	rs("vipdate")=0
	rs("lockuser")=1
	rs("loginDate")=NOW()
        rs("loginIP")=Request.ServerVariables("REMOTE_ADDR")
	rs.update
	founderr=true
else
                rs("loginDate")=NOW()
                rs("loginIP")=Request.ServerVariables("REMOTE_ADDR")
		rs.update
		 userid=rs("id")
		 Sex=rs("Sex")
usercookies=request("CookieDate")
if isnull(usercookies) or usercookies="" then usercookies="0"
select case usercookies
case "0"
	Response.Cookies("4")("usercookies") = usercookies
case 1
   	Response.Cookies("hryymusic").Expires=Date+1
	Response.Cookies("hryymusic")("usercookies") = usercookies
case 2
	Response.Cookies("hryymusic").Expires=Date+31
	Response.Cookies("hryymusic")("usercookies") = usercookies
case 3
	Response.Cookies("hryymusic").Expires=Date+365
	Response.Cookies("hryymusic")("usercookies") = usercookies
end select
	end if
Response.Cookies("hryymusic")("username") = username
Response.Cookies("hryymusic")("userid") = UserID
Response.Cookies("hryymusic")("password") = PassWord
Response.Cookies("hryymusic")("Sex") = Sex
Response.Cookies("hryymusic")("isvip") = isvip


end if
end if

if founderr=true then
        Response.Cookies("hryymusic").path=cookiepath
	Response.Cookies("hryymusic")("username")=""
	Response.Cookies("hryymusic")("password")=""
	Response.Cookies("hryymusic")("userid")=""
	Response.Cookies("hryymusic")("Sex") =""
	Response.Cookies("hryymusic")("usercookies")=""
	Response.Cookies("hryymusic")("isvip") =""
	call error()
else
	response.redirect("/")
end if
%>
</head>







