<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="UserSession.asp" -->
<!--#include file="UserConn.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>卡号冲值</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
#lltt{ padding-left:10px;}
.STYLE1 {
	color: #FF0000;
	font-weight: bold;
}
.input{ height:15px; width:130px;}
.STYLE2 {color: #FF0000}
-->
</style>
<script src="UserDate.Js"></script> 
</head>
<%
action=Request.QueryString("action")
CardName=NoSqlHack(Request.Form("CardName"))
CardPass=NoSqlHack(Request.Form("CardPass"))
If action="editsave" then
  Set rs = Server.CreateObject("adodb.recordset")
  rs.Open("Select * From qvodcms_card Where cname='"&CardName&"' and cpass='"&CardPass&"' and csart=0 "),Conn,1,3
  If Not(Rs.Eof And Rs.Bof) Then
   cvip=Cint(rs("cvip"))
   if cvip=10 then
      cvip=30
   elseif cvip=30 then
      cvip=92	  
   elseif cvip=50 then
      cvip=180
   elseif cvip=100 then
      cvip=360
   Else
      Call QvodCms_Err("非法卡面额！！！")  
	  Response.End()
   End if  	  
   Call AddCard(cvip)
   rs("csart")=1
   Call QvodCms_Err_Url("冲值成功！","UserWel.asp")
   rs.update
   rs.Close
   Set rs=Nothing
   Response.End()
  Else
   Call QvodCms_Err("冲值卡号或密码错误或此卡无效！！！")
  Response.End()
  End IF	
End If  
Sub AddCard(cvip)
   Set rsc = Server.CreateObject("adodb.recordset")
   rsc.open"Select * From qvodcms_user Where uid="&Uid&"",Conn,1,1
   viptime=rsc("uvip")
   if date()<viptime then
    Conn.Execute("update qvodcms_user Set uvip=uvip+"&cvip&" Where uid="&Uid&"")
   Elseif date()>=viptime Then
    Conn.Execute("update qvodcms_user Set uvip='"&date()+cvip&"' Where uid="&Uid&"")
   End If	
   rsc.Close
   Set rsc=Nothing
   
    Set rsd = Server.CreateObject("adodb.recordset")
    sql = "select * from qvodcms_user where uid="&Uid&""
    rsd.Open sql, Conn, 1, 1
	 if not(rsd.eof and rsd.bof) then
   		Response.Cookies("qvodcms")("UserName") =Trim(rsd("uname"))
		Response.Cookies("qvodcms")("Uid") =CInt(rsd("Uid"))
        Response.Cookies("qvodcms")("Ujf") =CInt(rsd("ujf"))
        Response.Cookies("qvodcms")("Ulc") =Trim(rsd("ulc"))
        Response.Cookies("qvodcms")("Uvip") =rsd("uvip")
		Response.Cookies("qvodcms")("UPic") =CInt(rsd("upic"))
        Response.Cookies("qvodcms")("Utime") =Formatdatetime(rsd("utime"),2)
	 End if	
	 rsd.Close:Set rsd=nothing
End Sub
Call CloseConn()
%>
<body>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px #F1F1F1 solid">
  <tr>
    <td height="25" colspan="2" bgcolor="#F1F4F6" id="lltt" style="color:#ff0000; font-weight:bold">今天是：<script language="javascript">CAL();</script> 我的帐号:<%=UserName%></td>
  </tr>
  <tr>
    <td height="32" colspan="2" align="center"><span class="STYLE1">会员冲值</span></td>
  </tr><form action="?action=editsave" method="post" name="jajacard" onSubmit="return JaJaCard()">
  <tr>
    <td width="12%" height="28"  id="lltt">冲值卡号：</td>
    <td width="88%"><label>
      <input name="CardName" type="text" id="CardName" class="input" maxlength="50" onkeyup='this.value=this.value.replace(/\D/gi,"")'/>
      <span class="STYLE2">* </span></label></td>
  </tr>
  <tr>
    <td width="12%" height="28"  id="lltt">卡号密码：</td>
    <td width="88%"><input name="CardPass" type="text" id="CardPass" class="input"  maxlength="50" onkeyup='this.value=this.value.replace(/\D/gi,"")'/>
      <span class="STYLE2">      * </span></td>
  </tr>
   <tr>
    <td height="28" colspan="2"  id="lltt"><label><span class="STYLE2">说明：10元包月/50元半年/100元包年！</span></label></td>
    </tr>
  <tr>
    <td height="28" colspan="2"  id="lltt"><label><span class="STYLE2">请输入冲值卡号和冲值卡密码完成冲值，帐号积分可以向客服兑换冲值卡哦！</span></label></td>
    </tr>
  <tr>
    <td height="50" colspan="2"  id="lltt"><label>
      <input type="submit" name="button" id="button" value="确认冲值" />
    </label></td>
  </tr></form>
</table>
</body>
</html>
