<!--#include file="conn.asp"-->
<!--#include file="err.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="dengji.asp"-->
<%
dim userid,userpsd,rs,sql
userid=request("username")
userpsd=request("userpassword")
verycode=request("verycode")
    if request("verycode")="" then
    response.write "<script language=javascript>alert('验证码不正确!');history.go(-1);</script>"
  	Response.End 
	elseif session("askgetcode")="9999" then
    session("askgetcode")=""
	elseif session("askgetcode")="" then
    response.write "<script language=javascript>alert('验证码不正确!');history.go(-1);</script>"
 	Response.End 
	elseif cstr(session("askgetcode"))<>cstr(trim(request("verycode"))) then
    response.write "<script language=javascript>alert('验证码不正确!');history.go(-1);</script>"
	Response.End 
	end if

set rs=server.CreateObject("adodb.recordset")
sql ="Select * from kw_user where username='"&userid&"' and userpass='"&md5(userpsd,16)&"'"
rs.open sql,conn,1,3

if rs.eof and rs.bof then
errma "登陆失败","请正确输入用户名和密码" 
else 
rs("jifen")=rs("jifen")+10
rs("lasttime")=now()

       if rs("jifen")>0 and rs("jifen")<=300 then
	   rs("dengji")=dengji1
	   elseif rs("jifen")>300 and rs("jifen")<=1000 then
	   rs("dengji")=dengji2
	   elseif rs("jifen")>1000 and rs("jifen")<=5000 then
	   rs("dengji")=dengji3
	   elseif rs("jifen")>5000 and rs("jifen")<=10000 then
	   rs("dengji")=dengji4
	   elseif rs("jifen")>10000 and rs("jifen")<=20000 then
	   rs("dengji")=dengji5
	   elseif rs("jifen")>20000 and rs("jifen")<=50000 then
	   rs("dengji")=dengji6
	   elseif rs("jifen")>50000 and rs("jifen")<=100000 then
	   rs("dengji")=dengji7
	   elseif rs("jifen")>100000 and rs("jifen")<=500000 then
	   rs("dengji")=dengji8
	   end if

rs.update

session("userid")=userid
session("usertx")=rs("dengji")
   rs.close
   set rs=nothing
   closedb
      if request.Form("comeurl")<>"" then
        response.redirect request.Form("comeurl")
      elseif request.Form("comeurl2")<>"" then
	    response.redirect request.Form("comeurl2")
	  else response.redirect("index.html")
      end if
end if
%>