<%@language=vbscript codepage=936 %> <% option explicit response.buffer=true Const PurviewLevel=2 Const CheckChannelID=0 Const PurviewLevel_Others="AD" %> <% dim sql,rs,strFileName dim Action,Channel,FoundErr,ErrMsg Action=Trim(Request("Action")) Channel=Trim(Request("Channel")) if Channel="" then Channel=0 else Channel=CLng(Channel) end if strFileName="Admin_Advertisement.asp?Channel="&Channel %> 广告管理
广 告 管 理
管理导航: 添加新广告 | 所有频道广告 | 网站首页广告 | 文章频道广告 | 软件频道广告 | 图片频道广告 | 留言频道广告 |
<% if Action="Add" then call Add() elseif Action="SaveAdd" then call SaveAdd() elseif Action="Modify" then call Modify() elseif Action="SaveModify" then call SaveModify() elseif Action="SetNew" then call SetNew() elseif Action="CancelNew" then call CancelNew() elseif Action="Move" then call MoveAdvertisement() elseif Action="Del" then call DelAD() else call main() end if if FoundErr=True then call WriteErrMsg() end if call CloseConn() sub main() sql="select * from Advertisement" sql=sql & " where ChannelID=" & Channel sql=sql & " order by IsSelected,id desc" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 %>
> <% response.write "您现在的位置:网站广告管理 >> " select case Channel case 0 response.write "所有频道广告" case 1 response.write "网站首页广告" case 2 response.write "文章频道广告" case 3 response.write "软件频道广告" case 4 response.write "图片频道广告" case 5 response.write "留言频道广告" case else response.write "错误的参数" end select response.write "
" %> <% if not(rs.bof and rs.eof) then do while not rs.eof %> <% rs.movenext loop %> <% end if%>
选择 ID 广告类型 网站名称 广告图片 操作
name="ID" onclick="unselectall(this.form)"> <%=rs("ID")%> <%if rs("IsSelected")=true then response.write "" end if%> <% if rs("ADType")=0 then response.write "弹出广告" elseif rs("ADType")=1 then response.write "Banner广告" elseif rs("ADType")=2 then response.write "栏目广告" elseif rs("ADType")=3 then response.write "文章内容页广告" elseif rs("ADType")=4 then response.write "浮动广告" elseif rs("ADType")=5 then response.write "页面固定广告" elseif rs("ADType")=6 then response.write "代码广告" else response.write "其它广告" end if %> " target='blank' title="网站地址:<%=rs("SiteUrl") & vbcrlf %>网站简介:<%=vbcrlf & rs("SiteIntro")%>"><%=rs("SiteName")%> <% if rs("ADType")=6 then Response.Write rs("ImgUrl") else if lcase(right(rs("ImgUrl"),4))=".swf" then Response.Write "0 then response.write " width='" & rs("ImgWidth") & "'" if rs("ImgHeight")>0 then response.write " height='" & rs("ImgHeight") & "'" end if response.write ">0 then response.write " width='" & rs("ImgWidth") & "'" if rs("ImgHeight")>0 then response.write " height='" & rs("ImgHeight") & "'" end if response.write ">" else response.write "0 then response.write " width='" & rs("ImgWidth") & "'" if rs("ImgHeight")>0 then response.write " height='" & rs("ImgHeight") & "'" end if response.write " border='0'>" end if end if %> <% response.write "修改  " response.write "删除" %>
选中所有广告     将选定的广告:         
<% rs.close set rs=nothing end sub sub Add() %>
添 加 广 告
所属频道: 全部  首页  文章  软件  图片  留言 
广告类型:      设为最新广告
广告设置:
左: 上:
网站名称:
网站地址:
网站简介:
图片地址:
图片格式为:jpg,gif,bmp,png,swf
图片上传:
图片大小:(留空则取原始大小) 宽: 像素    高: 像素      * 弹出广告图片大小不能留空
是否FLASH: 是    
<% end sub sub Modify() dim ID,arrSetting,popleft,poptop,floatleft,floattop,fixedleft,fixedtop ID=trim(request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定广告ID
  • " exit sub else ID=Clng(ID) end if sql="select * from Advertisement where ID=" & ID set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 if rs.bof and rs.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的广告!
  • " rs.close set rs=nothing exit sub end if popleft="100" poptop="100" floatleft="100" floattop="100" fixedleft="100" fixedtop="100" if rs("ADType")=0 then if instr(rs("ADSetting"),"|")>0 then arrSetting=split(rs("ADSetting"),"|") popleft=arrsetting(0) poptop=arrsetting(1) end if elseif rs("ADType")=4 then if instr(rs("ADSetting"),"|")>0 then arrSetting=split(rs("ADSetting"),"|") floatleft=arrsetting(0) floattop=arrsetting(1) end if elseif rs("ADType")=5 then if instr(rs("ADSetting"),"|")>0 then arrSetting=split(rs("ADSetting"),"|") fixedleft=arrsetting(0) fixedtop=arrsetting(1) end if end if %>
    修 改 广 告
    所属频道: > 全部  > 首页  > 文章  > 软件  > 图片  > 留言 
    广告类型:     > 设为最新广告
    广告设置:
    左: 上:
    网站名称: " size="50" maxlength="255">
    网站地址: " size="50" maxlength="255">
    网站简介: " size="50" maxlength="255">
    图片地址: 6 then response.write rs("ImgUrl")%>" size="50" maxlength="255">
    图片上传:
    图片大小: 宽: " size="6" maxlength="5"> 像素    高: " size="6" maxlength="5"> 像素      * 弹出广告图片大小不能留空
    是否FLASH: > 是     > 否
    ">
    <% rs.close set rs=nothing end sub %>
    广告类型说明
    弹出广告: 指采用弹出窗口形式的广告
    Banner广告: 指页面顶部中间Banner处的广告,其大小一般为480*60
    栏目广告: 指穿插在各栏目间的广告,其大小一般为480*60
    文章内容页广告: 指显示在文章内容中间的广告,其大小一般为300*300
    浮动广告: 指漂浮在页面上不断移动的广告,其大小一般为80*80
    页面固定广告: 指固定显示在页面某一位置的广告
    代码广告: 指包含html内容的网站推广代码
    <% sub SaveAdd() dim ChannelID,ADType,SiteName,SiteUrl,SiteIntro,ImgUrl,ImgWidth,ImgHeight,IsFlash,IsSelected,ADSetting dim popleft,poptop,floatleft,floattop,fixedleft,fixedtop ChannelID=Clng(request("ChannelID")) ADType=Clng(request("ADType")) SiteUrl=trim(request("SiteUrl")) SiteName=trim(request("SiteName")) SiteIntro=trim(request("SiteIntro")) ImgWidth=trim(request("ImgWidth")) ImgHeight=Trim(request("ImgHeight")) IsFlash=trim(request("IsFlash")) IsSelected=trim(request("IsSelected")) if ADType<>6 then ImgUrl=trim(request("ImgUrl")) if SiteName="" then FoundErr=True ErrMsg=ErrMsg & "
  • 网站名称不能为空!
  • " end if if ImgUrl="" then FoundErr=True ErrMsg=ErrMsg & "
  • 广告图片不能为空!
  • " end if else ImgUrl=trim(request("ADCode")) if ImgUrl="" then FoundErr=True ErrMsg=ErrMsg & "
  • 广告代码不能为空!
  • " end if end if if FoundErr=True then exit sub end if if SiteUrl="http://" then SiteUrl="http://www.asp163.net" if ImgWidth="" then ImgWidth=0 else ImgWidth=Cint(ImgWidth) end if if ImgHeight="" then ImgHeight=0 else ImgHeight=Cint(ImgHeight) end if if IsFlash="" then IsFlash=false if IsSelected="" then IsSelected=false if ADType=0 then if trim(request("popleft"))="" then popleft=0 else popleft=trim(request("popleft")) if trim(request("poptop"))="" then poptop=0 else poptop=trim(request("poptop")) ADSetting=popleft & "|" & poptop elseif ADType=4 then if trim(request("floatleft"))="" then floatleft=0 else floatleft=trim(request("floatleft")) if trim(request("floattop"))="" then floattop=0 else floattop=trim(request("floattop")) ADSetting=floatleft & "|" & floattop elseif ADType=5 then if trim(request("fixedleft"))="" then fixedleft=0 else fixedleft=trim(request("fixedleft")) if trim(request("fixedtop"))="" then fixedtop=0 else fixedtop=trim(request("fixedtop")) ADSetting=fixedleft & "|" & fixedtop end if sql="select * from Advertisement" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,3 rs.addnew rs("ChannelID")=ChannelID rs("ADType")=ADType rs("ADSetting")=ADSetting rs("SiteName")=SiteName rs("SiteUrl")=SiteUrl rs("SiteIntro")=SiteIntro rs("ImgUrl")=ImgUrl rs("ImgWidth")=ImgWidth rs("ImgHeight")=ImgHeight rs("IsFlash")=IsFlash rs("IsSelected")=IsSelected rs.update rs.close set rs=nothing call CloseConn() response.redirect "Admin_Advertisement.asp?Channel="&ChannelID end sub sub SaveModify() dim sql,rs dim ID,ChannelID,ADType,SiteName,SiteUrl,SiteIntro,ImgUrl,ImgWidth,ImgHeight,IsFlash,IsSelected,ADSetting dim popleft,poptop,floatleft,floattop,fixedleft,fixedtop ID=trim(request("ID")) ChannelID=Clng(request("ChannelID")) ADType=Clng(request("ADType")) SiteName=trim(request("SiteName")) SiteUrl=trim(request("SiteUrl")) SiteIntro=trim(request("SiteIntro")) ImgWidth=trim(request("ImgWidth")) ImgHeight=Trim(request("ImgHeight")) IsFlash=trim(request("IsFlash")) IsSelected=trim(request("IsSelected")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定广告ID
  • " else ID=Clng(ID) end if if ADType<>6 then ImgUrl=trim(request("ImgUrl")) if SiteName="" then FoundErr=True ErrMsg=ErrMsg & "
  • 网站名称不能为空!
  • " end if if ImgUrl="" then FoundErr=True ErrMsg=ErrMsg & "
  • 广告图片不能为空!
  • " end if else ImgUrl=trim(request("ADCode")) if ImgUrl="" then FoundErr=True ErrMsg=ErrMsg & "
  • 广告代码不能为空!
  • " end if end if if FoundErr=True then exit sub end if if SiteUrl="http://" then SiteUrl="http://www.asp163.net" if ImgWidth="" then ImgWidth=0 else ImgWidth=Cint(ImgWidth) end if if ImgHeight="" then ImgHeight=0 else ImgHeight=Cint(ImgHeight) end if if IsFlash="" then IsFlash=false if IsSelected="" then IsSelected=false if ADType=0 then if trim(request("popleft"))="" then popleft=0 else popleft=trim(request("popleft")) if trim(request("poptop"))="" then poptop=0 else poptop=trim(request("poptop")) ADSetting=popleft & "|" & poptop elseif ADType=4 then if trim(request("floatleft"))="" then floatleft=0 else floatleft=trim(request("floatleft")) if trim(request("floattop"))="" then floattop=0 else floattop=trim(request("floattop")) ADSetting=floatleft & "|" & floattop elseif ADType=5 then if trim(request("fixedleft"))="" then fixedleft=0 else fixedleft=trim(request("fixedleft")) if trim(request("fixedtop"))="" then fixedtop=0 else fixedtop=trim(request("fixedtop")) ADSetting=fixedleft & "|" & fixedtop end if sql="select * from Advertisement where ID=" & ID set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,3 if rs.bof and rs.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的广告!
  • " rs.close set rs=nothing exit sub end if rs("ChannelID")=ChannelID rs("ADType")=ADType rs("ADSetting")=ADSetting rs("SiteName")=SiteName rs("SiteUrl")=SiteUrl rs("SiteIntro")=SiteIntro rs("ImgUrl")=ImgUrl rs("ImgWidth")=ImgWidth rs("ImgHeight")=ImgHeight rs("IsFlash")=IsFlash rs("IsSelected")=IsSelected rs.update rs.close set rs=nothing call CloseConn() response.redirect strFileName end sub sub SetNew() dim ID ID=Trim(Request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定广告ID
  • " exit sub end if if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "Update Advertisement set IsSelected=True Where ID=" & CLng(arrID(i)) next else conn.execute "Update Advertisement set IsSelected=True Where ID=" & CLng(ID) end if response.redirect strFileName end sub sub CancelNew() dim ID ID=Trim(Request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定广告ID
  • " exit sub end if if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "Update Advertisement set IsSelected=False Where ID=" & CLng(arrID(i)) next else conn.execute "Update Advertisement set IsSelected=False Where ID=" & CLng(ID) end if response.redirect strFileName end sub sub MoveAdvertisement() dim ID,MoveChannelID ID=Trim(Request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定广告ID
  • " exit sub end if MoveChannelID=Trim(Request("ChannelID")) if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "Update Advertisement set ChannelID = "& MoveChannelID & " where ID=" & CLng(arrID(i)) next else conn.execute "Update Advertisement set ChannelID = "& MoveChannelID & " where ID=" & CLng(ID) end if response.redirect strFileName end sub sub DelAD() dim ID ID=Trim(Request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定广告ID
  • " exit sub end if if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "delete from Advertisement where ID=" & CLng(arrID(i)) next else conn.execute "delete from Advertisement where ID=" & CLng(ID) end if response.redirect strFileName end sub %>