yns_result.asp
上传用户:yjkj1008
上传日期:2020-10-17
资源大小:1496k
文件大小:15k
源码类别:

电子政务应用

开发平台:

HTML/CSS

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
  2. <!--#include file="Connections/conn_news.asp" --> <% '请尊重作者劳动成果不要删除以上信息 '业一新闻系统3.0正式版 '主页:http://yeyi.net '论坛:http://bbs.yeyi.net '业一网络 承接各种网站制作 '程序开发 软件开发业务 '业务联系 '电话: 13007310512 '联系人:郝亚平 'QQ:24344842 (只谈业务,技术问题请访问论坛) '请尊重作者劳动成果不要删除以上信息 %>
  3. <%
  4. Dim rsn__MMColParam
  5. rsn__MMColParam = "1"
  6. If (Request("n_title")  <> "") Then 
  7.   rsn__MMColParam = Request("n_title") 
  8. End If
  9. %>
  10. <%
  11. Dim rsn__MMColParam2
  12. rsn__MMColParam2 = "1"
  13. If (Request.QueryString("t_id") <> "") Then 
  14.   rsn__MMColParam2 = Request.QueryString("t_id")
  15. End If
  16. %>
  17. <%
  18. ' *** Restrict Access To Page: Grant or deny access to this page
  19. MM_authorizedUsers="1,2,3"
  20. MM_authFailedURL="default.asp"
  21. MM_grantAccess=false
  22. If Session("MM_Username") <> "" Then
  23.   If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
  24.          (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
  25.     MM_grantAccess = true
  26.   End If
  27. End If
  28. If Not MM_grantAccess Then
  29.   MM_qsChar = "?"
  30.   If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  31.   MM_referrer = Request.ServerVariables("URL")
  32.   if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  33.   MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  34.   Response.Redirect(MM_authFailedURL)
  35. End If
  36. %>
  37. <%
  38. Dim rsn
  39. Dim rsn_numRows
  40. Set rsn = Server.CreateObject("ADODB.Recordset")
  41. rsn.ActiveConnection = MM_conn_news_STRING
  42. if Request("n_title")<>"" then
  43. rsn.Source = "SELECT n_id, n_tid, n_title, n_index, n_fname, n_check, t_name  FROM t_news inner join t_type on t_news.n_tid = t_type.t_id  WHERE n_title LIKE '%" + Replace(rsn__MMColParam, "'", "''") + "%'  ORDER BY n_date DESC"
  44. elseif Request.QueryString("t_id")<>"" then
  45. rsn.Source = "SELECT n_id, n_tid, n_title, n_index, n_fname, n_check, t_name  FROM t_news inner join t_type on t_news.n_tid = t_type.t_id  WHERE n_tid = " + Replace(rsn__MMColParam2, "'", "''") + "  ORDER BY n_date DESC"
  46. else
  47. rsn.Source = "SELECT n_id, n_tid, n_title, n_index, n_fname, n_check, t_name  FROM t_news inner join t_type on t_news.n_tid = t_type.t_id  ORDER BY n_date DESC"
  48. end if
  49. rsn.CursorType = 0
  50. rsn.CursorLocation = 2
  51. rsn.LockType = 1
  52. rsn.Open()
  53. rsn_numRows = 0
  54. %>
  55. <%
  56. Dim rst
  57. Dim rst_numRows
  58. Set rst = Server.CreateObject("ADODB.Recordset")
  59. rst.ActiveConnection = MM_conn_news_STRING
  60. rst.Source = "SELECT * FROM t_type"
  61. rst.CursorType = 0
  62. rst.CursorLocation = 2
  63. rst.LockType = 1
  64. rst.Open()
  65. rst_numRows = 0
  66. %>
  67. <%
  68. Dim Repeat1__numRows
  69. Dim Repeat1__index
  70. Repeat1__numRows = 8
  71. Repeat1__index = 0
  72. rsn_numRows = rsn_numRows + Repeat1__numRows
  73. %>
  74. <%
  75. Dim Repeat2__numRows
  76. Dim Repeat2__index
  77. Repeat2__numRows = -1
  78. Repeat2__index = 0
  79. rst_numRows = rst_numRows + Repeat2__numRows
  80. %>
  81. <%
  82. '  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
  83. Dim rsn_total
  84. Dim rsn_first
  85. Dim rsn_last
  86. ' set the record count
  87. rsn_total = rsn.RecordCount
  88. ' set the number of rows displayed on this page
  89. If (rsn_numRows < 0) Then
  90.   rsn_numRows = rsn_total
  91. Elseif (rsn_numRows = 0) Then
  92.   rsn_numRows = 1
  93. End If
  94. ' set the first and last displayed record
  95. rsn_first = 1
  96. rsn_last  = rsn_first + rsn_numRows - 1
  97. ' if we have the correct record count, check the other stats
  98. If (rsn_total <> -1) Then
  99.   If (rsn_first > rsn_total) Then
  100.     rsn_first = rsn_total
  101.   End If
  102.   If (rsn_last > rsn_total) Then
  103.     rsn_last = rsn_total
  104.   End If
  105.   If (rsn_numRows > rsn_total) Then
  106.     rsn_numRows = rsn_total
  107.   End If
  108. End If
  109. %>
  110. <%
  111. ' *** Recordset Stats: if we don't know the record count, manually count them
  112. If (rsn_total = -1) Then
  113.   ' count the total records by iterating through the recordset
  114.   rsn_total=0
  115.   While (Not rsn.EOF)
  116.     rsn_total = rsn_total + 1
  117.     rsn.MoveNext
  118.   Wend
  119.   ' reset the cursor to the beginning
  120.   If (rsn.CursorType > 0) Then
  121.     rsn.MoveFirst
  122.   Else
  123.     rsn.Requery
  124.   End If
  125.   ' set the number of rows displayed on this page
  126.   If (rsn_numRows < 0 Or rsn_numRows > rsn_total) Then
  127.     rsn_numRows = rsn_total
  128.   End If
  129.   ' set the first and last displayed record
  130.   rsn_first = 1
  131.   rsn_last = rsn_first + rsn_numRows - 1
  132.   
  133.   If (rsn_first > rsn_total) Then
  134.     rsn_first = rsn_total
  135.   End If
  136.   If (rsn_last > rsn_total) Then
  137.     rsn_last = rsn_total
  138.   End If
  139. End If
  140. %>
  141. <%
  142. Dim MM_paramName 
  143. %>
  144. <%
  145. ' *** Move To Record and Go To Record: declare variables
  146. Dim MM_rs
  147. Dim MM_rsCount
  148. Dim MM_size
  149. Dim MM_uniqueCol
  150. Dim MM_offset
  151. Dim MM_atTotal
  152. Dim MM_paramIsDefined
  153. Dim MM_param
  154. Dim MM_index
  155. Set MM_rs    = rsn
  156. MM_rsCount   = rsn_total
  157. MM_size      = rsn_numRows
  158. MM_uniqueCol = ""
  159. MM_paramName = ""
  160. MM_offset = 0
  161. MM_atTotal = false
  162. MM_paramIsDefined = false
  163. If (MM_paramName <> "") Then
  164.   MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
  165. End If
  166. %>
  167. <%
  168. ' *** Move To Record: handle 'index' or 'offset' parameter
  169. if (Not MM_paramIsDefined And MM_rsCount <> 0) then
  170.   ' use index parameter if defined, otherwise use offset parameter
  171.   MM_param = Request.QueryString("index")
  172.   If (MM_param = "") Then
  173.     MM_param = Request.QueryString("offset")
  174.   End If
  175.   If (MM_param <> "") Then
  176.     MM_offset = Int(MM_param)
  177.   End If
  178.   ' if we have a record count, check if we are past the end of the recordset
  179.   If (MM_rsCount <> -1) Then
  180.     If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last
  181.       If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
  182.         MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
  183.       Else
  184.         MM_offset = MM_rsCount - MM_size
  185.       End If
  186.     End If
  187.   End If
  188.   ' move the cursor to the selected record
  189.   MM_index = 0
  190.   While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
  191.     MM_rs.MoveNext
  192.     MM_index = MM_index + 1
  193.   Wend
  194.   If (MM_rs.EOF) Then 
  195.     MM_offset = MM_index  ' set MM_offset to the last possible record
  196.   End If
  197. End If
  198. %>
  199. <%
  200. ' *** Move To Record: if we dont know the record count, check the display range
  201. If (MM_rsCount = -1) Then
  202.   ' walk to the end of the display range for this page
  203.   MM_index = MM_offset
  204.   While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
  205.     MM_rs.MoveNext
  206.     MM_index = MM_index + 1
  207.   Wend
  208.   ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  209.   If (MM_rs.EOF) Then
  210.     MM_rsCount = MM_index
  211.     If (MM_size < 0 Or MM_size > MM_rsCount) Then
  212.       MM_size = MM_rsCount
  213.     End If
  214.   End If
  215.   ' if we walked off the end, set the offset based on page size
  216.   If (MM_rs.EOF And Not MM_paramIsDefined) Then
  217.     If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
  218.       If ((MM_rsCount Mod MM_size) > 0) Then
  219.         MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
  220.       Else
  221.         MM_offset = MM_rsCount - MM_size
  222.       End If
  223.     End If
  224.   End If
  225.   ' reset the cursor to the beginning
  226.   If (MM_rs.CursorType > 0) Then
  227.     MM_rs.MoveFirst
  228.   Else
  229.     MM_rs.Requery
  230.   End If
  231.   ' move the cursor to the selected record
  232.   MM_index = 0
  233.   While (Not MM_rs.EOF And MM_index < MM_offset)
  234.     MM_rs.MoveNext
  235.     MM_index = MM_index + 1
  236.   Wend
  237. End If
  238. %>
  239. <%
  240. ' *** Move To Record: update recordset stats
  241. ' set the first and last displayed record
  242. rsn_first = MM_offset + 1
  243. rsn_last  = MM_offset + MM_size
  244. If (MM_rsCount <> -1) Then
  245.   If (rsn_first > MM_rsCount) Then
  246.     rsn_first = MM_rsCount
  247.   End If
  248.   If (rsn_last > MM_rsCount) Then
  249.     rsn_last = MM_rsCount
  250.   End If
  251. End If
  252. ' set the boolean used by hide region to check if we are on the last record
  253. MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
  254. %>
  255. <%
  256. ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
  257. Dim MM_keepNone
  258. Dim MM_keepURL
  259. Dim MM_keepForm
  260. Dim MM_keepBoth
  261. Dim MM_removeList
  262. Dim MM_item
  263. Dim MM_nextItem
  264. ' create the list of parameters which should not be maintained
  265. MM_removeList = "&index="
  266. If (MM_paramName <> "") Then
  267.   MM_removeList = MM_removeList & "&" & MM_paramName & "="
  268. End If
  269. MM_keepURL=""
  270. MM_keepForm=""
  271. MM_keepBoth=""
  272. MM_keepNone=""
  273. ' add the URL parameters to the MM_keepURL string
  274. For Each MM_item In Request.QueryString
  275.   MM_nextItem = "&" & MM_item & "="
  276.   If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
  277.     MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  278.   End If
  279. Next
  280. ' add the Form variables to the MM_keepForm string
  281. For Each MM_item In Request.Form
  282.   MM_nextItem = "&" & MM_item & "="
  283.   If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
  284.     MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  285.   End If
  286. Next
  287. ' create the Form + URL string and remove the intial '&' from each of the strings
  288. MM_keepBoth = MM_keepURL & MM_keepForm
  289. If (MM_keepBoth <> "") Then 
  290.   MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
  291. End If
  292. If (MM_keepURL <> "")  Then
  293.   MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
  294. End If
  295. If (MM_keepForm <> "") Then
  296.   MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
  297. End If
  298. ' a utility function used for adding additional parameters to these strings
  299. Function MM_joinChar(firstItem)
  300.   If (firstItem <> "") Then
  301.     MM_joinChar = "&"
  302.   Else
  303.     MM_joinChar = ""
  304.   End If
  305. End Function
  306. %>
  307. <%
  308. ' *** Move To Record: set the strings for the first, last, next, and previous links
  309. Dim MM_keepMove
  310. Dim MM_moveParam
  311. Dim MM_moveFirst
  312. Dim MM_moveLast
  313. Dim MM_moveNext
  314. Dim MM_movePrev
  315. Dim MM_urlStr
  316. Dim MM_paramList
  317. Dim MM_paramIndex
  318. Dim MM_nextParam
  319. MM_keepMove = MM_keepBoth
  320. MM_moveParam = "index"
  321. ' if the page has a repeated region, remove 'offset' from the maintained parameters
  322. If (MM_size > 1) Then
  323.   MM_moveParam = "offset"
  324.   If (MM_keepMove <> "") Then
  325.     MM_paramList = Split(MM_keepMove, "&")
  326.     MM_keepMove = ""
  327.     For MM_paramIndex = 0 To UBound(MM_paramList)
  328.       MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
  329.       If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
  330.         MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
  331.       End If
  332.     Next
  333.     If (MM_keepMove <> "") Then
  334.       MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
  335.     End If
  336.   End If
  337. End If
  338. ' set the strings for the move to links
  339. If (MM_keepMove <> "") Then 
  340.   MM_keepMove = MM_keepMove & "&"
  341. End If
  342. MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
  343. MM_moveFirst = MM_urlStr & "0"
  344. MM_moveLast  = MM_urlStr & "-1"
  345. MM_moveNext  = MM_urlStr & CStr(MM_offset + MM_size)
  346. If (MM_offset - MM_size < 0) Then
  347.   MM_movePrev = MM_urlStr & "0"
  348. Else
  349.   MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
  350. End If
  351. %>
  352. <html>
  353. <head>
  354. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  355. <title>业一新闻系统3.0正式版-------业一网络Yeyi.net制作</title>
  356. <link href="style/css.css" rel="stylesheet" type="text/css">
  357. </head>
  358. <body bgcolor="#FFFFFF">
  359. <p class="title"><font color="#FF0000">警告!请慎重使用删除命令,没有确认删除,一旦删除不能恢复!</font></p>
  360. <table width="610" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
  361.   <tr> 
  362.     <form name="form2" method="get" action="yns_result.asp">
  363.       <td width="255" height="30" > 
  364.         <input name="n_title" type="text" id="n_title"> <input name="Submit2" type="submit"   value="标题搜索">
  365.         </td>
  366.       <td width="355" height="30" >共有结果 <font color="#FF0000"><%=(rsn_total)%></font>&nbsp; 本页显示第 <font color="#FF0000"><%=(rsn_first)%></font> 到 <font color="#FF0000"><%=(rsn_last)%></font> 记录 </td>
  367.     </form>
  368.   </tr>
  369.   <tr> 
  370.     <td height="3" colspan="2" bgcolor="#CCCCCC"></td>
  371.   </tr>
  372.   <tr> 
  373.     <td height="25" colspan="2" class="bg">| 
  374.       <% 
  375. While ((Repeat2__numRows <> 0) AND (NOT rst.EOF)) 
  376. %>
  377.       <a href="yns_result.asp?t_id=<%=(rst.Fields.Item("t_id").Value)%>"><%=(rst.Fields.Item("t_name").Value)%></a> | 
  378.       <% 
  379.   Repeat2__index=Repeat2__index+1
  380.   Repeat2__numRows=Repeat2__numRows-1
  381.   rst.MoveNext()
  382. Wend
  383. %> </td>
  384.   </tr>
  385. </table>
  386. <p class="title"><font color="#FF0000"></font></p>
  387. <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
  388.   
  389.   <% 
  390. While ((Repeat1__numRows <> 0) AND (NOT rsn.EOF)) 
  391. %>
  392.   <tr> 
  393.     <td width="70%">[<font color="#333333"><%=(rsn.Fields.Item("t_name").Value)%></font>]<a href="<%=(rsn.Fields.Item("n_tid").Value)%>/<%=(rsn.Fields.Item("n_fname").Value)%>" target="_blank"><%=(rsn.Fields.Item("n_title").Value)%></a> <% if rsn("n_index")=true then  %> <font color="#999900">图片新闻</font> <% End If %> </td>
  394.     <% If Session("MM_UserAuthorization")="3" Then %>
  395.     <form name="form1" method="post" action="yns_del.asp">
  396.       <td width="10%"> 
  397.         <input type="submit" name="Submit" value="删除"> <input name="n_fname" type="hidden" id="n_fname" value="<%=(rsn.Fields.Item("n_fname").Value)%>"> 
  398.         <input name="n_id" type="hidden" id="n_id" value="<%=(rsn.Fields.Item("n_id").Value)%>"> 
  399.         <input name="n_fpath" type="hidden" id="n_fpath" value="<%=(rsn.Fields.Item("n_tid").Value)%>"> 
  400.       </td>
  401.     </form>
  402.     <% End If %>
  403.     <% If Session("MM_UserAuthorization")="3" or Session("MM_UserAuthorization")="2" Then %>
  404.     <td width="10%"><a href="yns_updata.asp?n_id=<%=(rsn.Fields.Item("n_id").Value)%>">更新</a> 
  405.     </td>
  406.     <% End If %>
  407.     <% If  Session("MM_UserAuthorization")="2" or Session("MM_UserAuthorization")="3" Then %>
  408.     <form name="form3" method="post" action="yns_check.asp">
  409.       <td width="10%"> 
  410.         <% If rsn.Fields.Item("n_check").Value = false Then %> <input type="submit" name="Submit3" value="未审核"> <input name="n_id" type="hidden" id="n_id" value="<%=(rsn.Fields.Item("n_id").Value)%>"> 
  411.         <input name="n_check" type="hidden" id="n_check2" value="true"> <% Else %> <input type="submit" name="Submit4" value="已审核"> <input name="n_id" type="hidden" id="n_id" value="<%=(rsn.Fields.Item("n_id").Value)%>"> 
  412.         <input name="n_check" type="hidden" id="n_check3" value="false"> <% end if %> </td>
  413.     </form>
  414.     <% End If %>
  415.   </tr>
  416.   <% 
  417.   Repeat1__index=Repeat1__index+1
  418.   Repeat1__numRows=Repeat1__numRows-1
  419.   rsn.MoveNext()
  420. Wend
  421. %>
  422. </table>
  423. <br><br><table border="0" width="50%" align="center">
  424.   <tr> 
  425.     <td width="23%" align="center"> <% If MM_offset <> 0 Then %>
  426.       <a href="<%=MM_moveFirst%>">第一页</a> 
  427.       <% End If ' end MM_offset <> 0 %> </td>
  428.     <td width="31%" align="center"> <% If MM_offset <> 0 Then %>
  429.       <a href="<%=MM_movePrev%>">前一页</a> 
  430.       <% End If ' end MM_offset <> 0 %> </td>
  431.     <td width="23%" align="center"> <% If Not MM_atTotal Then %>
  432.       <a href="<%=MM_moveNext%>">下一页</a> 
  433.       <% End If ' end Not MM_atTotal %> </td>
  434.     <td width="23%" align="center"> <% If Not MM_atTotal Then %>
  435.       <a href="<%=MM_moveLast%>">最后一页</a> 
  436.       <% End If ' end Not MM_atTotal %> </td>
  437.   </tr>
  438. </table>
  439. </body>
  440. </html>
  441. <%
  442. rsn.Close()
  443. Set rsn = Nothing
  444. %>
  445. <%
  446. rst.Close()
  447. Set rst = Nothing
  448. %>