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

📄 admin_ads.asp

📁 本程序采用ACC数据核心构件!! 功能介绍: 程序代码重新设计与优化
💻 ASP
字号:
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/code.asp"-->
<!--#include file="../inc/check.asp"-->
<!--#include file="../inc/public.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="?╲、衡少゛=adsdel";
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="#EFEFEF" topMargin=15>
<%
if request.QueryString("╲、衡少゛")="adsdel" 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_ads 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 adlist()
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_ads.asp">广告列表</a> | <a href="admin_ads.asp?action=add">新增广告</a></td>
</tr>
</table>
<br>
<%end sub%>
<%
'广告列表
sub adlist()
call top()
if not isempty(request("page")) then
		currentPage=cint(request("page"))
	else
		currentPage=1
	end if%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<form method=post name=form╲、衡少゛ action=?╲、衡少゛=adsdel>
<tr align="center">
<th width="4%">选择</th>
<th width="15%">广告图片</th>
<th width="*">广告地址</th>
<th width="10%">天数</th>
<th width="10%">显示方式</th>
<th width="17%">添加时间</th>
<th width="8%">人气</th>
<th width="17%">操作</th>
</tr>
  <%
dim edits
edits=false
set rs = server.createobject("adodb.recordset")
sql="select * from Gq_ads where imgpic <>  '' order by id desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then 
response.write "<tr><td align='center' class=tablerow1 colspan='8'>没有广告数据!</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
if IsNull(rs("count")) then  
 rs("count")=0
 edits=true
end if 
if IsNull(rs("time")) then
  rs("time")=now
  edits=true
