<body >
<%@ LANGUAGE=VBScript codepage ="936" %>
<%Response.Expires=0
Response.Buffer=true
if Trim(Request.Form("B1"))<>"确   定" then Response.Redirect "../chat/readonly/boom.htm"
userid=request("id")
         Set conn=Server.CreateObject("ADODB.CONNECTION")
	     Set rs=Server.CreateObject("ADODB.RecordSet")
	     conn.open Application("zhbg_usermdb")
         rs.open "SELECT * FROM sethyk WHERE name='set'",conn
 phyt=rs("phyt")
 phyf=rs("phyf")
 dhy1t=rs("dhy1t")
 dhy1f=rs("dhy1f")
 dhy2t=rs("dhy2t")
 dhy2f=rs("dhy2f")
 dhy3t=rs("dhy3t")
 dhy3f=rs("dhy3f")
 dhy4t=rs("dhy4t")
 dhy4f=rs("dhy4f")
 m=rs("m")
 j=rs("j")
    rs.close
    rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
if rs("类型")=4 or rs("类型")=2 or rs("类型")=3  then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('此卡不存在');location.href = 'javascript:history.go(-1)';</script>"
	response.end
end if
if rs("点数")<=0  then
if rs("类型")=1 then
rs("类型")=4
rs.Update
end if
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('此卡以作废');location.href = 'javascript:history.go(-1)';</script>"
	response.end
end if
    knum=rs("点数")
    rs.close
	set rs=nothing
	conn.close
	set conn=nothing
select case Trim(Request.Form("R3"))
case "V1"
 if Trim(Request.Form("R1"))="V1" then '是否冲的是天
         Set conn=Server.CreateObject("ADODB.CONNECTION")
	     Set rs=Server.CreateObject("ADODB.RecordSet")
	     conn.open Application("zhbg_usermdb")
         rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
    select case int(abs(Request.form("D1")))
    case 1
    tian=dhy1t
    case 2
    tian=dhy2t
    case 3
    tian=dhy3t
    case 4
    tian=dhy4t
    end select

if int(abs(Request.form("T1")))*tian>knum then
         rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('对不起，您的点数不够！需要"&cstr(int(abs(Request.form("T1")))*tian)&"点');location.href = 'javascript:history.go(-1)';</script>"
	response.end
	else
    rs("点数")=rs("点数")-(int(abs(Request.form("T1")))*tian)
    rs.Update
end if
if int(abs(Request.form("T1")))=0 then
         rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('会员天数不能为0！');location.href = 'javascript:history.go(-1)';</script>"
	response.end
