<!--#include file="bsconfig.asp"-->
<script language="javascript">
var lang = new Array();
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
function setcopy(text, alertmsg){
if(is_ie) {
clipboardData.setData('Text', text);
alert(alertmsg);
} else if(prompt('Press Ctrl+C Copy to Clipboard', text)) {
alert(alertmsg);
}
}
function creatgg(ggid){
var a=window.open ('creatgg.asp?ggid='+ggid,'newwindow', 'height=400,width=800,top=100,left=200,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');
a.focus();
}
</script>
<%
pos_name=request("pos_name")
pos_file=request("pos_file")
pos_maxnum=request("pos_maxnum")
pos_width=request("pos_width")
pos_height=request("pos_height")
action=request("action")
pos_id=request("pos_id")
pos_ty=request("pos_ty")
if action="add" then
set rs=server.createobject("adodb.recordset")
sql="select * from gg_pos where pos_file='"&pos_file&"'"
rs.open sql,conn,1,3
if not rs.eof then
response.Write "<script>alert('文件名存在');window.location.href='gggl.asp';</script>"
response.end
else
rs.addnew
rs("pos_name")=pos_name
rs("pos_file")=pos_file
rs("pos_maxnum")=pos_maxnum
rs("pos_width")=pos_width
rs("pos_height")=pos_height
rs("pos_ty")=pos_ty
rs.update
end if
rs.close
set rs=nothing
response.Redirect "gggl.asp"
response.End()
end if
if action="edit" then
set rs=server.createobject("adodb.recordset")
sql="select * from gg_pos where pos_id="&pos_id
rs.open sql,conn,1,3
if not rs.eof then
rs("pos_name")=pos_name
rs("pos_maxnum")=pos_maxnum
rs("pos_width")=pos_width
rs("pos_height")=pos_height
rs("pos_ty")=pos_ty
rs.update
end if
rs.close
set rs=nothing
response.Redirect "gggl.asp"
response.End()
end if
if action="del" then
conn.execute("delete from gg_pos where pos_id="&pos_id)
response.Redirect "gggl.asp"
response.End()
end if
if action="ggdel" then
linkid=request("linkid")
conn.execute("delete from guanggao where linkid="&linkid)
response.Redirect "gggl.asp"
response.End()
end if
if action="ggadd" then
linkname=request("linkname")
linkurl=request("linkurl")
linkidorder=request("linkidorder")
weizhi=request("weizhi")
linklogo=request("linklogo")
ty=request("ty")
xianshi=request("xianshi")
width=request("width")
height=request("height")
set rs=server.createobject("adodb.recordset")
sql="select * from guanggao"
rs.open sql,conn,1,3
rs.addnew
rs("zuozhe001")=session("AdminName")
rs("linkname")=linkname
rs("linkurl")=linkurl
rs("linkidorder")=linkidorder
rs("weizhi")=weizhi
rs("linklogo")=linklogo
rs("type")=ty
if xianshi="yes" then
rs("xianshi")=true
else
rs("xianshi")=false
end if
rs("width")=width
rs("height")=height
rs.update
rs.close
set rs=nothing
response.Redirect("gggl.asp?action=gglist&pos_id="&weizhi)
response.End()
end if
if action="ggedit" then
linkid=request("linkid")
linkname=request("linkname")
linkurl=request("linkurl")
linkidorder=request("linkidorder")
weizhi=request("weizhi")
linklogo=request("linklogo")
ty=request("ty")
xianshi=request("xianshi")
width=request("width")
height=request("height")
set rs=server.createobject("adodb.recordset")
sql="select * from guanggao where linkid="&linkid
rs.open sql,conn,1,3
if not rs.eof then
rs("zuozhe001")=session("AdminName")
rs("linkname")=linkname
rs("linkurl")=linkurl
rs("linkidorder")=linkidorder
rs("weizhi")=weizhi
rs("linklogo")=linklogo
rs("type")=ty
if xianshi="yes" then
rs("xianshi")=true
else
rs("xianshi")=false
end if
rs("width")=width
rs("height")=height
rs.update
end if
rs.close
set rs=nothing
response.Redirect("gggl.asp?action=gglist&pos_id="&weizhi)
response.End()
end if
if action="ggaddde" then
call ggadd()
end if
if action="gglist" then
call gglist()
end if
if action="" or action="poslist" then
call poslist()
end if
if action="ggeditde" then
call ggedit()
end if
%>
<BR>
<% sub poslist()%>
<table cellpadding="2" cellspacing="1" border="0" width="800" align="center" class="a2">
<tr>
<td class="a1" height="25" align="center"><strong>广告位管理</strong></td>
</tr>
<tr class="a4">
<td align="center">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td width="29%" height="25" bgcolor="#C0C0C0">
<div align="center">广告位置</div></td>
<td width="15%" bgcolor="#C0C0C0">
<div align="center">默认类型</div></td>
<td width="11%" bgcolor="#C0C0C0">
<div align="center">最多广告数</div></td>
<td width="17%" bgcolor="#C0C0C0">
<div align="center">默认宽高</div></td>
<td width="28%" bgcolor="#C0C0C0">
<div align="center">管理操作</div></td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from gg_pos"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
%>
<form name="form<%=rs("pos_id")%>" action="?action=edit" method="post">
<input name="pos_id" type="hidden" value="<%=rs("pos_id")%>">
<tr>
<td height="22" bgcolor="#E3E3E3"><input name="pos_name" value="<%=rs("pos_name")%>"> <a href="?action=gglist&pos_id=<%=rs("pos_id")%>">查看</a>/<a href="?action=ggaddde&pos_id=<%=rs("pos_id")%>">添加</a></td>
<td bgcolor="#E3E3E3"><select name="pos_ty" ><option value="图片" <%if rs("pos_ty")="图片" then%> selected<%end if%>>图片</option><option value="文字" <%if rs("pos_ty")="文字" then%> selected<%end if%>> 文字</option><option value="flash" <%if rs("pos_ty")="flash" then%> selected<%end if%>>flash</option></select></td>
<td bgcolor="#E3E3E3"><input name="pos_maxnum" value="<%=rs("pos_maxnum")%>" size="4"></td>
<td bgcolor="#E3E3E3">宽:<input name="pos_width" value="<%=rs("pos_width")%>" size="4"> 高:<input name="pos_height" value="<%=rs("pos_height")%>" size="4"></td>
<td bgcolor="#E3E3E3"><input type="submit" value="修改" name="submit"> <input name="creat" value="复制JS" type="button" onClick="setcopy('<script src=ad/ad_<%=rs("pos_id")%>.js></script>', '标签 <script src=ad/ad_<%=rs("pos_id")%>.js></script> 复制成功')"> <input name="delete" value="删除" type="button" onClick="deletegg('<%=rs("pos_id")%>')"> <input name="creatjs" value="生成js" onClick="creatgg('<%=rs("pos_id")%>')" type="button"></td>
</tr>
</form>
<%
rs.movenext
loop
end if
%>
<%
rs.close
%>
<form name="form0" action="?action=add" method="post">
<tr>
<td height="22" bgcolor="#E3E3E3"><input name="pos_name"></td>
<td bgcolor="#E3E3E3">
<select name="pos_ty" >
<option value="图片" >图片</option>
<option value="文字" > 文字</option>
<option value="flash" >flash</option>
</select>
</td>
<td bgcolor="#E3E3E3"><input name="pos_maxnum" size="4"></td>
<td bgcolor="#E3E3E3">宽:<input name="pos_width" size="4"> 高:<input name="pos_height" size="4"></td>
<td bgcolor="#E3E3E3"><input type="submit" value="添加" name="submit"> </td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<script language="javascript">
function deletegg(pos_id){
window.location.href="gggl.asp?pos_id="+pos_id+"&action=del";
}
</script>
<%end sub%>
<% sub gglist()%>
<table cellpadding="2" cellspacing="1" border="0" width="800" align="center" class="a2">
<tr>
<td class="a1" height="25" align="center"><strong>广告管理</strong> <a href="gggl.asp?action=ggaddde&pos_id=<%=pos_id%>">继续添加</a></td>
</tr>
<tr class="a4">
<td align="center">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td width="16%" height="25" bgcolor="#C0C0C0">
<div align="center">广告名称</div></td>
<td width="27%" bgcolor="#C0C0C0">
<div align="center">广告图片代码</div></td>
<td width="6%" bgcolor="#C0C0C0">
<div align="center">广告性质</div></td>
<td width="13%" bgcolor="#C0C0C0">
<div align="center">广告尺寸</div>
</td>
<td width="13%" bgcolor="#C0C0C0">
<div align="center">状 态</div></td>
<td width="5%" bgcolor="#C0C0C0">
<div align="center">操作员</div>
</td>
<td width="5%" bgcolor="#C0C0C0">
<div align="center">排序</div>
</td>
<td width="15%" bgcolor="#C0C0C0">
<div align="center">操作选项</div></td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from guanggao where weizhi="&pos_id
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
%>
<tr>
<td height="22" bgcolor="#E3E3E3"><a href="<%=rs("linkurl")%>" target="_blank"><%=rs("linkname")%></a></td>
<td bgcolor="#E3E3E3"><%if rs("linklogo")<>"" then%>
<a href="<%=rs("linkurl")%>" target="_blank"><img src="../<%=rs("linklogo")%>" width="217" height="38px" border="0"></a><a href="<%=rs("linkurl")%>" target="_blank"></a>
<%end if%></td>
<td bgcolor="#E3E3E3"><%=rs("type")%></td>
<td bgcolor="#E3E3E3">宽: <%=rs("width")%> 高:<%=rs("height")%></td>
<td bgcolor="#E3E3E3"><%if rs("xianshi")=true then%><a href="gggl.asp?action=statue&isflag=0">正常</a><%else%><a href="gggl.asp?action=statue&isflag=1" style="color:#FF0000">锁定</a><%end if%></td>
<td bgcolor="#E3E3E3"><%=rs("zuozhe001")%></td>
<td bgcolor="#E3E3E3"><%=rs("linkidorder")%></td>
<td width="15%" bgcolor="#E3E3E3">
<input type="submit" value="修改" name="submit" onClick="window.location.href='gggl.asp?action=ggeditde&linkid=<%=rs("linkid")%>'">
<input name="delete" value="删除" type="button" onClick="window.location.href='gggl.asp?action=ggdel&linkid=<%=rs("linkid")%>'"></td>
</tr>
<%
rs.movenext
loop
end if
%>
<%
rs.close
%>
</table>
</td>
</tr>
</table>
<%end sub%>
<%sub ggadd()%>
<form action="gggl.asp?action=ggadd" name="formadd" method="post">
<table cellpadding="2" cellspacing="1" border="0" width="800" align="center" class="a2">
<tr>
<td class="a1" height="25" align="center" colspan="2"><strong>广告添加</strong> </td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告位置</td>
<td width="647" >
<select name="weizhi">
<option value="0">选择广告位置</option>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from gg_pos"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
%>
<option value="<%=rs("pos_id")%>" <%if pos_id=Cstr(rs("pos_id")) then%> selected<%end if%>><%=rs("pos_name")%></option>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
</select>
</td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告名称</td>
<td width="647" ><input name="linkname" ></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告链接</td>
<td width="647" ><input name="linkurl" size="50"></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
图片文件</td>
<td width="647" ><input name="linklogo" type="text" id="linklogo" size="30"> <input type="button" name="Submit22" value="上传" onClick="window.open('../situjiaduotu.asp?formname=formadd&editname=linklogo&uppath=UploadFiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告尺寸</td>
<td width="647" >宽:<input name="width" size="4" value="0"> 高:<input name="height" size="4" value="0"></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告类型</td>
<td width="647" ><select name="ty">
<option value="">请选择</option>
<option value="图片">图片</option>
<option value="文字">文字</option>
<option value="flash">图片</option>
</select></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告状态</td>
<td width="647" ><select name="xianshi"><option value="yes" >正常</option><option value="no">锁定</option></select></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
排序</td>
<td width="647" >
<%
set rst=server.CreateObject("adodb.recordset")
sqlt="select max(linkidorder) as maxnum from guanggao"
rst.open sqlt,conn,1,1
maxmun=rst("maxnum")
rst.close
set rst=nothing
%>
<input name="linkidorder" size="4" value="<%=maxmun+1%>"></td>
</tr>
<tr class="a4">
<td align="center" height="23px" colspan="2">
<input name="submit" value="添加" type="submit"> <input name="button" value="返回" type="button" onClick="window.history.back(-1)"></td>
</tr>
</table>
</form>
<%end sub%>
<%sub ggedit()%>
<%
linkid=request("linkid")
set rsgg=server.createobject("adodb.recordset")
sqlgg="select * from guanggao where linkid="&linkid
rsgg.open sqlgg,conn,1,1
if not rsgg.eof then
%>
<form action="gggl.asp?action=ggedit" name="formadd" method="post">
<input name="linkid" value="<%=linkid%>" type="hidden">
<table cellpadding="2" cellspacing="1" border="0" width="800" align="center" class="a2">
<tr>
<td class="a1" height="25" align="center" colspan="2"><strong>广告修改</strong></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告位置</td>
<td width="647" >
<select name="weizhi">
<option value="0">选择广告位置</option>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from gg_pos"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
%>
<option value="<%=rs("pos_id")%>" <%if rsgg("weizhi")=rs("pos_id") then%> selected<%end if%>><%=rs("pos_name")%></option>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
</select>
</td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告名称</td>
<td width="647" ><input name="linkname" value="<%=rsgg("linkname")%>"></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告链接</td>
<td width="647" ><input name="linkurl" size="50" value="<%=rsgg("linkurl")%>"></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
图片文件</td>
<td width="647" ><input name="linklogo" type="text" id="linklogo" size="30" value="<%=rsgg("linklogo")%>"> <input type="button" name="Submit22" value="上传" onClick="window.open('../situjiaduotu.asp?formname=formadd&editname=linklogo&uppath=UploadFiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告尺寸</td>
<td width="647" >宽:<input name="width" size="4" value="<%=rsgg("width")%>"> 高:<input name="height" size="4" value="<%=rsgg("height")%>"></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告类型</td>
<td width="647" ><select name="ty">
<option value="">请选择</option>
<option value="图片" <%if rsgg("type")="图片" then%> selected<%end if%>>图片</option>
<option value="文字" <%if rsgg("type")="文字" then%> selected<%end if%>>文字</option>
<option value="flash" <%if rsgg("type")="flash" then%> selected<%end if%>>图片</option>
</select></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
广告状态</td>
<td width="647" ><select name="xianshi"><option value="yes" <%if rsgg("xianshi")=true then%> selected<%end if%>>正常</option><option value="no" <%if rsgg("xianshi")=false then%> selected<%end if%>>锁定</option></select></td>
</tr>
<tr class="a4">
<td width="142" align="center" bgcolor="#C0C0C0" height="23px">
排序</td>
<td width="647" >
<input name="linkidorder" size="4" value="<%=rsgg("linkidorder")%>"></td>
</tr>
<tr class="a4">
<td align="center" height="23px" colspan="2">
<input name="submit" value="修改" type="submit">
<input name="button" value="返回" type="button" onClick="window.history.back(-1)"></td>
</tr>
</table>
</form>
<%
end if
rsgg.close
set rsgg=nothing
%>
<%end sub%>
<BR>
<%htmlend%>--gggl.asp
<%
function guanggao(weizhiid,tbg)
dim htmlstr
htmlstr=""
topnum=0
weizhi=0
width1=0
height1=0
ty1=""
set rs=server.createobject("adodb.recordset")
sql="select * from gg_pos where pos_id="&weizhiid
rs.open sql,conn,1,1
if not rs.eof then
topnum=rs("pos_maxnum")
weizhi=rs("pos_id")
width1=rs("pos_width")
height1=rs("pos_height")
ty1=rs("pos_ty")
else
response.Write "暂无广告位"
end if
rs.close
set rs=nothing
if weizhi<>0 then
set rs=createobject("adodb.recordset")
rs.Open "select top "&topnum&" * from guanggao where weizhi="&weizhi&" and xianshi=1 order by linkidorder ",conn,1,1
do while not rs.eof
if rs("width")<>"" and rs("width")<>0 then
width=rs("width")
else
width=width1
end if
if rs("height")<>"" and rs("height")<>0 then
height=rs("height")
else
height=height1
end if
if rs("type")<>"" then
ty=rs("type")
else
ty=ty1
end if
if ty="图片" then
if tbg<>"" then
htmlstr=htmlstr+"<"&tbg&" style=""margin:1px 0px 1px 0px;"">"
end if
if rs("linkurl")<>"#" then
htmlstr=htmlstr+" <a href="""+rs("linkurl")+""" target=""_blank"" title="""+rs("linkname")+""">"
end if
htmlstr=htmlstr+"<img border=""0"" src="""+rs("linklogo")+""" width="""+Cstr(width)+""" height="""+Cstr(height)+""" alt="""+rs("linkname")+""">"
if rs("linkurl")<>"#" then
htmlstr=htmlstr+"</a>"
end if
elseif ty="flash" then
if tbg<>"" then
htmlstr=htmlstr+"<"&tbg&" style=""margin:1px 0px 1px 0px;"">"
end if
if rs("linkurl")<>"#" then
htmlstr=htmlstr+" <button οnclick=""javascript:window.open('"+rs("linkurl")+"')"" style=""width:"+Cstr(width)+";height:"+Cstr(height)+";border:none;cursor:hand"">"
end if
htmlstr=htmlstr+"<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"" width="""++Cstr(width)+""" height="""+Cstr(height)+"""> <param name=""movie"" value="""+rs("linklogo")+"""/><param name=""quality"" value=""high"" /><param name=""wmode"" value=""Opaque""><embed src="""+rs("linklogo")+""" quality=""high"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" type=""application/x-shockwave-flash"" width="""+Cstr(width)+""" height="""+Cstr(height)+"""></embed></object>"
if rs("linkurl")<>"#" then
htmlstr=htmlstr+"</button>"
end if
elseif ty="文字" then
if tbg<>"" then
htmlstr=htmlstr+"<"&tbg&">"
end if
if rs("linkurl")<>"#" then
htmlstr=htmlstr+" <a href="""+rs("linkurl")+""" target=""_blank"">"
end if
htmlstr=htmlstr+rs("linkname")
if rs("linkurl")<>"#" then
htmlstr=htmlstr+"</a>"
end if
end if
if tbg<>"" then
htmlstr=htmlstr+"</"&tbg&">"
end if
rs.movenext
loop
rs.close
set rs=nothing
guanggao=htmlstr
end if
end function
%>--function1.asp
<!--#include file="bsconfig.asp"-->
<!-- #include file="function1.asp" -->
<%
ggid=request("ggid")
htnlstr=guanggao(ggid,"div")
htnlstr="document.writeln("""&replace(htnlstr,"""","""")&""")"
filename="ad_"&ggid&".js"
FolderPath = Server.MapPath("../ad")
Set fso = Server.CreateObject("scripting.FileSystemObject")
Set fout = fso.CreateTextFile(FolderPath&""&filename)
fout.WriteLine htnlstr
'关闭连接
fout.close
set fout = nothing
response.Write "<script language='javascript'>alert('生成成功!');window.close();</script>"
response.End()
%>--creatgg.asp
<%
dim conn
dim connstr
dim db
db="#ggxt.mdb" '数据库文件位置
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
%>