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

数据库编程

开发平台:

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. 'no cache
  10. response.expires=0 
  11. response.addHeader "pragma" , "no-cache" 
  12. response.addHeader "cache-control" , "private" 
  13. '-------------------------------------------
  14. Dim AnswerRs,awardObj,currentDate,activeTF
  15. activeTF=false
  16. currentDate=DateValue(Now())
  17. if G_IS_SQL_DB=0 then
  18. Randomize
  19. Set AnswerRs=User_Conn.execute("Select top 1 AID from FS_ME_AnswerForPoint where datediff('d',dateValue(AstartDate),'"&currentDate&"')>=0 And datediff('d',dateValue(AEndDate),'"&currentDate&"')<0  order by Rnd(-(AID+"&Rnd()&"))")
  20. ELse
  21. Set AnswerRs=User_Conn.execute("Select top 1 AID from FS_ME_AnswerForPoint where datediff(d,convert(nvarchar(10),AstartDate,120),'"&currentDate&"')>=0 And datediff(d,convert(nvarchar(10),AEndDate,120),'"&currentDate&"')<0 ORDER BY NEWID()")
  22. End if
  23. if not AnswerRs.eof then
  24. Set awardObj=New cls_award
  25. activeTF=true
  26. End if
  27. %>
  28. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  29. <html xmlns="http://www.w3.org/1999/xhtml">
  30. <head>
  31. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  32. <title>CMS4.0</title>
  33. <link href="../images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  34. <style type="text/css">
  35. <!--
  36. body {
  37. margin-left: 0px;
  38. margin-top: 0px;
  39. margin-right: 0px;
  40. margin-bottom: 0px;
  41. }
  42. -->
  43. </style>
  44. <script language="javascript" src="../../FS_Inc/ProtoType.js"></script>
  45. </head>
  46. <body class="hback">
  47. <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  48. <tr>
  49. <td class="xingmu" height="20"><img src="../images/award.gif" alt="积分抽奖" border="0">积分问答 </td>
  50. </tr>
  51. <%if not activeTF then%>
  52. <tr>
  53. <td class="hback"><img src="../images/alert.gif" />暂无问答活动</td>
  54. </tr>
  55. <%Else%>
  56. <tr>
  57.   <td class="hback">
  58.   <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  59. <tr>
  60. <td>
  61. <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
  62. <%
  63. Dim UserRs,Integral'当前会员积分,
  64. Dim onceMoreTF,Rs
  65. onceMoreTF=false
  66. '获得当前会员积分--------------------------------
  67. Set UserRs=User_Conn.execute("Select Integral from FS_ME_Users where UserNumber='"&session("FS_UserNumber")&"'")
  68. if not UserRs.eof then
  69. Integral=UserRs("Integral")
  70. Else
  71. Integral=0
  72. End if
  73. UserRs.close
  74. set UserRs=nothing
  75. '------------------------------------------------
  76. Dim PrizeArray,i,action,answerArray
  77. if not AnswerRs.eof then
  78. Set Rs=User_Conn.execute("Select ID From FS_ME_Answer_User where questionID="&AnswerRs("AID")&" And usernumber='"&session("FS_UserNumber")&"'")
  79. if not Rs.eof then
  80. onceMoreTF=true
  81. End if
  82. awardObj.getAnswerForPoint(AnswerRs("AID"))
  83. Response.Write("<tr>"&vbcrlf)
  84. if Clng(Integral)<Clng(awardObj.answer_NeedPoint) then
  85. action="<img src=""../images/alert.gif""/><font color=""red"">积分不足</font>"
  86. Else
  87. action="<a href=""#"" onClick=""changeAward("&AnswerRs("AID")&","&awardObj.answer_NeedPoint&")""><img src=""../images/bottomduihuan.gif"" border=""0"" alt=""兑换奖品""/></a>"
  88. End if
  89. answerArray=split(awardObj.AnswerIDS,",")
  90. Response.Write("<td class=""hback"">"&vbcrlf)
  91. Response.Write("<table border=""0""  cellpadding=""1"" cellspacing=""1"" width=""100%"" class=""table"">"&vbcrlf)
  92. Response.Write("<tr>"&vbcrlf)
  93. Response.Write("<td colspan=""2"" class=""hback""><img src=""../images/question.gif""/><strong>"&awardObj.ATopic&"</strong>&nbsp;|需要积分:<img src=""../images/moneyOrPoint.gif""/>"&awardObj.answer_NeedPoint&"&nbsp;|奖励积分:<img src=""../images/moneyOrPoint.gif""/><font color=""red"">"&awardObj.PrizePoint&"</font></td>")
  94. Response.Write("</tr>"&vbcrlf)
  95. Response.Write("<tr>"&vbcrlf)
  96. Response.Write("<td width=""10%"" class=""hback""><img src="""&awardObj.APic&""" width=""80"" height=""80"" border=""0""></td>")
  97. Response.Write("<td valign=""top"" class=""hback"">"&awardObj.ADesc&"</td>")
  98. Response.Write("</tr>"&vbcrlf)
  99. for i=0 to Ubound(answerArray)
  100. awardObj.getAnswer(answerArray(i))
  101. Response.Write("<tr>"&vbcrlf)
  102. Response.Write("<td colspan=""2"" class=""hback"" id=""td_"&answerArray(i)&""" onClick=""checkIT($('td_"&answerArray(i)&"'))""><span onClick=""emptyClick()""><input type=""radio"" name=""answer_"&AnswerRs("AID")&""" value="""&answerArray(i)&"""></span><img src=""../images/answer.gif""/>"&awardObj.AnswerDesc&"</td>")
  103. Response.Write("</tr>"&vbcrlf)
  104. next
  105. Response.Write("<tr>"&vbcrlf)
  106. if Clng(Integral)<Clng(awardObj.answer_NeedPoint) then
  107. Response.Write("<td colspan=""2"" class=""hback"">&nbsp;&nbsp;<img src=""../images/alert.gif""/><font color=""red"">积分不足</font></td>")
  108. Elseif onceMoreTF Then
  109. Response.Write("<td colspan=""2"" class=""hback"">&nbsp;&nbsp;<img src=""../images/alert.gif""/><font color=""red"">已参与过</font></td>")
  110. Else
  111. Response.Write("<td colspan=""2"" class=""hback"">&nbsp;&nbsp;&nbsp;&nbsp;<button onClick=""makeAnswer("&AnswerRs("AID")&","&awardObj.answer_NeedPoint&")"">提  交 答 案</button></td>")
  112. End if
  113. Response.Write("</tr>"&vbcrlf)
  114. Response.Write("</table>"&vbcrlf)
  115. Response.Write("</td>")
  116. Response.Write("</tr>"&vbcrlf)
  117. End if
  118. AnswerRs.close
  119. set AnswerRs=nothing
  120. %>
  121. </table>
  122. </td>
  123. </tr>
  124.   </table>
  125.   </td>
  126.   </tr>
  127. <%End if%>
  128. </table>
  129. </body>
  130. </html>
  131. <script language="javascript">
  132. <!--
  133. var tf=true;;
  134. function emptyClick()
  135. {
  136. tf=false;
  137. }
  138. function checkIT(Obj)
  139. {
  140. var answer=Obj.firstChild.firstChild
  141. if(tf)
  142. {
  143. answer.checked=!answer.checked
  144. }
  145. tf=true;
  146. }
  147. function makeAnswer(answerID,Integral)
  148. {
  149. var url="awardAction.asp"
  150. var element=document.all("answer_"+answerID)
  151. var questionID=0;
  152. for(var i=0;i<element.length;i++)
  153. {
  154. if(element[i].checked)
  155. {
  156. questionID=element[i].value;
  157. break;
  158. }
  159. }
  160. var pars="action=answer&answerID="+answerID+"&questionID="+questionID+"&rnd="+Math.random();
  161. if(confirm("确定要进行该操作n该操作将消费积分:"+Integral))
  162. {
  163.  var myAjax = new Ajax.Request(url,{method: 'get', parameters: pars, onComplete: showResponse});
  164. }
  165. function showResponse(originalRequest)
  166. {
  167. var result=originalRequest.responseText;
  168. alert(result);
  169. location="awardAnswer.asp?rnd="+Math.random();
  170. }
  171. }
  172. -->
  173. </script>
  174. <%
  175. Set Conn=nothing
  176. Set User_Conn=nothing
  177. Set Fs_User = Nothing
  178. %>