end if


        rs.close
	     set rs=nothing
	     conn.close
	     set conn=nothing
         Set conn=Server.CreateObject("ADODB.CONNECTION")
         Set rs=Server.CreateObject("ADODB.RecordSet")
         conn.open Application("zhbg_usermdb")
         userid=request("id")
         rs.open "SELECT * FROM 用户 WHERE ID="&userid&"",conn,2,2
         if rs("会员等级")<>int(abs(Request.form("D1"))) and rs("会员等级")<>0 then 
     rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('对不起，请刷新冲卡页面在进行操作');location.href = 'javascript:history.go(-1)';</script>"
	response.end

         end if
        if rs("会员等级")>0 then
         hydate=dateadd("d",int(abs(Request.form("T1"))),rs("会员日期"))
         rs("会员日期")=hydate
         rs.Update
	     else'是否会员判断-否则
         hydate=dateadd("d",int(abs(Request.form("T1"))),date())
         rs("会员等级")=int(abs(Request.form("D1")))
        rs("会员日期")=hydate
   if int(abs(Request.form("D1")))=1 then jy=31250
   if int(abs(Request.form("D1")))=2 then jy=90000
   if int(abs(Request.form("D1")))=3 then jy=250000
   if int(abs(Request.form("D1")))=4 then jy=490000
		rs("allvalue")=rs("allvalue")+jy
      	rs.Update
      end if'是否会员判断结束   
    rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	else'是否选择冲天---否则	
    
    
         Set conn=Server.CreateObject("ADODB.CONNECTION")
         Set rs=Server.CreateObject("ADODB.RecordSet")
         conn.open Application("zhbg_usermdb")
         userid=request("id")
         rs.open "SELECT * FROM 用户 WHERE ID="&userid,conn,2,2
        if rs("会员等级")>0 then
   rs.close
	set rs=nothing
	conn.close
	set conn=nothing
        Set conn=Server.CreateObject("ADODB.CONNECTION")
	     Set rs=Server.CreateObject("ADODB.RecordSet")
	     conn.open Application("zhbg_usermdb")
   rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
   rs("类型")=4
   rs.Update
   rs.close
   rs.open "SELECT * FROM 会员卡 WHERE 类型=3 and 用户ID="&userid,conn,2,2
   select case int(abs(Request.form("D1")))
   case 1
   rs("时间")=rs("时间")+int(knum/dhy1f*100)
   case 2
   rs("时间")=rs("时间")+int(knum/dhy2f*100)
   case 3
   rs("时间")=rs("时间")+int(knum/dhy3f*100)
   case 4
   rs("时间")=rs("时间")+int(knum/dhy4f*100)
   end select
   rs.Update
	     else'是否会员判断-否则
        rs("会员等级")=int(abs(Request.form("D1")))
  if int(abs(Request.form("D1")))=1 then jy=31250
   if int(abs(Request.form("D1")))=2 then jy=90000
   if int(abs(Request.form("D1")))=3 then jy=250000
   if int(abs(Request.form("D1")))=4 then jy=490000
	rs("allvalue")=rs("allvalue")+jy
      	rs.Update
  rs.close
	set rs=nothing
	conn.close
	set conn=nothing
Set conn=Server.CreateObject("ADODB.CONNECTION")
	     Set rs=Server.CreateObject("ADODB.RecordSet")
	     conn.open Application("zhbg_usermdb")
   rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
rs("类型")=3
rs("点数")=0
    select case int(abs(Request.form("D1")))
    case 1
    rs("时间")=int(knum/dhy1f*100)
    case 2
    rs("时间")=int(knum/dhy2f*100)
    case 3
    rs("时间")=int(knum/dhy3f*100)
    case 4
    rs("时间")=int(knum/dhy4f*100)
    end select
    rs("用户ID")=userid
    rs.Update
     end if'是否会员判断结束   
    rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	end if'是否选择从冲判断结束	
		Response.Write "<script Language=Javascript>alert('充卡成功！');location.href = 'javascript:history.go(-1)';</script>"
case "V2"'***************************************************************************************************************
 if Trim(Request.Form("R2"))="V1" then '是否冲的是天
         Set conn=Server.CreateObject("ADODB.CONNECTION")
	     Set rs=Server.CreateObject("ADODB.RecordSet")
	     conn.open Application("zhbg_usermdb")
         rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
if int(abs(Request.form("T2")))*phyt>knum then
         rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('对不起，您的点数不够！需要"&cstr(int(abs(Request.form("T2")))*phyt)&"点');location.href = 'javascript:history.go(-1)';</script>"
	response.end
	else
    rs("点数")=rs("点数")-(int(abs(Request.form("T2")))*phyt)
    rs.Update
end if
if int(abs(Request.form("T2")))=0 then
         rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('会员天数不能为0！');location.href = 'javascript:history.go(-1)';</script>"
	response.end
