⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_link.asp

📁 本程序采用ACC数据核心构件!! 功能介绍: 程序代码重新设计与优化
💻 ASP
字号:
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/code.asp"-->
<!--#include file="../inc/SqlIn.Asp"-->
<!--#include file="../inc/check.asp"-->
<html>
<head>
<title><%=webname%> ≡ 连接管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="admin_style.css" rel="stylesheet" type="text/css">
<script language=javascript>
function ConfirmDel()
{
   if(confirm("确定要删除此连接吗?"))
     return true;
   else
     return false;
}
</script>
<script>
function chkid()
{
document.form╲、衡少゛.action="?╲、衡少゛=linkdel";
document.form╲、衡少゛.submit()
}
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
</script>
<body leftMargin=0 bgcolor="#FFCC00" topMargin=0>
<%
if request.QueryString("╲、衡少゛")="linkdel" then'=============批量删除
dim delsel
sel=htmlencode(request.form("sel"))
if sel="" then
response.write "<script>alert('没有选择任何记录,不能操作');history.back()</script>"
call CloseConn()
response.end
end if
set rs = server.createobject("adodb.recordset")
sel=split(sel,",")
for i= 0 to ubound(sel)
	sql="delete * from Gq_link where id="&sel(i)
	conn.execute sql
next
set rs=nothing
conn.close
set conn=nothing
response.redirect request.ServerVariables("HTTP_REFERER")
end if
if request("action")="add" then
	call add()
elseif request("action")="edit" then
	call edit()
elseif request("action")="del" then
	call del()
elseif request("action")="saveadd" then
	call saveadd()
elseif request("action")="saveedit" then
	call saveedit()
else
	call linklist()
end if
call CloseConn()
%>
<%sub top()%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<tr> 
<th>友情连接管理</th>
</tr>
<tr>
<td class=tablerow1><b>管理选项:</b><a href="admin_link.asp">连接列表</a> | <a href="admin_link.asp?action=add">新增连接</a></td>
</tr>
</table>
<br>
<%end sub%>
<%
'友情连接列表
sub linklist()
call top()
%>
<br>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<form method=post name=form╲、衡少゛ action=?╲、衡少゛=linkdel>
<tr align="center">
<th width="4%">编号</th>
<th width="15%">LOGO</th>
<th width="20%">地址</th>
<th width="*">描述</th>
<th width="15%">类型</th>
<th width="15%">操作</th>
</tr>
<%
set rs = server.createobject("adodb.recordset")
sql="select * from Gq_link order by linktype,id asc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then 
response.write "<tr><td align='center' class=tablerow1 colspan=6>当前没有友情连接</td></tr>" 
else
rs.pagesize=cint(adminpage)
i=1
mypage=request("page")
if mypage="" then
mypage=1
else
mypage=cint(mypage)
end if
pages=rs.pagecount
rs.absolutepage=mypage
do while not rs.eof
%>
  <tr bgcolor="#FFFFFF">
<td align="center" class="TableRow2"><input name="sel" type="checkbox" id="sel" value="<%=rs("id")%>"></td>
<td align="center" class="TableRow2"><%if rs("linktype")=1 then%><img src=<%=rs("imgurl")%> border="0" width="88" height="31"><%end if%></td>
<td align="center" class="TableRow2"><%=rs("imglink")%></td>
<td class="TableRow2"><%=rs("title")%></td>
<td align="center" class="TableRow2"><%if rs("linktype")=0 then response.write "文字连接" else if rs("linktype")=1 then response.write "<font color=#FF0000>图片连接</font>" end if%></TD>
<td align="center" class="TableRow2"><a href="admin_link.asp?id=<%=rs("id")%>&action=edit"><font color="#009900">编辑</font></a> | <a href="admin_link.asp?id=<%=rs("id")%>&action=del" onClick="return ConfirmDel();">删除</a></td>
  </tr>