end if
if edits then rs.update
%>
<tr>
<td align="center" class=tablerow1><input name="sel" type="checkbox" id="sel" value="<%=rs("id")%>"></td>
<td align="center" class=tablerow1><%if instr(lcase(rs("imgpic")),".swf")>0 then%>FLASH<% else %><img src="<% =rs("imgpic") %>" width="100" height="40" border="0" title=说明:<% =rs("title") %>></td><%end if%>
<td align="center" class=tablerow1><a href="<%=rs("imgurl")%>" target="_blank">网站地址</a></td>
<td align="center" class=tablerow1><%=rs("count")%></TD>
<td align="center" class=tablerow1><%if rs("foot")=false then%>
<FONT color=#FF0000>顶部横幅</FONT>
<%else%><FONT color=#FF0000>底部横幅</FONT><%end if%></TD>
<td align="center" class=tablerow1><font color="#FF0000"><%=rs("time")%></font></TD>
<td align="center" class=tablerow1><font color="#FF0000"><%=rs("hits")%></font></TD>
<td align="center" class=tablerow1><a href="?id=<%=rs("id")%>&action=edit">编辑</a> ‖  <a href="?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='8'><input type='checkbox' name='chkall' value='on' onclick='CheckAll(this.form)'> 全选/反选 <input type=button value=批量删除 onclick=chkid()></td></tr>"
%>
<tr>
<td class=tablerow1 colspan="8">
<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=ads&page=",<%=mypage%>,<%=pages%>);
</script>
</tr>
</table>
</td>
</tr>
</form>
</table>
<%end if
end sub%>
<%
'广告添加
sub add()
call top()
%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<form action="?action=saveadd" method=post>
<tr> 
<th colspan="2">广告管理--添加广告</th>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">广告图片地址:</td>
<td class="TableRow1"><input name="imgpic" type="text" size="60"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">广告连接地址:</td>
<td class="TableRow1"><input name="imgurl" type="text" size="60"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">广告说明词语:</td>
<td class="TableRow1"><input name="title" type="text" size="60"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">广告投放天数:</td>
<td class="TableRow1"><input name="count" type="text" size="60"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">显示首页位置:</td>
<td class="TableRow1"><input type="radio" name="foot" value=false checked>
&nbsp;顶部横幅&nbsp;&nbsp;
<input name="foot" type="radio" value=true >&nbsp;底部横幅</td>
</tr>
<tr>
<td class="TableRow1" colspan="2" height="30" align="center"><input name="newtype" type="submit" id="newtype" class="button" value=" 添 加 " onclick="form.options.value='add'"></td>
</tr>
</form>
</table>
<% end sub %>
<%
'广告编辑
sub edit()
call top()
set rs = server.createobject("adodb.recordset")
sql="select * from Gq_ads 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
%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<form action="?action=saveedit&id=<%=htmlencode(trim(request("id")))%>" method=post>
<tr> 
<th colspan="2">广告管理--编辑广告</th>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">广告图片地址:</td>
<td class="TableRow1"><input name="imgpic" type="text" value="<%=rs("imgpic")%>" size="60"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">广告连接地址:</td>
<td class="TableRow1"><input name="imgurl" type="text" value="<%=rs("imgurl")%>" size="60"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">广告说明词语:</td>
<td class="TableRow1"><input name="title" type="text" value="<%=rs("title")%>" size="60"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">广告投放天数:</td>
<td class="TableRow1"><input name="count" type="text" value="<%=rs("count")%>" size="60"></td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">显示首页位置:</td>
<td class="TableRow1">
<input type=radio name=foot value="false" <%If Rs("foot")=false Then response.write "checked" end if%>> 
顶部横幅&nbsp;
<input type=radio name=foot value="true" <%If Rs("foot")=true Then response.write "checked" end if%>> 底部横幅</td>
</tr>
<tr>
<td width="12%" align="right" class="TableRow1">更新时间:</td>
<td class="TableRow1"><input name="time" type="checkbox" value="yes">同时更新广告的添加时间吗?</td>
</tr>
<tr>
<td class="TableRow1" colspan="2" height="30" align="center"><input name="newtype" type="submit" id="newtype" class="button" value=" 修 改 " onclick="form.options.value='add'"></td>
</tr>
</form>
</table>
<%
rs.Close
call CloseConn()
end if
end sub
%>
<%
'///保存新增加广告
sub saveadd()
	dim imgpic,imgurl,title,count,foot
	imgpic=htmlencode(trim(request.form("imgpic")))
	imgurl=htmlencode(trim(request.form("imgurl")))
	title=htmlencode(trim(request.form("title")))
	count=htmlencode(trim(request.form("count")))
	foot=htmlencode(trim(request.form("foot")))
	if count="" then
		response.write "<script>alert('请填写广告天数');history.back()</script>"
		response.end
	end if
	if imgpic="" then
		response.write "<script>alert('请填写广告图片');history.back()</script>"
		response.end
	end if
	if imgurl="" then
		response.write "<script>alert('请输入连接地址');history.back()</script>"
		response.end
	end if
	if title="" then
		response.write "<script>alert('请输入广告说明');history.back()</script>"
		response.end
	end if
	set rs = server.createobject("adodb.recordset")
	sql="select * from Gq_ads"
	rs.open sql,conn,1,3
	rs.AddNew
	rs("imgpic") = imgpic
	rs("imgurl") = imgurl
	rs("title") = title
	rs("count") = count
	rs("foot") = foot
	rs("time")=now
	rs.Update
	rs.Close
	call closeconn()
	response.Redirect "admin_ads.asp"
end sub


'///保存广告修改
sub saveedit()
	dim imgpic,imgurl,title,count
	imgpic=htmlencode(trim(request.form("imgpic")))
	imgurl=htmlencode(trim(request.form("imgurl")))
	title=htmlencode(trim(request.form("title")))
	count=htmlencode(trim(request.form("count")))
	foot=htmlencode(trim(request.form("foot")))
	if count="" then
		response.write "<script>alert('请填写广告天数');history.back()</script>"
		response.end
	end if
	if imgpic="" then
		response.write "<script>alert('请填写广告图片');history.back()</script>"
		response.end
	end if
	if imgurl="" then
		response.write "<script>alert('请输入连接地址');history.back()</script>"
		response.end
	end if
	if title="" then
		response.write "<script>alert('请输入广告说明');history.back()</script>"
		response.end
	end if
	set rs = server.createobject("adodb.recordset")
	sql="select * from Gq_ads 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("imgpic") = imgpic
		rs("imgurl") = imgurl
		rs("title") = title
		rs("count") = count
	        rs("foot") = foot
		if trim(request.form("time"))="yes" then
		rs("time")=Now()
		end if
		rs.Update
		rs.Close
		call closeconn()
	response.Redirect "admin_ads.asp"
	end if
end sub

'///广告删除
sub del()
	on error resume next
	sql="delete from Gq_ads 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_ads.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 + -