end if
        rs.close
	     set rs=nothing
	     conn.close
	     set conn=nothing
         Set conn=Server.CreateObject("ADODB.CONNECTION")
         Set rs=Server.CreateObject("ADODB.RecordSet")
         conn.open Application("zhbg_usermdb")
         userid=request("id")
         rs.open "SELECT * FROM 用户 WHERE ID="&userid&"",conn,2,2
        if rs("会员") then
         hydate=dateadd("d",int(abs(Request.form("T2"))),rs("会员结束"))
         rs("会员结束")=hydate
         rs.Update
	     else'是否会员判断-否则
         hydate=dateadd("d",int(abs(Request.form("T2"))),date())
       rs("会员")=true 
       rs("会员结束")=hydate
      	rs.Update
      end if'是否会员判断结束   
    rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	else'是否选择冲天---否则	
         Set conn=Server.CreateObject("ADODB.CONNECTION")
         Set rs=Server.CreateObject("ADODB.RecordSet")
         conn.open Application("zhbg_usermdb")
         userid=request("id")
         rs.open "SELECT * FROM 用户 WHERE ID="&userid,conn,2,2
        if rs("会员") then
   rs.close
	set rs=nothing
	conn.close
	set conn=nothing
        Set conn=Server.CreateObject("ADODB.CONNECTION")
	     Set rs=Server.CreateObject("ADODB.RecordSet")
	     conn.open Application("zhbg_usermdb")
   rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
   rs("类型")=4
   rs.Update
   rs.close
   rs.open "SELECT * FROM 会员卡 WHERE 类型=2 and 用户ID="&userid,conn,2,2
  rs("时间")=rs("时间")+int(knum/phyf*100)
  rs.Update
  else'是否会员判断-否则
         hydate=dateadd("d",int(abs(Request.form("T2"))),date())
       rs("会员")=true 
       rs("会员结束")=hydate
	set rs=nothing
	conn.close
	set conn=nothing
Set conn=Server.CreateObject("ADODB.CONNECTION")
	     Set rs=Server.CreateObject("ADODB.RecordSet")
	     conn.open Application("zhbg_usermdb")
   rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
rs("类型")=2
rs("点数")=0
rs("时间")=int(knum/phyf*100)
    rs("用户ID")=userid
    rs.Update
     end if'是否会员判断结束   
    rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	end if'是否选择从冲判断结束	
		Response.Write "<script Language=Javascript>alert('充卡成功！');</script>"
case "V3"
if int(abs(Request.form("T3"))*m/10000000)+1>knum then
	Response.Write "<script Language=Javascript>alert('对不起，您的点数不够！需要"&cstr(int(abs(Request.form("T3"))*m/10000000))&"点');location.href = 'javascript:history.go(-1)';</script>"
	response.end
   else
             Set conn=Server.CreateObject("ADODB.CONNECTION")
         Set rs=Server.CreateObject("ADODB.RecordSet")
         conn.open Application("zhbg_usermdb")
         userid=request("id")
         rs.open "SELECT * FROM 用户 WHERE ID="&userid&"",conn,2,2
         rs("银两")=rs("银两")+int(abs(Request.form("T3")))
         rs.Update
         rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Set conn=Server.CreateObject("ADODB.CONNECTION")
	Set rs=Server.CreateObject("ADODB.RecordSet")
	conn.open Application("zhbg_usermdb")
    rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
    rs("点数")=rs("点数")-int(abs(Request.form("T3"))*m/10000000)-1
    rs.Update
    rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('买银子成功');location.href = 'javascript:history.go(-1)';</script>"
end if
case "V4"
if int(abs(Request.form("T4"))*j)>knum then
	Response.Write "<script Language=Javascript>alert('对不起，您的点数不够！需要"&cstr(int(abs(Request.form("T4"))*j))&"点');location.href = 'javascript:history.go(-1)';</script>"
	response.end
   else
         Set conn=Server.CreateObject("ADODB.CONNECTION")
         Set rs=Server.CreateObject("ADODB.RecordSet")
         conn.open Application("zhbg_usermdb")
         userid=request("id")
         rs.open "SELECT * FROM 用户 WHERE ID="&userid&"",conn,2,2
         rs("会员金卡")=rs("会员金卡")+int(abs(Request.form("T4")))
         rs.Update
         rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	 Set conn=Server.CreateObject("ADODB.CONNECTION")
	     Set rs=Server.CreateObject("ADODB.RecordSet")
	     conn.open Application("zhbg_usermdb")
   rs.open "SELECT * FROM 会员卡 WHERE 卡号='"&request("kname")&"'",conn,2,2
   rs("点数")=rs("点数")-int(abs(Request.form("T4"))*j)
         rs.Update
  rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script Language=Javascript>alert('买金卡成功！');location.href = 'javascript:history.go(-1)';</script>"
end if
case else
	Response.Write "<script Language=Javascript>alert('您必须选定一个项目！');location.href = 'javascript:history.go(-1)';</script>"
	response.end

end select
%>