<%
if i=rs.pagesize then exit do end if
i=i+1
rs.movenext
loop
response.write "<tr><td class=tablerow1 colspan='6'><input type='checkbox' name='chkall' value='on' onclick='CheckAll(this.form)'> 全选/反选 <input type=button value=批量删除 onclick=chkid()></td></tr>"
%>
<tr>
<td class=tablerow1 colspan="6">
<table border="0" cellpadding="0" cellspacing="1" align="right" class="Tableborder5">
<tr>
<td class="tabletitle1">&nbsp;全部&nbsp;</td>
<td class="tabletitle1">&nbsp;<%=rs.recordcount%>&nbsp;</td>
<td class="tabletitle1">&nbsp;每页&nbsp;</td>
<td class="tabletitle1">&nbsp;<%=rs.pagesize%>&nbsp;</td>
<td class="tabletitle1">&nbsp;<%=mypage%>/<%=rs.pagecount%>页&nbsp;</td>
<script language="javascript">
function showPageLink(sUrl,iPage,iCount){
var i;
i=Math.max(1,iPage-1);
document.write("<td class='tablebody1'>&nbsp;<a href=\""+sUrl+"1\"><FONT face=Webdings>9</FONT></a>&nbsp;</td>");
document.write("<td class='tablebody1'>&nbsp;<a href=\""+sUrl+i+"\"><FONT face=Webdings>7</FONT></a>&nbsp;</td>");
for(i=Math.max(1,iPage-5);i<iPage;i++){
document.write("<td class='tablebody1'>&nbsp;<a href=\""+sUrl+i+"\">"+i+"</a>&nbsp;</td>");}
document.write("<td class='tablebody2'>&nbsp;<font class='normalTextSmall'><u>"+iPage+"</u></font>&nbsp;</td>");
for(i=iPage+1;i<=Math.min(iCount,iPage+5);i++){
document.write("<td class='tablebody1'>&nbsp;<a href=\""+sUrl+i+"\">"+i+"</a>&nbsp;</td>");}
i=Math.min(iCount,iPage+1);
document.write("<td class='tablebody1'>&nbsp;<a href=\""+sUrl+i+"\"><FONT face=Webdings>8</FONT></a>&nbsp;</td>");
document.write("<td class='tablebody1'>&nbsp;<a href=\""+sUrl+iCount+"\"><FONT face=Webdings>:</FONT></a>&nbsp;</td>");}
showPageLink("?action=link&page=",<%=mypage%>,<%=pages%>);
</script>
</tr>
</table>
</td>
</tr>
</form>
</table>
<%end if
end sub%>
<%
'友情连接添加
sub add()
call top()
%>
<form action="?action=saveadd" method=post>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<tr> 
<th colspan="3">连接管理--添加连接</th>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">连接名称:</td>
<td class="TableRow1"><input name="title" type="text" size="40"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">连接地址:</td>
<td class="TableRow1"><input name="imglink" type="text" size="40"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">连接LOGO:</td>
<td class="TableRow1"><input name="imgurl" type="text" size="40"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">连接类型:</td>
<td class="TableRow1"><input type="radio" name="LinkType" value="0" checked>文字连接 <input type="radio" name="LinkType" value="1">图片连接</td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">首页推荐:</td>
<td class="TableRow1"><input type="checkbox" name="top" value="1"> 选择此项连接类型必须是图片连接才能首页显示</td>
</tr>
<tr>
<td class="TableRow1" colspan="2" height="30" align="center"><input type=submit value=增加></td>
</tr>
</table>
</form>
<% end sub %>
<%
'友情连接编辑
sub edit()
call top()
set rs = server.createobject("adodb.recordset")
sql="select * from Gq_link where id="&htmlencode(trim(request("id")))
rs.open sql,conn,1,1
if rs.eof and rs.bof then
	rs.close
	call closeconn()
	response.write "<script>alert('此连接不存在');history.back()</script>"
else
%>
<br>
<form action="?action=saveedit&id=<%=htmlencode(trim(request("id")))%>" method=post>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<tr>
<th colspan="3">连接管理--修改连接</th>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">连接名称:</td>
<td class="TableRow1"><input name="title" type="text" value="<%=rs("title")%>" size="40"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">连接地址:</td>
<td class="TableRow1"><input name="imglink" type="text" value="<%=rs("imglink")%>" size="40"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">连接LOGO:</td>
<td class="TableRow1"><input name="imgurl" type="text" value="<%=rs("imgurl")%>" size="40"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">连接类型:</td>
<td class="TableRow1">
<input type="radio" name="LinkType" value="0" <%if rs("LinkType")=0 then response.write "checked" end if%>> 文字连接
<input type="radio" name="LinkType" value="1" <%if rs("LinkType")=1 then response.write "checked" end if%>> 图片连接
</td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">首页推荐:</td>
<td class="TableRow1"><input name="top" type="checkbox" id="top" value="yes" <%if rs("top")=1 then response.write "checked"%>> 选择此项连接类型必须是图片连接才能首页显示</td>
</tr>
<tr>
<td class="TableRow1" colspan="2" height="30" align="center"><input type=submit value=修改></td>
</tr>
</table>
</form>
<%
	rs.Close
	call closeconn()
