📄 admin_adsmanage.asp
字号:
<!-- #include file="include/onlogin.asp" -->
<!--#include file ="include/conn.asp"-->
<SCRIPT language=JavaScript src="style/admin_ads.js"></SCRIPT>
<%
dim AdsCategoryID,AdsID,chk,ASProportion
tit=vbcrlf & "<a href='admin_adsmain.asp?'>广告管理</a> ┋ <a href='admin_adv.asp'>论坛广告管理</a>┋ <a href='admin_popwin.asp?nsort=popwin'>弹出广告</a>┋ " & _
vbcrlf & "<a href='admin_adsmain.asp?action=edit'>广告分类</a>"
response.write header(1,tit)
chk=trim(request.querystring("chk"))
select case action
case "Proportion"
call ads_Proportion()
case "Condition"
call ads_Condition()
case "Count"
call ads_Count()
case "MD"
call ads_MD()
case "Operation"
call ads_Operation()
case "StateCovt"
call ads_StateCovt()
case "Depict"
call Depict_main()
case "showflash"
call show_adflash()
case else
call ads_main()
end select
call close_conn()
response.write ender()
Sub Succeed(bit,msg,url,x)
%>
<table border=0 width='100%' cellspacing=0 cellpadding=0>
<TR align="center">
<TD>
<%
if bit="false" then
response.write "操作成功"
else
response.write "操作错误"
end if
%>
</TD>
</TR>
<TR align="center">
<TD>
<%=msg%>
</TD>
</TR>
<form method=post action="<%=url%>">
<TR align="center">
<TD>
<%
if bit="false" then
response.write "<input type=""submit"" value="" 确 定 "" onclick=""return menugo('admin_adsmain.asp')"">"
else
response.write"<input type=""button"" value="" 返 回 "" onclick=""javascript:history.back()"">"
end if
%>
</TD>
</TR>
</form>
</TABLE>
<%
end Sub
sub head_main()
AdsCategoryID=request("AdsCategoryID")
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr align="center" bgcolor=<%response.write color3%>>
<td height="18"><a href="?AdsCategoryID=<%=AdsCategoryID%>">基本状态</a></td>
<td><a href="?action=Proportion&AdsCategoryID=<%=AdsCategoryID%>">显示比例</a></td>
<td><a href="?action=MD&AdsCategoryID=<%=AdsCategoryID%>">修改/删除</a></td>
<td><a href="?action=Operation&AdsCategoryID=<%=AdsCategoryID%>">添加广告</a></td>
</tr>
</table>
<%
end sub
sub Depict_main()
dim rsAccessToday,rsClickToday,TodayAccessCount,TodayClickCount,AverageTodayClick,rsAccess,rsClick,AccessCount,ClickCount,AverageClick
AdsCategoryID=request("AdsCategoryID")
AdsID=request("AdsID")
set rs=conn.execute("select AdsName,AdsID from Ads where AdsCategoryID="&AdsCategoryID)
call head_main()
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr>
<td height="18" colspan="2" bgcolor=<%response.write color3%>> <select onchange="if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}">
<%while not rs.eof%>
<option value="?action=Depict&AdsID=<%=rs(1)%>&AdsCategoryID=<%=AdsCategoryID%>" <%if ccur(request("AdsID"))=ccur(rs(1)) then response.write "selected"%>><%=rs(0)%></option>
<%rs.movenext:wend%>
</select><strong>--概况</strong></td>
</tr>
</table>
<%
end sub
sub ads_main()
AdsCategoryID=request("AdsCategoryID")
set rs=conn.execute("select PicUrl,PicHeight,PicWidth,AdsID,AdsName,AdsType,AdsState,SProportion from Ads where AdsCategoryID="&AdsCategoryID&" order by AdsID desc")
call head_main()
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr align="center">
<td>标题</td>
<td>广告缩略图</td>
<td>当前状态</td>
<td>显示比例</td>
<td>状态设定</td>
</tr>
<%
while not rs.eof
%>
<form name=form1 method="post" action="">
<tr <%response.write mtr%>>
<td> <a href="?action=Depict&AdsID=<%=rs("AdsID")%>&AdsCategoryID=<%=AdsCategoryID%>"><%=rs("AdsName")%></a></td>
<td align="center">
<%
select case rs("AdsType")
case "pic"
dim PicUrl
PicUrl=rs("PicUrl")
response.write "<a href="&PicUrl&" target=_blank><img src='"&PicUrl&"' width=130 height=30 border=0></a>"
case "flash"
response.write"Flash广告 <a href=# onclick=""javascript:open('?action=showflash&AdsID="&rs("AdsID")&"','','scrollbars=yes,width="&rs("Picwidth")+50&",height="&rs("Picheight")+100&"')"">预览和取得链接</a>"
end select
%>
</td>
<td align="center">
<%
if rs("AdsState")=true then
response.write"<font color=green>正在播放</font>"
else
response.write"<font color=red>暂停播放</font>"
end if
%> </td>
<td align="center">
<%
if rs("AdsState")=true then
response.write"<font color=green>"&rs("SProportion")&"</font>"
else
response.write"<font color=red>N/A</font>"
end if
%> </td>
<td align="center">
<%
if rs("AdsState")=true then
response.write"<a href='?action=StateCovt&AdsID="&rs("AdsID")&"&AdsCategoryID="&AdsCategoryID&"&AdsState=stop' onclick=""return operation()""><img src=images/on_stop.gif border=0 align=absMiddle>暂停</a> <a href='?action=StateCovt&AdsID="&rs("AdsID")&"&AdsCategoryID="&AdsCategoryID&"&AdsState=arranged'><img src=images/on_schedule.gif border=0 align=absMiddle>计划</a>"
else
response.write"<a href='?action=StateCovt&AdsID="&rs("AdsID")&"&AdsCategoryID="&AdsCategoryID&"&AdsState=start'><img src=images/on_show.gif border=0 align=absMiddle>开始</a> <a href='?action=StateCovt&AdsID="&rs("AdsID")&"&AdsCategoryID="&AdsCategoryID&"&AdsState=arranged'><img src=images/on_schedule.gif border=0 align=absMiddle>计划</a>"
end if
%> </td>
</tr>
<%
i=i+1
rs.movenext
wend
rs.close
set rs=nothing
%>
</form>
</table>
<%
end sub
sub ads_StateCovt()
dim AdsState,SProportion,etime,SSProportion,x,MaxS,OSNum
AdsCategoryID=request("AdsCategoryID")
AdsID=request("AdsID")
AdsState=request("AdsState")
SProportion=request("SProportion")
etime=request("etime")
if AdsState="stop" then
set rs=conn.execute("select SProportion from Ads where AdsCategoryID="&AdsCategoryID&" and AdsID="&AdsID&" order by AdsID desc")
SSProportion=rs(0)
set rs=conn.execute("select SProportion from Ads where AdsCategoryID="&AdsCategoryID&" and AdsState=1 and AdsID<>"&AdsID&" order by AdsID desc")
while not rs.eof
i=i+1
x=x+rs(0)
rs.movenext
wend
if i>=1 then
OSNum=SSProportion/i
else
OSNum=0
end if
conn.execute("update Ads set AdsState=0,SProportion=null where AdsID="&AdsID)
conn.execute("update Ads set SProportion=SProportion+"&OSNum&" where AdsState=1")
response.redirect"admin_AdsManage.asp?AdsCategoryID="&AdsCategoryID&""
end if
if chk="启动" then
set rs=conn.execute("select SProportion from Ads where AdsCategoryID="&AdsCategoryID&" and AdsState=1 order by AdsID desc")
i=0
x=0
while not rs.eof
i=i+1
x=x+rs(0)
rs.movenext
wend
MaxS=10-i
if i>=1 then
OSNum=(10-SProportion)/i
else
OSNum=0
end if
if 100-SProportion<i then Call Succeed("true","显示比例超过最大值 <b>"&MaxS&"</b>","",""):response.end
conn.execute("update Ads set SProportion="&OSNum&" where AdsState=1")
conn.execute("update Ads set AdsState=1,SProportion="&SProportion&" where AdsID="&AdsID)
response.redirect"admin_AdsManage.asp?AdsCategoryID="&AdsCategoryID&""
elseif chk="确定" then
if etime<>"" then conn.execute("update Ads set Arranged='"&etime&"' where AdsID="&AdsID)
response.redirect"admin_AdsManage.asp?AdsCategoryID="&AdsCategoryID&""
end if
set rs=conn.execute("select * from Ads where AdsCategoryID="&AdsCategoryID&" order by AdsID desc")
call head_main()
%>
<%if AdsState="start" then%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<form name=form method="post" action="?action=StateCovt&chk=启动&AdsID=<%=AdsID%>&AdsCategoryID=<%=AdsCategoryID%>">
<tr align="center">
<td height="50%">显示比例<br><font color=#c0c0c0>启动广告播放之前先必须填写显示比例</font></td>
<td><input type="text" name="SProportion" size=10 class=form80 onblur="Isvalidity(SProportion,'显示比例')"></td>
</tr>
<tr bgcolor="#f6f6f6">
<td colspan=2 align="right">
<input type="submit" value="启动" name="chk" class=button onclick="return CheckProportion()">
<input type="button" value="返回" class=button onclick="javascript:history.back()">
</td>
</tr></form>
</table>
<%elseif AdsState="arranged" then
set rs=conn.execute("select Arranged from Ads where AdsCategoryID="&AdsCategoryID&" and AdsID="&AdsID)
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<form name=form method="post" action="?action=StateCovt&chk=确定&AdsID=<%=AdsID%>&AdsCategoryID=<%=AdsCategoryID%>">
<tr align="center">
<td height="50%">停止播放时间<br><font color=#c0c0c0>请输入要停止播放广告的时间</font></td>
<td>
<INPUT class=form80 name=etime size=20 value="<%=rs(0)%>" readonly>
<INPUT class=button name=ret onclick="showCalendar(CalendarLayer,this.form.etime)" type=button value=日期>
</td>
</tr>
<tr bgcolor="#f6f6f6">
<td colspan=2 align="right">
<input type="submit" value="确定" name="chk" class=button onclick="return operation()">
<input type="button" value="返回" class=button onclick="javascript:history.back()">
</td>
</tr></form>
</table>
<%
end if
end sub
sub ads_Proportion()
AdsCategoryID=request("AdsCategoryID")
ASProportion=0
if chk="修改" then
for i=1 to request("AdsID").count
if not ISNumeric(request("SProportion")(i)) then Call Succeed("true","显示比例只能为整数","",""):response.end
ASProportion=ASProportion+request("SProportion")(i)
next
if Ccur(ASProportion)>10 then Call Succeed("true","显示比例总和超过最大值 <b>10</b>","",""):response.end
for i=1 to request("AdsID").count
conn.execute("update Ads set SProportion="&request("SProportion")(i)&" where AdsID="&request("AdsID")(i))
next
end if
set rs=conn.execute("select * from Ads where AdsCategoryID="&AdsCategoryID&" order by AdsID desc")
call head_main()
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr align="center">
<td>标题</td>
<td>广告缩略图</td>
<td>当前状态</td>
<td>显示比例设定</td>
</tr>
<form name=form1 method="post" action="?action=Proportion&chk=修改&AdsCategoryID=<%=rs("AdsCategoryID")%>">
<%
while not rs.eof
%>
<tr <%response.write mtr%>>
<td> <a href="?action=Depict&AdsID=<%=rs("AdsID")%>&AdsCategoryID=<%=AdsCategoryID%>"><%=rs("AdsName")%></a></td>
<td align="center">
<%
select case rs("AdsType")
case "pic"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -