Admin_Link.asp
上传用户:angela
上传日期:2022-05-11
资源大小:853k
文件大小:12k
源码类别:

外挂编程

开发平台:

ASP/ASPX

  1. <!--#include file="setup.asp"-->
  2. <!--#include file="check.asp"-->
  3. <%
  4. If Not CheckAdmin("FriendLink") Then
  5.         Server.Transfer("showerr.asp")
  6.         Response.End
  7. End If
  8. '=====================================================================
  9. ' 作者声明:转载请保留版权信息,鄙视不要脸的人
  10. '=====================================================================
  11. ' 程序名称:蓝宇网络发布系统
  12. ' 程序作者:蓝宇 QQ:18159079 ╲、随心゛ QQ:6821845
  13. ' 文件名称:Admin_Link.asp
  14. ' 更新日期:2007-6-5
  15. '=====================================================================
  16. ' 联系方式:Tel:13203117383,QQ:18159079,hi.baidu.com/hezeyu
  17. ' 程序开发:蓝宇,╲、随心゛
  18. ' 官方网站:蓝宇网络(http://hi.baidu.com/hezeyu)
  19. '=====================================================================
  20. ' Copyright 2004-2007 蓝宇 - All Rights Reserved.
  21. '=====================================================================
  22. Dim TotalNumber,TotalPageNum,CurrentPage,maxperpage
  23. titlename="站点友情连接"
  24. Admin_header
  25. Response.Write "<table border=""0"" cellspacing=""1"" cellpadding=""3"" align=center class=""tableBorder"">"
  26. Response.Write " <tr>"
  27. Response.Write " <th colspan=6>友情连接管理</th>"
  28. Response.Write " </tr>"
  29. Response.Write " <form name=""searchsoft"" method=""POST"" action=""admin_link.asp"" target=""main"">"
  30. Response.Write " <tr>"
  31. Response.Write " <td colspan=6 " & LeftClass & "><b>管理选项:</b>"
  32. Response.Write " <a href=""admin_link.asp"">友情链接首页</a> | <a href=""admin_link.asp?action=add"">增加新的友情链接</a>"
  33. Response.Write " </td>"
  34. Response.Write " </tr>"
  35. Response.Write " </form>"
  36. Response.Write " </table><br>"
  37. Action = LCase(Request("action"))
  38. Select Case Trim(Action)
  39. Case "add"
  40.         Call addLink()
  41. Case "edit"
  42.         Call editLink()
  43. Case "del"
  44.         Call delLink()
  45. Case "saveadd"
  46.         Call saveadd()
  47. Case "savedit"
  48.         Call saveedit()
  49. Case Else
  50.         Call linklist()
  51. End Select
  52. If Founderr = True Then
  53.         ReturnError(ErrMsg)
  54. End If
  55. Admin_footer
  56. CloseConn
  57. '友情连接列表
  58. sub linklist()
  59. Dim i,tablestyle
  60. Dim maxperpage,CurrentPage,Pcount,totalrec,totalnumber
  61. maxperpage = AdminPage
  62. totalrec = 0
  63. Pcount = 1
  64. CurrentPage = tee5.ChkNumeric(Request("page"))
  65. If CurrentPage = 0 Then CurrentPage = 1
  66. Response.Write "<script src=""/js/showpage.js"" type=""text/javascript""></script>" & vbCrLf
  67.         Response.Write "<table border=""0"" cellspacing=""1"" cellpadding=""3"" align=center class=""tableBorder"">"
  68.         Response.Write " <tr>"
  69.         Response.Write " <th width=""5%"">选择</td>"
  70.         Response.Write " <th width=""15%"">类 型</th>"
  71.         Response.Write " <th width=""25%"">地 址</th>"
  72.         Response.Write " <th width=""*"">描 述</th>"
  73.         Response.Write " <th width=""10%"">首 页</th>"
  74.         Response.Write " <th width=""15%"">操 作</th>"
  75.         Response.Write " </tr><form name=""selform"" method=""post"" action=""?action=del"">"
  76. set rs = server.createobject("adodb.recordset")
  77. sql="select * from Gq_link order by linktype,id asc"
  78. rs.open sql,conn,1,1
  79. if rs.eof and rs.bof then 
  80. response.write "<tr><td align='center' class=tablerow1 colspan=6>当前没有友情连接</td></tr>" 
  81. else
  82. totalrec = Rs.RecordCount
  83. Pcount = CLng(totalrec / maxperpage)  '得到总页数
  84. If Pcount < totalrec / maxperpage Then Pcount = Pcount + 1
  85. If CurrentPage < 1 Then CurrentPage = 1
  86. If CurrentPage > Pcount Then CurrentPage = Pcount
  87. Rs.PageSize = maxperpage
  88. Rs.AbsolutePage = CurrentPage
  89. i = 0
  90. Do While Not Rs.EOF And i < maxperpage
  91. If Not Response.IsClientConnected Then ResponseEnd
  92. Response.Write " <tr>"
  93. Response.Write " <td " & CenterClass & "><input type=""checkbox"" name=""id"" value="""
  94. Response.Write Rs("id")
  95. Response.Write """></td>"
  96. Response.Write " <td " & CenterClass & ">"
  97. if rs("linktype")=1 then Response.Write "<img src=" & rs("imgurl") & " border=0 width=88 height=31>": Else Response.Write "文字连接"
  98.                         Response.Write "</td>"
  99. Response.Write " <td " & LeftClass & ">"
  100. Response.Write Rs("imglink")
  101. Response.Write "</td>"
  102. Response.Write " <td " & LeftClass & ">"
  103. Response.Write Rs("title")
  104. Response.Write "</td>"
  105. Response.Write " <td " & CenterClass & ">"
  106.                         If Rs("top") = 1 Then
  107.                                 Response.Write "<span Class=style1>是</span>"
  108.                         Else
  109.                                 Response.Write "<span Class=style2>否</span>"
  110.                         End If
  111. Response.Write "</td>"
  112. Response.Write " <td " & CenterClass & "> <a href=""admin_link.asp?action=edit&id="
  113. Response.Write Rs("id")
  114. Response.Write """>编 辑</a> | <a href=""admin_link.asp?action=del&id="
  115. Response.Write Rs("id")
  116. Response.Write """>删 除</a></td>"
  117.                         Response.Write " </tr>"
  118. Rs.movenext
  119. i = i + 1
  120. If i >= maxperpage Then Exit Do
  121. Loop
  122. End If
  123. Rs.Close:Set Rs = Nothing
  124. Response.Write "<TR height=25>" & vbCrLf
  125. Response.Write "<TD " & LeftClass & " colspan=6><B>操作选项:<B> "
  126. Response.Write "<input class=Button type=button value='全选' onClick=""CheckAll(this.form)"">"
  127. Response.Write "<input class=Button type=button value='撤消' onClick=""CheckCel(this.form)"">"
  128. Response.Write "<input class=Button type=button value='反选' onClick=""CheckSel(this.form)""> "
  129. Response.Write "<input class=Button type=submit name=act value=批量删除  onclick=""{if(confirm('您确定执行的操作吗?')){this.document.even.submit();return true;}return false;}""> "
  130. Response.Write "</TR>" & vbCrLf
  131. Response.Write "</form>" & vbCrLf
  132. Response.Write "<TR height=25>" & vbCrLf
  133. Response.Write "<TD " & RightClass & " colspan=6>" & vbCrLf
  134. tee5.ShowListPage CurrentPage,Pcount,totalrec,maxperpage,"","友情连接"
  135. Response.Write "</TD></TR></TABLE>" & vbCrLf
  136. End Sub
  137. sub addLink()
  138. %>
  139. <form action="?action=saveadd" method=post>
  140. <table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
  141. <tr> 
  142. <th colspan="3">连接管理--添加连接</th>
  143. </tr>
  144. <tr>
  145. <td width="12%" align="right" class="TableRow1">连接名称:</td>
  146. <td class="TableRow1"><input name="title" type="text" size="40"></td>
  147. </tr>
  148. <tr>
  149. <td width="12%" align="right" class="TableRow1">连接地址:</td>
  150. <td class="TableRow1"><input name="imglink" type="text" size="40"></td>
  151. </tr>
  152. <tr>
  153. <td width="12%" align="right" class="TableRow1">连接LOGO:</td>
  154. <td class="TableRow1"><input name="imgurl" type="text" size="40"></td>
  155. </tr>
  156. <tr>
  157. <td width="12%" align="right" class="TableRow1">连接类型:</td>
  158. <td class="TableRow1"><input type="radio" name="LinkType" value="0" checked>文字连接 <input type="radio" name="LinkType" value="1">图片连接</td>
  159. </tr>
  160. <tr>
  161. <td width="12%" align="right" class="TableRow1">首页推荐:</td>
  162. <td class="TableRow1"><input type="checkbox" name="top" value="1"> 是否首页显示</td>
  163. </tr>
  164. <tr>
  165. <td class="TableRow1" colspan="2" height="30" align="center"><input class=Button type=submit value=" 增 加 "></td>
  166. </tr>
  167. </table>
  168. </form>
  169. <% end sub %>
  170. <%
  171. '友情连接编辑
  172. Sub EditLink()
  173. set rs = server.createobject("adodb.recordset")
  174. sql="select * from Gq_link where id=" & request("id")
  175. rs.open sql,conn,1,1
  176. if rs.eof and rs.bof then
  177. rs.close
  178. call closeconn()
  179. response.write "<script>alert('此连接不存在');history.back()</script>"
  180. else
  181. %>
  182. <form action="?action=savedit&id=<%=request("id")%>" method=post>
  183. <table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
  184. <tr>
  185. <th colspan="3">连接管理--修改连接</th>
  186. </tr>
  187. <tr>
  188. <td width="12%" align="right" class="TableRow1">连接名称:</td>
  189. <td class="TableRow1"><input name="title" type="text" value="<%=rs("title")%>" size="40"></td>
  190. </tr>
  191. <tr>
  192. <td width="12%" align="right" class="TableRow1">连接地址:</td>
  193. <td class="TableRow1"><input name="imglink" type="text" value="<%=rs("imglink")%>" size="40"></td>
  194. </tr>
  195. <tr>
  196. <td width="12%" align="right" class="TableRow1">连接LOGO:</td>
  197. <td class="TableRow1"><input name="imgurl" type="text" value="<%=rs("imgurl")%>" size="40"></td>
  198. </tr>
  199. <tr>
  200. <td width="12%" align="right" class="TableRow1">连接类型:</td>
  201. <td class="TableRow1">
  202. <input type="radio" name="LinkType" value="0" <%if rs("LinkType")=0 then response.write "checked" end if%>> 文字连接
  203. <input type="radio" name="LinkType" value="1" <%if rs("LinkType")=1 then response.write "checked" end if%>> 图片连接
  204. </td>
  205. </tr>
  206. <tr>
  207. <td width="12%" align="right" class="TableRow1">首页推荐:</td>
  208. <td class="TableRow1"><input name="top" type="checkbox" id="top" value="yes" <%if rs("top")=1 then response.write "checked"%>> 是否首页显示</td>
  209. </tr>
  210. <tr>
  211. <td class="TableRow1" colspan="2" height="30" align="center"><input class=Button type=submit value=" 修 改 "></td>
  212. </tr>
  213. </table>
  214. </form>
  215. <%
  216. rs.Close
  217. call closeconn()
  218. end if
  219. end sub
  220. %>
  221. <%
  222. '保存新增加连接
  223. sub saveadd()
  224. dim imgurl,imglink,title,linktype
  225. imgurl=tee5.CheckStr(trim(request.form("imgurl")))
  226. imglink=tee5.CheckStr(trim(request.form("imglink")))
  227. title=tee5.CheckStr(trim(request.form("title")))
  228. linktype=tee5.CheckStr(trim(request.form("linktype")))
  229. if title="" then
  230.                 ErrMsg = ErrMsg + "<br>" + "<li>名称不能为空。"
  231.                 Founderr = True
  232.                 Exit Sub
  233. end if
  234. if imglink="" then
  235.                 ErrMsg = ErrMsg + "<br>" + "<li>连接地址不能为空。"
  236.                 Founderr = True
  237.                 Exit Sub
  238. end if
  239. if linktype="1" and imgurl="" then
  240.                 ErrMsg = ErrMsg + "<br>" + "<li>LOGO地址不能为空。"
  241.                 Founderr = True
  242.                 Exit Sub
  243. end if
  244. if linktype="" then
  245.                 ErrMsg = ErrMsg + "<br>" + "<li>请选择连接类型。"
  246.                 Founderr = True
  247.                 Exit Sub
  248. end if
  249. set rs = server.createobject("adodb.recordset")
  250. sql="select * from Gq_link"
  251. rs.open sql,conn,1,3
  252. rs.AddNew
  253. rs("imgurl") = imgurl
  254. rs("imglink") = imglink
  255. rs("title") = title
  256. rs("linktype") = linktype
  257. if trim(request.form("top"))="1" then
  258. rs("top")=1
  259. end if
  260. rs.Update
  261. rs.Close
  262. call closeconn()
  263.         Succeed ("添加连接成功。")
  264. end sub
  265. '保存连接修改
  266. sub saveedit()
  267. dim imgurl,imglink,title,linktype
  268. imgurl=tee5.CheckStr(trim(request.form("imgurl")))
  269. imglink=tee5.CheckStr(trim(request.form("imglink")))
  270. title=tee5.CheckStr(trim(request.form("title")))
  271. linktype=tee5.CheckStr(trim(request.form("linktype")))
  272. if title="" then
  273.                 ErrMsg = ErrMsg + "<br>" + "<li>名称不能为空。"
  274.                 Founderr = True
  275.                 Exit Sub
  276. end if
  277. if imglink="" then
  278.                 ErrMsg = ErrMsg + "<br>" + "<li>连接地址不能为空。"
  279.                 Founderr = True
  280.                 Exit Sub
  281. end if
  282. if linktype="1" and imgurl="" then
  283.                 ErrMsg = ErrMsg + "<br>" + "<li>LOGO地址不能为空。"
  284.                 Founderr = True
  285.                 Exit Sub
  286. end if
  287. if linktype="" then
  288.                 ErrMsg = ErrMsg + "<br>" + "<li>请选择连接类型。"
  289.                 Founderr = True
  290.                 Exit Sub
  291. end if
  292. set rs = server.createobject("adodb.recordset")
  293. sql="select * from Gq_link where id=" & Request("id")
  294. rs.open sql,conn,1,1
  295. if rs.eof and rs.bof then
  296. rs.close
  297. call closeconn()
  298. response.write "<script>alert('此连接不存在');history.back()</script>"
  299. else
  300. rs.close
  301. rs.open sql,conn,1,3
  302. rs("imgurl") = imgurl
  303. rs("imglink") = imglink
  304. rs("title") = title
  305. rs("linktype") = linktype
  306.         if trim(request.form("top"))="" then
  307.         rs("top")=0
  308.         end if
  309.         if trim(request.form("top"))="yes" then
  310.         rs("top")=1
  311.         end if
  312. rs.Update
  313. rs.Close
  314. call closeconn()
  315.          Succeed ("修改连接成功。")
  316. end if
  317. end sub
  318. '连接删除
  319. Sub delLink()
  320. If Len(Request("id")) = "" then
  321. response.write "<script>alert('非法操作');history.back()</script>"
  322. Else
  323.          If Len(Request("id")) > 0 Then
  324.                  SQL = "DELETE FROM [Gq_Link] WHERE id in (" & Request("id") & ")"
  325.                  tee5.Execute (SQL)
  326. End If
  327. End If
  328.         Succeed ("删除成功,请继续其他操作。")
  329. End Sub
  330. %>