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

数据库编程

开发平台:

ASP/ASPX

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <% Option Explicit %>
  3. <%session.CodePage="936"%>
  4. <!--#include file="../FS_Inc/Const.asp" -->
  5. <!--#include file="../FS_InterFace/MF_Function.asp" -->
  6. <!--#include file="../FS_Inc/Function.asp" -->
  7. <%
  8. Response.Buffer = True
  9. Response.Expires = -1
  10. Response.ExpiresAbsolute = Now() - 1
  11. Response.Expires = 0
  12. Response.CacheControl = "no-cache"
  13. response.Charset = "gb2312"
  14. Dim Conn,User_Conn,VS_RS,VS_Sql,VS_RS1,VS_Sql1,VS_RS2,VS_Sql2,strShowErr ,IPInterView,IsSigned, TID,ShowType,ff_row_ii,MaxNum
  15. Dim TmpStr,TmpStr1,Steps,DB_Steps,Cookie_Domain,OutHtmlID,PicW
  16. ff_row_ii = 1 : DB_Steps = 0
  17. MF_Default_Conn
  18. Cookie_Domain = Get_MF_Domain() 
  19. if Cookie_Domain="" then  
  20. Cookie_Domain = "localhost"
  21. else
  22. if left(lcase(Cookie_Domain),len("http://"))="http://" then Cookie_Domain = mid(Cookie_Domain,len("http://")+1)
  23. if right(Cookie_Domain,1)="/" then Cookie_Domain = mid(Cookie_Domain,1,len(Cookie_Domain) - 1)
  24. end if
  25. ''前台页面,由JS调用得到 调用该文件必须给定一些参数.
  26. TID = NoSqlHack(request.QueryString("TID"))
  27. Steps = NoSqlHack(request.QueryString("Steps"))
  28. OutHtmlID = NoSqlHack(request.QueryString("InfoID"))
  29. PicW = request.QueryString("PicW")
  30. if TID="" or not isnumeric(TID) then call HtmEnd("投票参数错误!")
  31. if Steps="" or isnull(Steps) or not isnumeric(Steps) then Steps = 1
  32. if OutHtmlID = "" then OutHtmlID = "Vote_HTML_ID"
  33. if PicW = "" or not isnumeric(PicW) then PicW = 100
  34. ''''''''''''''''''''' 
  35. Call Show
  36. ''''''''''''''''''''
  37. Sub Show()
  38. ''选出最近的一步
  39. VS_Sql2 = "select top 1 * from FS_VS_Steps where TID = "&TID&" and Steps>="&Steps&" order by TID,Steps"
  40. Set VS_RS2 = CreateObject(G_FS_RS)
  41. VS_RS2.Open VS_Sql2,Conn,1,1
  42. if VS_RS2.eof then
  43. VS_Sql = "select * from FS_VS_Theme where TID = "&TID
  44. else
  45. DB_Steps = Conn.execute("select Count(*) from FS_VS_Steps where TID = "&TID)(0)
  46. VS_Sql = "select * from FS_VS_Theme where TID = "&VS_RS2("QuoteID")
  47. end if
  48. If G_IS_SQL_DB = 1 Then
  49. VS_Sql = VS_Sql&" AND (getdate() between StartDate and EndDate)"
  50. else
  51. VS_Sql = VS_Sql&" AND (now() between StartDate and EndDate)"
  52. end if
  53. 'response.Write(VS_Sql)
  54. set VS_RS = Conn.execute(VS_Sql) 
  55. if Not VS_RS.eof then 
  56. if VS_RS("Type") = 2 then 
  57. MaxNum = VS_RS("MaxNum")
  58. else
  59. MaxNum = 1
  60. end if
  61. response.Write("<table width=""100%""  border=""0"" cellspacing=""3"" cellpadding=""0""> "&vbnewline)
  62. response.Write("<form name=voteForm id=voteForm method=""post"" onSubmit=""if(document.getElementById('ItemsInput')!=null){new Ajax.Updater('Ajax_TPInfo', 'http://"&Cookie_Domain&"/Vote/Vote_Ajax.asp?TID="&VS_RS("TID")&"&ItemsInput='+$('ItemsInput').value+'&MaxNum="&MaxNum&"&no-cache='+Math.random() , {method: 'post', parameters: Form.serialize(this) });}; else {new Ajax.Updater('Ajax_TPInfo', 'http://"&Cookie_Domain&"/Vote/Vote_Ajax.asp?TID="&VS_RS("TID")&"&MaxNum="&MaxNum&"&no-cache='+Math.random() , {method: 'post', parameters: Form.serialize(this) });};return false;""> "&vbnewline)
  63. response.Write("<tr> "&vbnewline)
  64. response.Write("<td width=""3%"" height=""18"">&nbsp;</td> "&vbnewline)
  65. response.Write("<td width=""3%""><img src=""Img/3.jpg"" width=""9"" height=""9""></td> "&vbnewline)
  66. response.Write("<td style=""cursor:hand"" onclick=""if(TR_"&VS_RS("TID")&".style.display='none') TR_"&VS_RS("TID")&".style.display=''; else TR_"&VS_RS("TID")&".style.display='none';"">"&VS_RS("Theme")&"</td> "&vbnewline)
  67. response.Write("<td width=""3%"">&nbsp;</td> "&vbnewline)
  68. response.Write("</tr> "&vbnewline)
  69. response.Write("<tr id=""TR_"&VS_RS("TID")&""" style=""display:'none'""> "&vbnewline)
  70. response.Write("<td>&nbsp;</td> "&vbnewline)
  71. response.Write("<td><img src=""Img/5.jpg"" width=""6"" height=""6""></td> "&vbnewline)
  72. response.Write("<td style=""font-size:11px;color:#666666"">Begin:"&formatdatetime(VS_RS("StartDate"),0)&" End:"&formatdatetime(VS_RS("EndDate"),0)&"</td> "&vbnewline)
  73. response.Write("<td>&nbsp;</td> "&vbnewline)
  74. response.Write("</tr> "&vbnewline)
  75. response.Write("<tr> "&vbnewline)
  76. response.Write("<td>&nbsp;</td> "&vbnewline)
  77. response.Write("<td>&nbsp;</td> "&vbnewline)
  78. response.Write("<td> "&vbnewline)
  79. if VS_RS2.eof then 
  80. VS_Sql1 = "select * from FS_VS_Items where TID = "&TID
  81. else
  82. VS_Sql1 = "select * from FS_VS_Items where TID = "&VS_RS2("QuoteID")
  83. end if
  84. Set VS_RS1 = CreateObject(G_FS_RS)
  85. VS_RS1.Open VS_Sql1,Conn,1,1
  86. response.Write( "<!--++++++++++++++++循环主体开始++++++++++++++++-->"&vbnewline )
  87. do while Not VS_RS1.eof
  88. response.Write( radboxItemMode(VS_RS1("ItemMode")) &vbnewline )
  89. ff_row_ii = ff_row_ii + 1
  90. VS_RS1.movenext
  91. loop
  92. response.Write( "<!--++++++++++++++++循环主体结束++++++++++++++++-->"&vbnewline )
  93. VS_RS1.close
  94. response.Write("</td> "&vbnewline)
  95. response.Write("<td>&nbsp;</td> "&vbnewline)
  96. response.Write("</tr> "&vbnewline)
  97. response.Write("<tr> "&vbnewline)
  98. response.Write("<td>&nbsp;</td> "&vbnewline)
  99. response.Write("<td>&nbsp;</td> "&vbnewline)
  100. response.Write("<td align=left> "&vbnewline)
  101. if VS_RS2.recordcount<=0 then 
  102. response.Write("<input type=""submit"" value="" 提 交 "" style=""width:80px;height:23px;""> "&vbnewline)
  103. else
  104. if cint(Steps)>1 then response.Write("<input type=""button"" value="" 上一步 "" style=""width:80px;height:23px; "" onClick=""new Ajax.Updater('"&OutHtmlID&"', 'http://"&Cookie_Domain&"/Vote/Index.asp?no-cache='+Math.random() , {method: 'get', parameters: 'TID="&TID&"&Steps="&Steps-1&"&InfoID="&OutHtmlID&"&PicW="&PicW&"' });""> "&vbnewline)
  105. response.Write("<input type=""submit"" value="" 提 交 "" style=""width:80px;height:23px; ""> "&vbnewline)
  106. if cint(Steps)<DB_Steps then response.Write("<input type=""button"" value="" 下一步 "" style=""width:80px;height:23px; "" onClick=""new Ajax.Updater('"&OutHtmlID&"', 'http://"&Cookie_Domain&"/Vote/Index.asp?no-cache='+Math.random() , {method: 'get', parameters: 'TID="&TID&"&Steps="&Steps+1&"&InfoID="&OutHtmlID&"&PicW="&PicW&"' });""> "&vbnewline)
  107. end if
  108. response.Write(" <input type=""button"" value=""查看结果""  style=""width:80px;height:23px;"" onClick=""window.open('http://"&Cookie_Domain&"/Vote/View.asp?TID="&TID&"&Title="&server.URLEncode(Conn.execute("select Theme from FS_VS_Theme where TID = "&TID)(0))&"');"">")
  109. if VS_RS2.recordcount>0 then response.Write("&nbsp;"&Steps&"/"&DB_Steps&"")
  110. response.Write("</td> "&vbnewline)
  111. response.Write("<td>&nbsp;</td> "&vbnewline)
  112. response.Write("</tr> "&vbnewline)
  113. response.Write("<tr> "&vbnewline)
  114. response.Write("<td>&nbsp;</td> "&vbnewline)
  115. response.Write("<td>&nbsp;</td> "&vbnewline)
  116. response.Write("<td id=""Ajax_TPInfo"">&nbsp;</td> "&vbnewline)
  117. response.Write("<td>&nbsp;</td> "&vbnewline)
  118. response.Write("</tr> "&vbnewline)
  119. response.Write("</form> "&vbnewline)
  120. response.Write("</table> "&vbnewline)
  121. else
  122. response.Write("没有记录. "&vbnewline)
  123. end if
  124. VS_RS.close
  125. VS_RS2.close
  126. End Sub
  127. '选项模式:1:文字描述模式2:自主填写模式(文字后可以多个录入框)3:图片模式
  128. ''单选,多选
  129. Function radboxItemMode(TType)
  130. ''选项名称
  131. Dim ThisFun_Str,f_ItemValue_,rad_box
  132. TmpStr = "" : TmpStr1 = "" : ThisFun_Str = ""
  133. if VS_RS("Type") = 1 then 
  134. rad_box = "radio"
  135. elseif VS_RS("Type") = 2 then 
  136. rad_box = "checkbox"
  137. else
  138. exit function
  139. end if
  140. f_ItemValue_ = VS_RS1("ItemValue")
  141. select case f_ItemValue_
  142. case "1-9"
  143. f_ItemValue_ = ff_row_ii &"."
  144. case "A-Z"
  145. f_ItemValue_ = chr(64+ff_row_ii) &"."
  146. case "a-z"
  147. f_ItemValue_ = chr(96+ff_row_ii) &"."
  148. case else
  149. end select
  150. if VS_RS1("DisColor")<>"" then 
  151. TmpStr = "<font color="""&VS_RS1("DisColor")&""">"&f_ItemValue_&" "&VS_RS1("ItemName")&"</font> "&vbNewLine
  152. else
  153. TmpStr = ""& f_ItemValue_&" "&VS_RS1("ItemName")&" "&vbNewLine
  154. end if
  155. select case TType
  156. case 1
  157. if VS_RS("ItemMode") = 0 then 
  158. ''横向
  159. else
  160. if ff_row_ii mod VS_RS("ItemMode") = 0 then 
  161. TmpStr = TmpStr & "<br /> "&vbNewLine
  162. end if
  163. end if
  164. if request.Cookies("FS_Cookies")(cstr(VS_RS1("TID"))&"_IID")<>"" and instr(cstr(request.Cookies("FS_Cookies")(cstr(VS_RS1("TID"))&"_IID")),","&cstr(VS_RS1("IID"))&",") then
  165. ThisFun_Str = ThisFun_Str & "<input name=""Items"" type="""&rad_box&""" value="""&VS_RS1("IID")&""" checked> "&vbNewLine&TmpStr&vbNewLine
  166. else
  167. ThisFun_Str = ThisFun_Str & "<input name=""Items"" type="""&rad_box&""" value="""&VS_RS1("IID")&"""> "&vbNewLine&TmpStr&vbNewLine
  168. end if
  169. case 2
  170. TmpStr = TmpStr&"<input type=text name=""ItemsInput"" id=""ItemsInput"" value="""&request.Cookies("FS_Cookies")(cstr(VS_RS1("TID"))&"_ItemValue")&""" size=15 maxlength=25> "&vbNewLine
  171. if VS_RS("ItemMode") = 0 then 
  172. ''横向
  173. else
  174. if ff_row_ii mod VS_RS("ItemMode") = 0 then 
  175. TmpStr = TmpStr & "<br /> "&vbNewLine
  176. end if
  177. end if
  178. if request.Cookies("FS_Cookies")(cstr(VS_RS1("TID"))&"_IID")<>"" and instr(cstr(request.Cookies("FS_Cookies")(cstr(VS_RS1("TID"))&"_IID")),","&cstr(VS_RS1("IID"))&",") then
  179. ThisFun_Str = ThisFun_Str & "<input name=""Items"" type="""&rad_box&""" value="""&VS_RS1("IID")&""" checked> "&vbNewLine&TmpStr&vbNewLine
  180. else
  181. ThisFun_Str = ThisFun_Str & "<input name=""Items"" type="""&rad_box&""" value="""&VS_RS1("IID")&"""> "&vbNewLine&TmpStr&vbNewLine
  182. end if
  183. case 3
  184. if VS_RS1("PicSrc")<>"" then 
  185. TmpStr1 = "<img src=""http://"&Cookie_Domain&VS_RS1("PicSrc")&""" title=""点开查看大图:"&f_ItemValue_&" "&VS_RS1("ItemName")&""" onload=""if (this.offsetWidth>"&PicW&") this.width="&PicW&";"" style=""cursor:hand"" onclick=""window.open('http://"&Cookie_Domain&VS_RS1("PicSrc")&"');"" />"
  186. else
  187. TmpStr1 = "<img src=""http://"&Cookie_Domain&"/Vote/Img/NoPic.jpg"" title="""&f_ItemValue_&" "&VS_RS1("ItemName")&""" onload=""if (this.offsetWidth>"&PicW&") this.width="&PicW&";"" />"
  188. end if
  189. if ff_row_ii = 1 then ThisFun_Str = ThisFun_Str & "<table border=0 cellpadding=""0"" cellspacing=""5""><tr> "&vbNewLine
  190. ThisFun_Str = ThisFun_Str & "<td align=center>"&TmpStr1&"<br /> "&vbNewLine
  191. if request.Cookies("FS_Cookies")(cstr(VS_RS1("TID"))&"_IID")<>"" and instr(cstr(request.Cookies("FS_Cookies")(cstr(VS_RS1("TID"))&"_IID")),","&cstr(VS_RS1("IID"))&",") then
  192. ThisFun_Str = ThisFun_Str & "<input name=""Items"" type="""&rad_box&""" value="""&VS_RS1("IID")&""" checked> "&vbNewLine&TmpStr&"</td> "&vbNewLine
  193. else
  194. ThisFun_Str = ThisFun_Str & "<input name=""Items"" type="""&rad_box&""" value="""&VS_RS1("IID")&"""> "&vbNewLine&TmpStr&"</td> "&vbNewLine
  195. end if
  196. if VS_RS("ItemMode") = 0 then 
  197. ''横向
  198. else
  199. if ff_row_ii mod VS_RS("ItemMode") = 0 then 
  200. ThisFun_Str = ThisFun_Str & "</tr><tr> "&vbNewLine
  201. else
  202. end if
  203. end if
  204. if ff_row_ii = VS_RS1.recordcount then ThisFun_Str = ThisFun_Str & "</tr></table> "&vbNewLine
  205. end select
  206. radboxItemMode = ThisFun_Str
  207. End Function
  208. ''====================
  209. Function HtmEnd(Msg)
  210. ConnClose
  211. response.Write(""&Msg&" "&vbnewline)
  212. response.End()
  213. End Function
  214. Sub ConnClose()
  215. Set Conn = Nothing
  216. End Sub
  217. %>