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

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_Inc/Function.asp" -->
  4. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  5. <!--#include file="../lib/strlib.asp" -->
  6. <!--#include file="../lib/UserCheck.asp" -->
  7. <!--#include file="lib/cls_award.asp"-->
  8. <%'Copyright (c) 2006 Foosun Inc. Code by Einstein.liu
  9. Response.Charset="GB2312"
  10. Dim prizeID,awardID,action,Rs,joinNumber,Integral,PrizeRs,answerID,questionID,rightAnswerID
  11. action=request.QueryString("action")
  12. awardID=NoSqlHack(request.QueryString("awardID"))
  13. prizeID=NoSqlHack(request.QueryString("prizeID"))
  14. Integral=NoSqlHack(request.QueryString("Integral"))
  15. if action="join" then
  16. User_Conn.execute("Insert into FS_ME_User_Prize (prizeid,usernumber,awardID) values("&prizeID&",'"&session("FS_UserNumber")&"',"&awardID&")")
  17. '获得当前参加人数--------------------------------
  18. User_Conn.execute("Update FS_ME_Users set Integral=(Integral-"&Integral&") where usernumber='"&session("FS_UserNumber")&"'")
  19. Response.Write("成功,请关注抽奖结果!")
  20. Call Fs_User.AddLog("积分抽奖",Fs_User.UserNumber,Integral,"0","消耗积分",1)
  21. Set Rs=nothing
  22. elseif action="change" then
  23. Set Rs=User_Conn.execute("Select count(ID) From FS_ME_User_Prize where prizeid="&prizeID&" And usernumber='"&session("FS_UserNumber")&"'")
  24. Set PrizeRs=User_Conn.execute("Select perUserNum from FS_ME_Prize where prizeid="&prizeID)
  25. if not Rs.eof then
  26. if Clng(Rs(0))>Clng(PrizeRs("perUserNum")) or  Clng(Rs(0))=Clng(PrizeRs("perUserNum")) then
  27. Response.Write("每人只能兑换"&PrizeRs("perUserNum")&"次!")
  28. Else
  29. User_Conn.execute("Insert into FS_ME_User_Prize (prizeid,usernumber,winner) values("&prizeID&",'"&session("FS_UserNumber")&"',1)")
  30. User_Conn.execute("Update FS_ME_Users set Integral=(Integral-"&Integral&") where usernumber='"&session("FS_UserNumber")&"'")
  31. Response.Write("兑换成功")
  32. Call Fs_User.AddLog("积分兑换",Fs_User.UserNumber,Integral,"0","消耗积分",1)
  33. End if
  34. Else
  35. User_Conn.execute("Insert into FS_ME_User_Prize (prizeid,usernumber,winner) values("&prizeID&",'"&session("FS_UserNumber")&"',1)")
  36. User_Conn.execute("Update FS_ME_Users set Integral=(Integral-"&Integral&") where usernumber='"&session("FS_UserNumber")&"'")
  37. Call Fs_User.AddLog("积分兑换",Fs_User.UserNumber,Integral,"0","消耗积分",1)
  38. Response.Write("兑换成功")
  39. End if
  40. Rs.close
  41. PrizeRs.close
  42. Set Rs=nothing
  43. Set PrizeRs=nothing
  44. Elseif action="answer" then
  45. questionID=NoSqlHack(request.QueryString("questionID"))
  46. answerID=NoSqlHack(request.QueryString("answerID"))
  47. Set Rs=User_Conn.execute("Select NeedPoint,PrizePoint,RightAnswerID From FS_ME_AnswerForPoint where AID="&answerID)
  48. if not Rs.eof then
  49. if Clng(questionID)=Clng(Rs("RightAnswerID")) then
  50. User_Conn.execute("Insert into FS_ME_Answer_User (questionID,usernumber) values("&answerID&",'"&session("FS_UserNumber")&"')")
  51. User_Conn.execute("Update FS_ME_Users set Integral=(Integral+("&Rs("PrizePoint")&"-"&Rs("NeedPoint")&")) where usernumber='"&session("FS_UserNumber")&"'")
  52. Response.Write("恭喜!回答正确,你将获得积分:"&Rs("PrizePoint"))
  53. Call Fs_User.AddLog("积分问答",Fs_User.UserNumber,Rs("NeedPoint"),"0","消耗积分",1)
  54. Call Fs_User.AddLog("积分问答",Fs_User.UserNumber,Rs("PrizePoint"),"0","获得积分",0)
  55. Else
  56. User_Conn.execute("Update FS_ME_Users set Integral=(Integral-"&Rs("NeedPoint")&") where usernumber='"&session("FS_UserNumber")&"'")
  57. Response.Write("回答错误!")
  58. Call Fs_User.AddLog("积分问答",Fs_User.UserNumber,Rs("NeedPoint"),"0","消耗积分",1)
  59. End if
  60. Else
  61. Response.Write("系统问题,请与管理员联系,积分将不被扣除!")
  62. End if
  63. Elseif action="menu" then
  64. Dim menuAwardObj
  65. Set menuAwardObj=new Cls_Award
  66. if menuAwardObj.activeAward then
  67. Response.write("<img src="""&s_savepath&"/images/active.gif"" border=""0""/>")
  68. End if
  69. End if
  70. Set Conn=nothing
  71. Set User_Conn=nothing
  72. Set Fs_User = Nothing
  73. %>