editlink.asp

来自「top-cms内容管理系统」· ASP 代码 · 共 197 行

ASP
197
字号
<%
'###########################################################################################
'*  程序名称: Top-CMS
'*---------------------------------------------------------------------------------------
'*  系统版本: 1.0 0215
'*  版权所有: www.Net-Develop.com
'*  程序设计: 江南行客
'*  联系方式:
'*            OICQ:2503086
'*            EMAIL:net-oa@sohu.com
'*  网站地址: 
'*            http://www.net-develop.com  
'*            http://www.top-cms.com   
'*---------------------------------------------------------------------------------------
'*  Copyright 2004 www.net-develop.com - All Rights Reserved.
'###########################################################################################
%>
<!--#include file="../common/common.asp" -->
<html>
<head>
<title>:::WWW.NET-DEVELOP.COM:::</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/style.css">
<script language="JavaScript">
		

function MM_goToURL(ActionUrl) { 
		myform.action=ActionUrl;
		myform.submit();
}
</script>

</head>

<body bgcolor="#FFFFFF" text="#000000">

<%

Set objCMS = Server.CreateObject("TopCMS.EditLink")
if objCMS.ChkAdminPower then
	lID=objCMS.ChkString(replace(Request("lID")," ",""),"U")
	nT=objCMS.ChkString(Request("nT"),"U")
	P=objCMS.ChkString(Request("P"),"U")
	t=objCMS.ChkString(Request("t"),"U")
	X=objCMS.ChkString(Request("X"),"U")
	SystemI_Init
	objCMS.OpenDB()
	
	If Not objCMS.CheckAdminField("Link") Then
        objCMS.OutInfo "对不起,你不具备管理链接页的权限。", ""
        Response.End
    End If
	
	if UCase(t)="DEL" and lID<>"" and X="T" then objCMS.DelLink(lID)
	
	If Request.ServerVariables("REQUEST_METHOD")="POST" and X<>"T" Then
		objCMS.SaveLink()
	else
		if nT="" then
	%>
	
<table width="100%" border="1" cellspacing="0" cellpadding="2" align="center" bordercolor="#999999">
  <form name="myform" method="post">
    <tr> 
      <td colspan="2" background="../Images/default_nav.gif"> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td width="88%"><font color="#FFFFFF">链接管理 </font></td>
            <td width="12%" align="right"><a href="editlink.asp?nT=ADD"><img src="../images/add.gif" hspace=2 border=0 align="absmiddle" alt="添加新链接"></a><a href="javascript:MM_goToURL('editlink.asp?nT=edit&P=<%=P%>&X=T');"><img src="../images/edit.gif" hspace=2 border=0 alt="编辑所选链接" align="absmiddle"></a><img src="../images/del.gif" hspace=2 border=0 alt="删除所选链接" onClick="if (confirm('你确定要删除所选的链接吗?\n删除后不能恢复!')){MM_goToURL('editlink.asp?t=del&P=<%=P%>&X=T');}" style="cursor:hand;" align="absmiddle"> 
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <%
		dbSql = "SELECT lID,lTitle,lLink,lPic FROM db_Link Order By lPic desc,lID Desc"
		set dbRs=objCMS.MyRs(dbSql,1,1,0)
		If dbRs.EOF Then
		%>
    <tr bgcolor="#EEEEEE"> 
      <td align="center" colspan="2">[目前还没有任何链接]</td>
    </tr>
    <%
		else
			objCMS.PagingMain dbRs,16
			nPage=objCMS.PNum
			i=0
			Do While not dbRs.eof and nPage>0
				if i mod 2 =0 then response.write "<tr>"
				lID=Trim(dbRs("lID"))
				lTitle=Trim(dbRs("lTitle"))
				lPic=Trim(dbRs("lPic"))
				lLink=Trim(dbRs("lLink"))
				%>
      
      <td valign="top" width="50%"> 
        <input type="checkbox" name="lID" value="<%=lID%>">
		<%if lPic<>"" then%>
	  <a href="<%=lLink%>" target="_blank"><img src="<%=AbsWebPath & lPic%>" border=0 align="top" border="0" alt="<%=lTitle%>"></a>
	  <%else%>
	  <a href="<%=lLink%>" target="_blank"><%=lTitle%></a>
	  <%end if%>
        </td>
    <%
	i=i+1
	if i mod 2 =0 then response.write "</tr>"
				dbRs.MoveNext
				nPage=nPage-1
			Loop
			
		end if
		dbRs.close
		set dbRs=nothing
		%>
  </form>
</table>
		
		<div align="right">
		<%objCMS.DisplayNavigation("")%>
		</div>
	<%
		else'修改/添加链接
			if UCase(nT)="EDIT" then
			if lID="" then 
				objCMS.OutInfo "请选择你要编辑的链接",""
				response.end
			elseif instr(lID,",")>0 then
				objCMS.OutInfo "一次只能编辑一个链接",""
				response.end
			end if
			objCMS.EditLink(lID)
			end if
	%>
		<form name="form1" method="post" action="editlink.asp" enctype="multipart/form-data">
  <table width="100%" border="1" bordercolor="#999999" cellspacing="0" cellpadding="2" align="center">
    <tr> 
      <td colspan="2" background="../Images/default_nav.gif"><font color="#FFFFFF">链接管理</font></td>
    </tr>
    <tr> 
      <td width="185" align="right" bgcolor="#EEEEEE">操作模式:</td>
      <td bgcolor="#EEEEEE" width="580"> 
        <select name="nT">
          <option value="EDIT">编辑 
          <option value="ADD" <%if UCase(nT)<>"EDIT" then Response.write " selected"%>>添加 
        </select>
      </td>
    </tr>
    <tr> 
      <td width="185" align="right">链接名称:</td>
      <td width="580"> 
        <input type="text" name="lTitle" maxlength="50" value="<%= objCMS.lTitle %>">
      </td>
    </tr>
    <tr> 
      <td width="185" align="right" bgcolor="#EEEEEE">链接图片:</td>
      <td bgcolor="#EEEEEE" width="580"> 
        <%if UCase(nT)="EDIT" and objCMS.lPic<>"" and not IsNull(objCMS.lPic) then
		text="重新"
		%>
        <img src="<%response.write AbsWebPath & objCMS.lPic%>"> <br>
        <%end if%>
        <input type="checkbox" name="ReUP" value="1" onclick="if (this.checked==true){lPic.className='';}else{lPic.className='hidden';}">
        <%=text%>上传 
        <input type="file" name="lPic" id="lPic" class="hidden">
      </td>
    </tr>
    
    <tr> 
      <td width="185" align="right" bgcolor="#FFFFFF">链接地址:</td>
      <td bgcolor="#FFFFFF" width="580"> 
        <input type="text" name="lLink" maxlength="50" value="<%=objCMS.lLink%>">
      </td>
    </tr>
    
    <tr bgcolor="#EEEEEE"> 
      <td align="center" colspan="2"> 
        <input type="hidden" name="lID" value="<%= lID %>">
        <input type="hidden" name="P" value="<%= P %>">
        <input type="submit" name="S1" value=" 提交 ">
        <input type="button" name="S2" value=" 取消 " onclick="history.back();">
      </td>
    </tr>
  </table>
</form>
	<%
		end if
	
	end if
	
	objCMS.CloseDB	
else
	objCMS.OutInfo "对不起,您还没有登录,请先登录","Login"
end if
set objCMS=nothing
%>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?