📄 ad_add.asp
字号:
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<HTML>
<HEAD>
<TITLE>添加广告</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style1 {
color: #FFFFFF;
font-weight: bold;
}
</style>
</HEAD>
<BODY>
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p14")
'''''''''''''''''''''''''''''''''''''''''''''''
'获得大类
dim first,classid
dim i
classid=Cint(request("classid"))
set rs=server.CreateObject("adodb.recordset")
sql="select * from catalogs where parentid="&classid&" order by id asc"
rs.open sql,conn,3,1
if not rs.eof then
first=rs.GetRows()
'response.Write("bigclass-----------------------"&ubound(first,2)&"----------------<br>")
'获得所有par_id=<>的类别------主类:par_id=0
if(ubound(first,2)<0) then
response.Write("暂时没有分类")
end if
else
response.Write("暂时没有分类,请先添加分类!")
response.End()
end if
rs.close
set rs=nothing
Function getcatalogs(parentid,str)
Dim Sql,rstemp,TemptempStr,tempStr
tempStr=str&" "
sql="select * from catalogs where parentid="&parentid
Set rstemp = Conn.Execute(Sql)
do while Not rstemp.Eof
getcatalogs = getcatalogs &"<option value="&rstemp("id")&">│"&tempStr&"└"&rstemp("title")&"</option>"&Chr(10)
getcatalogs = getcatalogs & getcatalogs(rstemp("id"),tempStr)
rstemp.MoveNext
loop
rstemp.close
Set rstemp = Nothing
End Function
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
</tr>
</table>
<%
dim act,catalogid,title,adType,photo,imgW,imgH,linkUrl,content
act=request.QueryString("act")
if(act="add") then
catalogid=cint(request.Form("catalogid"))
title=trim(request.Form("title"))
if(isnull(title) or len(title)<1) then
response.Write("<script>alert('广告标题不能为空!');history.back();</script>")
response.End()
end if
adType=Cint(request.Form("adType"))
if(isnull(adType) or not isnumeric(adType)) then
response.Write("<script>alert('广告类型不能为空!');history.back();</script>")
response.End()
end if
if(adType=0) then
content=trim(Request.Form("content"))
if(isnull(content) or len(content)<1) then
response.Write("<script>alert('广告内容不能为空!');history.back();</script>")
response.End()
end if
elseif(adType=1) then
photo=trim(Request.Form("photo"))
if not isempty(request.Form("imgW")) then
imgW=request.Form("imgW")
end if
if not isempty(request.Form("imgH")) then
imgH=request.Form("imgH")
end if
linkUrl=trim(Request.Form("linkUrl"))
if(isnull(photo) or len(photo)<1) then
response.Write("<script>alert('图片地址不能为空!');history.back();</script>")
response.End()
end if
if(isnull(imgW) or len(imgW)<1) then
response.Write("<script>alert('图片宽度不能为空!');history.back();</script>")
response.End()
end if
if(isnull(imgH) or len(imgH)<1) then
response.Write("<script>alert('图片高度不能为空!');history.back();</script>")
response.End()
end if
if(isnull(linkUrl) or len(linkUrl)<1) then
response.Write("<script>alert('图片链接地址不能为空!');history.back();</script>")
response.End()
end if
elseif(adType=2) then
photo=trim(Request.Form("photo"))
if not isempty(request.Form("imgW")) then
imgW=request.Form("imgW")
end if
if not isempty(request.Form("imgH")) then
imgH=request.Form("imgH")
end if
if(isnull(photo) or len(photo)<1) then
response.Write("<script>alert('flash地址不能为空!');history.back();</script>")
response.End()
end if
if(isnull(imgW) or len(imgW)<1) then
response.Write("<script>alert('flash宽度不能为空!');history.back();</script>")
response.End()
end if
if(isnull(imgH) or len(imgH)<1) then
response.Write("<script>alert('flash高度不能为空!');history.back();</script>")
response.End()
end if
end if
'''''''''''''''''''''''''''''''''添加到库''''''''''''''''''''''''''''
set rs=server.createobject("adodb.recordset")
sql="select top 1 * from ad where 1=0 order by id desc "
rs.open sql,conn,3,3
rs.addnew
rs("catalogId")=catalogid
rs("title")=title
rs("content")=content
rs("adType")=adType
rs("photo")=photo
rs("linkUrl")=linkUrl
rs("imgW")=imgW
rs("imgH")=imgH
rs("moditime")=now
rs.update
rs.close
set rs=nothing
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
response.Write("成功添加广告~!")
response.Write("<br><a href=""ad_add.asp"">继续添加-></a>")
else
%>
<FORM method="POST" name="form1" action="ad_add.asp?act=add" style="margin:0 0 0 0;">
<TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
<TD height="22" colspan="2"><div align="center" class="style1">添加广告</div></TD>
</TR>
<TR bgcolor="#F5F5F5">
<TD width="18%"><div align="center">所 属 类 别:</div></TD>
<TD width="82%"><select name="catalogid" >
<option value="0">所有</option>
<%
for i=0 to ubound(first,2)
response.Write("<option value="&first(0,i)&">├"&first(2,i)&"</option>"&Chr(10))
response.Write(getcatalogs(first(0,i),""))
next
%>
</select></TD>
</TR>
<TR bgcolor="#F5F5F5">
<TD><div align="center">标题名称:</div></TD>
<TD><input name="title" type="text" id="title" size="60"></TD>
</TR>
<TR bgcolor="#F5F5F5">
<TD><div align="center">广告类型:</div></TD>
<TD><input name="adType" type="radio" onClick="chanText()" value="0" checked>
文字
<input name="adType" type="radio" value="1" onClick="chanImg()">
图片
<input name="adType" type="radio" value="2" onClick="chanFlash()">
Flash</TD>
</TR>
<TR bgcolor="#F5F5F5" id="objUrl">
<TD><div align="center">图片|Flash地址:</div></TD>
<TD><div align="left">
<input name="photo" type="text" id="photo" size="50" readonly="true">
<input type="button" name="Button" value="上传->" onClick="javascript:document.form1.photo.value=window.showModalDialog('upimg.htm','','dialogHeight:130px;dialogWidth:410px;help:no;status:no;scroll:no')">
</div>
</TR>
<TR bgcolor="#F5F5F5" id="objWidth">
<TD><div align="center">图片|Flash宽度:</div></TD>
<TD><div align="left">
<input name="imgW" type="text" id="imgW" size="10">
</div>
</TR>
<TR bgcolor="#F5F5F5" id="objHeight">
<TD><div align="center">图片|Flash高度:</div></TD>
<TD><div align="left">
<input name="imgH" type="text" id="imgH" size="10">
</div>
</TR>
<TR bgcolor="#F5F5F5" id="objLink">
<TD><div align="center">图片链接:</div></TD>
<TD><div align="left">
<input name="linkUrl" type="text" id="linkUrl" size="60">
</div>
</TR>
<TR bgcolor="#F5F5F5" style="display:none; " id="textContent">
<TD><div align="center">广告内容:</div></TD>
<TD>
<textarea rows="12" name="content" cols="70"></textarea>
</TR>
<TR bgcolor="#F5F5F5">
<TD align=right> </TD>
<TD align=right><div align="left">
<input type=submit name=b1 value="提 交">
<input type=reset name=b2 value="重 填">
</div></TD>
</TR>
</TABLE>
</FORM>
<%
end if
%>
<script>
function chanText()
{
document.getElementById("objUrl").style.display='none';
document.getElementById("objWidth").style.display='none';
document.getElementById("objHeight").style.display='none';
document.getElementById("objLink").style.display='none';
document.getElementById("textContent").style.display='';
}
function chanImg()
{
document.getElementById("objUrl").style.display='';
document.getElementById("objWidth").style.display='';
document.getElementById("objHeight").style.display='';
document.getElementById("objLink").style.display='';
document.getElementById("textContent").style.display='none';
}
function chanFlash()
{
document.getElementById("objUrl").style.display='';
document.getElementById("objWidth").style.display='';
document.getElementById("objHeight").style.display='';
document.getElementById("objLink").style.display='none';
document.getElementById("textContent").style.display='none';
}
chanText();
</script>
</BODY>
</HTML>
<%
call connclose()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -