card.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:13k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../FS_Inc/Const.asp" -->
  3. <!--#include file="../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../FS_Inc/Function.asp" -->
  5. <!--#include file="lib/strlib.asp" -->
  6. <!--#include file="lib/UserCheck.asp" -->
  7. <%
  8. '插入权限
  9. User_GetParm
  10. %>
  11. <html xmlns="http://www.w3.org/1999/xhtml">
  12. <title>点卡冲值-网站内容管理系统</title>
  13. <meta name="keywords" content="风讯cms,cms,FoosunCMS,FoosunOA,FoosunVif,vif,风讯网站内容管理系统">
  14. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  15. <meta content="MSHTML 6.00.3790.2491" name="GENERATOR" />
  16. <meta name="Keywords" content="Foosun,FoosunCMS,Foosun Inc.,风讯,风讯网站内容管理系统,风讯系统,风讯新闻系统,风讯商城,风讯b2c,新闻系统,CMS,域名空间,asp,jsp,asp.net,SQL,SQL SERVER" />
  17. <link href="images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  18. <head>
  19. <body>
  20. <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  21.   <tr>
  22.     <td>
  23.       <!--#include file="top.asp" -->
  24.     </td>
  25.   </tr>
  26. </table>
  27. <table width="98%" height="135" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  28.   
  29.     <tr class="back"> 
  30.       <td   colspan="2" class="xingmu" height="26"> <!--#include file="Top_navi.asp" --> </td>
  31.     </tr>
  32.     <tr class="back"> 
  33.       <td width="18%" valign="top" class="hback"> <div align="left"> 
  34.           <!--#include file="menu.asp" -->
  35.         </div></td>
  36.       <td width="82%" valign="top" class="hback"><table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  37.           <tr class="hback"> 
  38.             
  39.           <td class="hback"><strong>位置:</strong><a href="../">网站首页</a> &gt;&gt; 
  40.             <a href="main.asp">会员首页</a> &gt;&gt; 点卡冲值</td>
  41.           </tr>
  42.         </table>
  43.         <%if Request("action")="submit" then
  44. Call CardSubmit()
  45.  Elseif Request("action")="save" then
  46.   Call savedata()
  47.  Else
  48.   Call InPutCard()
  49.  End if
  50. Sub savedata()
  51. Dim RsCardsaveObj,RsCardsaveSQL,p_strCardNumbersave,p_strCardPasswordsave,p_strCardPointsave,p_strCardMoneysave
  52. p_strCardNumbersave = NoSqlHack(Replace(Request.Form("CardNumber"),"''",""))
  53. p_strCardPasswordsave = NoSqlHack(Replace(Request.Form("CardPasswords"),"''",""))
  54. p_strCardPointsave = NoSqlHack(Replace(Request.Form("CardPoint"),"''",""))
  55. p_strCardMoneysave = NoSqlHack(Replace(Request.Form("CardMoney"),"''",""))
  56. RsCardsaveSQL = "select  CardID,CardNumber,CardPasswords,CardMoney,CardPoint,CardDateNumber,CardOverDueTime,IsUse,UserNumber,UserTime,AddTime,isBuy From FS_ME_Card where CardNumber='"& p_strCardNumbersave &"' and CardPasswords = '"& p_strCardPasswordsave &"'"
  57. Set RsCardsaveObj = server.CreateObject(G_FS_RS)
  58. RsCardsaveObj.Open RsCardsaveSQL,User_Conn,1,3
  59. if RsCardsaveObj.eof then 
  60. strShowErr = "<li>找不到卡号和密码</li>"
  61. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  62. Response.end
  63. Else
  64. if RsCardsaveObj("isUse") = 1 Or Trim(RsCardsaveObj("UserNumber")) <>""  or trim(RsCardsaveObj("UserTime"))<>"" then 
  65. strShowErr = "<li>此点卡已经被使用</li>"
  66. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  67. Response.end
  68. Else
  69. '更新点卡 
  70. Dim RsUpdateCardRSQL,RsUpdateCardRObj
  71. RsUpdateCardRSQL = "select  isuse,UserTime,isBuy,UserNumber From FS_ME_Card where CardNumber='"& p_strCardNumbersave &"'  and CardPasswords = '"& p_strCardPasswordsave &"'" 
  72. Set RsUpdateCardRObj = server.CreateObject(G_FS_RS)
  73. RsUpdateCardRObj.Open RsUpdateCardRSQL,User_Conn,1,3
  74. RsUpdateCardRObj("isuse") = 1
  75. RsUpdateCardRObj("UserNumber") = Fs_User.UserNumber
  76. RsUpdateCardRObj("UserTime") = now
  77. RsUpdateCardRObj("isBuy") = 1
  78. RsUpdateCardRObj.update
  79. RsUpdateCardRObj.close:set RsUpdateCardRObj = nothing
  80. '插入数据,以增加会员的金币或者点数或者天数
  81. '取消天数的冲值,暂时
  82. '**********************************************************
  83. User_conn.execute("Update FS_ME_Users set FS_Money=FS_Money+"& cint(p_strCardMoneysave) &",Integral=Integral+"&clng(p_strCardPointsave)&" where UserNumber='"&Fs_User.UserNumber&"'")
  84. '**********************************************************
  85. dim RsUpdateOrderSQL,RsUpdateOrderObj,tmp_order
  86. tmp_order = year(now)&month(now)&day(now)&"-"&GetRamCode(10)
  87. RsUpdateOrderSQL = "select  * From FS_ME_Order where 1=0"
  88. Set RsUpdateOrderObj = server.CreateObject(G_FS_RS)
  89. RsUpdateOrderObj.Open RsUpdateOrderSQL,User_Conn,1,3
  90. RsUpdateOrderObj.addnew
  91. RsUpdateOrderObj("OrderNumber") = tmp_order
  92. ' RsUpdateOrderObj("ProductNumber") = 1
  93. ' RsUpdateOrderObj("Moneys") = Replace(Request.Form("CardMoney"),"''","")
  94. ' RsUpdateOrderObj("ProductID") = 0
  95. RsUpdateOrderObj("AddTime") = now
  96. RsUpdateOrderObj("IsSuccess") = 1
  97. RsUpdateOrderObj("UserNumber") = Fs_User.UserNumber
  98. RsUpdateOrderObj("OrderType") = 2
  99. RsUpdateOrderObj("M_PayStyle") = 4
  100. RsUpdateOrderObj("M_PayDate") = now 
  101. RsUpdateOrderObj("Content") = "冲值点卡,点卡号:"& p_strCardNumbersave &""
  102. RsUpdateOrderObj("isLock") = 0
  103. RsUpdateOrderObj.update
  104. RsUpdateOrderObj.close:set RsUpdateOrderObj = nothing
  105. Call Fs_User.AddLog("点卡冲值",Fs_User.UserNumber,p_strCardMoneysave,p_strCardPointsave,"点卡冲值",0)
  106. strShowErr = "<li>冲值成功!定单记录为"& tmp_order &"</li>"
  107. Response.Redirect("lib/Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=../Myaccount.asp")
  108. Response.end
  109. End if
  110. End if
  111. RsCardsaveObj.close:set RsCardsaveObj=nothing
  112. End sub
  113. sub InPutCard()
  114. %>
  115.         <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  116.         <form name="form1" method="post" action="Card.asp?action=submit">
  117.           <tr class="hback"> 
  118.             <td width="24%" height="32" class="hback"> <div align="right">卡号</div></td>
  119.             <td width="76%" class="hback"><input name="CardNumber" type="text" id="CardNumber" size="40"> 
  120.             </td>
  121.           </tr>
  122.           <tr class="hback"> 
  123.             <td height="32" class="hback"><div align="right">密码</div></td>
  124.             <td class="hback"><input name="CardPassword" type="password" id="CardPassword" size="40"></td>
  125.           </tr>
  126.           <tr class="hback"> 
  127.             <td height="32" class="hback">&nbsp;</td>
  128.             <td class="hback"><input type="submit" name="Submit" value=" 冲 值 ">
  129.                 
  130.               <input type="reset" name="Submit2" value=" 重 置 "></td>
  131.           </tr>
  132.           <tr class="hback">
  133.             <td height="32" class="hback">&nbsp;</td>
  134.             <td class="hback"><a href="Pay.asp"><strong>在线银行冲值</strong></a></td>
  135.           </tr>
  136.         </form>
  137.       </table>
  138. <%
  139. End sub
  140. Sub CardSubmit()
  141. if trim(Request.Form("CardNumber"))="" or  trim(Request.Form("CardPassword"))=""then
  142. strShowErr = "<li>请输入卡号</li><li>请输入密码</li>"
  143. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  144. Response.end
  145. End if
  146. Dim RsQCardObj,RsCardSQL,p_strCardNumber,p_strCardPassword
  147. Dim p_CardID,p_CardNumber,p_CardPassord,p_CardMoney,p_CardDateNumber
  148. Dim p_CardOverDueTime,p_IsUse,p_UserNumber,p_UserTime,p_AddTime,p_isBuy,p_CardPoint
  149. p_strCardNumber = NoSqlHack(Replace(Request.Form("CardNumber"),"''",""))
  150. p_strCardPassword = NoSqlHack(Replace(Request.Form("CardPassword"),"''",""))
  151. p_strCardPassword = Encrypt(p_strCardPassword) ''加密
  152. RsCardSQL = "select  CardID,CardNumber,CardPasswords,CardMoney,CardPoint,CardDateNumber,CardOverDueTime,IsUse,UserNumber,UserTime,AddTime,isBuy From FS_ME_Card where CardNumber='"& p_strCardNumber &"' and CardPasswords = '"& p_strCardPassword &"'"
  153. Set RsQCardObj = server.CreateObject(G_FS_RS)
  154. RsQCardObj.Open RsCardSQL,User_Conn,1,3
  155. if RsQCardObj.eof then
  156. strShowErr = "<li>无效的点卡</li><li>点卡或者密码错误</li>"
  157. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  158. Response.end
  159.  Else
  160. if RsQCardObj("isUse") = 1 Or Trim(RsQCardObj("UserNumber")) <>""  or trim(RsQCardObj("UserTime"))<>"" then 
  161. strShowErr = "<li>点卡已经被使用</li>"
  162. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  163. Response.end
  164. Elseif RsQCardObj("isUse") = 0 Or Trim(RsQCardObj("UserNumber")) =""  or trim(RsQCardObj("UserTime"))="" then
  165. '定义日期
  166. Dim strCard_month,strCard_day 
  167. if Len(Cstr(month(RsQCardObj("CardOverDueTime"))))<2  then  
  168. strCard_month = "0"&month(RsQCardObj("CardOverDueTime"))
  169. Else
  170. strCard_month = month(RsQCardObj("CardOverDueTime"))
  171. End  if 
  172. if Len(Cstr(day(RsQCardObj("CardOverDueTime"))))<2 then
  173. strCard_day = "0"&day(RsQCardObj("CardOverDueTime"))
  174. Else
  175. strCard_day = day(RsQCardObj("CardOverDueTime"))
  176. End  if
  177. if clng(right(year(RsQCardObj("CardOverDueTime")),2)&strCard_month&strCard_day)< clng(strTodaydate)  then
  178. strShowErr = "<li>点卡已经过期</li>"
  179. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  180. Response.end
  181. Else
  182. p_CardID  = RsQCardObj("CardID")
  183. p_CardNumber  = RsQCardObj("CardNumber")
  184. p_CardPassord  = RsQCardObj("CardPasswords")
  185. if trim(RsQCardObj("CardMoney")) <> "" then
  186. p_CardMoney  = RsQCardObj("CardMoney")
  187. Else
  188. p_CardMoney  = 0
  189. End if
  190. if trim(RsQCardObj("CardPoint")) <> "" then
  191. p_CardPoint  = RsQCardObj("CardPoint")
  192. Else
  193. p_CardPoint  = 0
  194. End if
  195. if trim(RsQCardObj("CardDateNumber")) <> "" then
  196. p_CardDateNumber  = RsQCardObj("CardDateNumber")
  197. Else
  198. p_CardDateNumber  = 0
  199. End if
  200. p_CardOverDueTime  = RsQCardObj("CardOverDueTime")
  201. p_IsUse  = RsQCardObj("isUse")
  202. p_UserNumber  = RsQCardObj("UserNumber")
  203. p_UserTime  = RsQCardObj("UserTime")
  204. p_AddTime  = RsQCardObj("AddTime")
  205. p_isBuy  = RsQCardObj("isBuy")
  206. End if
  207. End if
  208.  End if
  209.  RsQCardObj.close:Set  RsQCardObj = nothing
  210. %>
  211.         <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  212.         <form name="form1" method="post" action="Card.asp?action=save">
  213.           <tr class="hback"> 
  214.             <td width="24%" height="22" class="hback"> <div align="right">点卡面值</div></td>
  215.             <td width="76%" class="hback">
  216. <font style="font-size:20px;color:red;"><i><b><% = p_CardMoney %></b></i></font>&nbsp; <%=p_MoneyName%>
  217.               <input name="CardMoney" type="hidden" id="CardMoney" value="<% = p_CardMoney%>">
  218.               <input name="CardNumber" type="hidden" id="CardNumber" value="<% = p_CardNumber%>">
  219.               <input name="CardPasswords" type="hidden" id="CardPasswords" value="<% = p_CardPassord%>">
  220.             </td>
  221.           </tr>
  222.           <tr class="hback"> 
  223.             <td height="22" class="hback"> <div align="right">点数</div></td>
  224.             <td class="hback"><font style="font-size:20px;color:red;"><i><b>
  225. <% = p_CardPoint %></b></i></font>&nbsp; 点 
  226.               <input name="CardPoint" type="hidden" id="CardPoint" value="<% = p_CardPoint%>"></td>
  227.           </tr>
  228.           <tr class="hback"> 
  229.             <td height="3" class="hback"><div align="right">天数</div></td>
  230.             <td class="hback"><font style="font-size:20px;color:red;"><i><b>
  231. <% = p_CardDateNumber %></b></i></font>&nbsp; 天 
  232.               <input name="CardDateNumber" type="hidden" id="CardDateNumber" value="<% = p_CardDateNumber%>"></td>
  233.           </tr>
  234.           <tr class="hback"> 
  235.             <td height="3" class="hback"><div align="right">过期日期</div></td>
  236.             <td class="hback">
  237. <% = p_CardOverDueTime %>
  238.               <input name="CardOverDueTime" type="hidden" id="CardOverDueTime" value="<% = p_CardOverDueTime %>"></td>
  239.           </tr>
  240.           <tr class="hback"> 
  241.             <td height="32" class="hback">&nbsp;</td>
  242.             <td class="hback"><input type="submit" name="Submit" value="确认冲值"> 
  243.             </td>
  244.           </tr>
  245.         </form>
  246.       </table>
  247. <%End Sub%>
  248.       </td>
  249.     </tr>
  250.     <tr class="back"> 
  251.       <td height="20"  colspan="2" class="xingmu"> <div align="left"> 
  252.           <!--#include file="Copyright.asp" -->
  253.         </div></td>
  254.     </tr>
  255.  
  256. </table>
  257. </body>
  258. </html>
  259. <%
  260. Set Fs_User = Nothing
  261. %>
  262. <!--Powsered by Foosun Inc.,Product:FoosunCMS V4.0系列-->