end if
end sub
%>
<%
'保存新增加连接
sub saveadd()
	dim imgurl,imglink,title,linktype
	imgurl=htmlencode(trim(request.form("imgurl")))
	imglink=htmlencode(trim(request.form("imglink")))
	title=htmlencode(trim(request.form("title")))
	linktype=htmlencode(trim(request.form("linktype")))
	if title="" then
		response.write "<script>alert('请输入站点名称');history.back()</script>"
		response.end
	end if
	if imglink="" then
		response.write "<script>alert('请输入连接地址');history.back()</script>"
		response.end
	end if
	if linktype="1" and imgurl="" then
		response.write "<script>alert('请输入LOGO地址');history.back()</script>"
		response.end
	end if
	if linktype="" then
		response.write "<script>alert('请选择连接类型');history.back()</script>"
		response.end
	end if
	set rs = server.createobject("adodb.recordset")
	sql="select * from Gq_link"
	rs.open sql,conn,1,3
	rs.AddNew
	rs("imgurl") = imgurl
	rs("imglink") = imglink
	rs("title") = title
	rs("linktype") = linktype
	if trim(request.form("top"))="1" then
	rs("top")=1
	end if
	rs.Update
	rs.Close
	call closeconn()
	response.Redirect "Admin_link.asp"
end sub

'保存连接修改
sub saveedit()
	dim imgurl,imglink,title,linktype
	imgurl=htmlencode(trim(request.form("imgurl")))
	imglink=htmlencode(trim(request.form("imglink")))
	title=htmlencode(trim(request.form("title")))
	linktype=htmlencode(trim(request.form("linktype")))
	if title="" then
		response.write "<script>alert('请输入站点名称');history.back()</script>"
		response.end
	end if
	if imglink="" then
		response.write "<script>alert('请输入连接地址');history.back()</script>"
		response.end
	end if
	if linktype="1" and imgurl="" then
		response.write "<script>alert('请输入LOGO地址');history.back()</script>"
		response.end
	end if
	if linktype="" then
		response.write "<script>alert('请选择连接类型');history.back()</script>"
		response.end
	end if
	set rs = server.createobject("adodb.recordset")
	sql="select * from Gq_link where id="&htmlencode(trim(request("id")))
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		rs.close
		call closeconn()
		response.write "<script>alert('此连接不存在');history.back()</script>"
	else
		rs.close
		rs.open sql,conn,1,3
		rs("imgurl") = imgurl
		rs("imglink") = imglink
		rs("title") = title
		rs("linktype") = linktype
	        if trim(request.form("top"))="" then
	        rs("top")=0
	        end if
	        if trim(request.form("top"))="yes" then
	        rs("top")=1
	        end if
		rs.Update
		rs.Close
		call closeconn()
		response.Redirect "Admin_link.asp"
	end if
end sub

'连接删除
sub del()
	on error resume next
	sql="delete from Gq_link where id="&htmlencode(trim(request("id")))
	conn.execute sql
	if err.Number<>0 then
		err.clear
		call closeconn()
		response.write "<script>alert('数据库操作失败! ');history.back()"
	else
		finished
		call closeconn()
		response.Redirect "Admin_link.asp"
	end if
end sub
%>
<table width=98% align="center" border="0" cellspacing="0" cellpadding="0">
<tr align="middle">
<td height="30" valign="bottom">Copyright (c) 2004-2006 <a target="_blank" href="http://www.xuncms.cn"><b><font color="#708796">XunCms</font><font color="#cc0000">.Cn</font></b></font></a>. All Rights Reserved .</td>
</tr>
<tr align="middle">
<td>Powered by:<a href="http://www.xuncms.cn" target="_blank"><b><font color="#708796">讯图</font><font color="#cc0000">设计</font></b></font> XunCms <%=Version%></a></td>
</tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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