<%
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
%>
<%
rs.close
set rs=nothing
end sub
sub Add()
%>
<%
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
%>
<%
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
%>