📄 admin_ad.asp
字号:
<!--#include file="Include/Gaobei_setup.asp"-->
<!--#include file="Conn.asp"-->
<!--#include file="include/char.asp" -->
<!--#include file="Include/check.asp"-->
<!--#include file="Include/Admin_Function.asp"-->
<%CheckAdmin2%>
<% Set rs = Server.CreateObject("ADODB.Recordset") %>
<html>
<title>管理网站</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
<!--
function GaobeiSys_AdCheck(){
if (document.Advertise.AD_Title.value==""){
alert("广告标题不能为空!");
return false;
}
return true;
}
//-->
</script>
<link href="other/Admin.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" align="center"><a href="Admin_AD.asp?action=Add">添加广告</a>
| <a href="Admin_AD.asp">管理广告</a></td>
</tr>
</table>
<br>
<% if request("action")="Add" then %>
<form action="Admin_AD.asp?Action=Save" method="post" name="Advertise" id="Advertise">
<table width="455" height="220" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr>
<td height="24" colspan=2 align=center bgcolor="#F6F6F6">添 加 广 告</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="19%" height="24" align="center">广告标题:</td>
<td width="81%"> <input name="AD_Title" type="text" id="AD_Title" size="50"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="24" align="center">广告图片:</td>
<td><input name="AD_Pic" type="text" id="AD_Pic" size="50"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="24" align="center">广告宽度:</td>
<td><input name="AD_width" type="text" id="AD_width" size="10"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="24" align="center">广告高度:</td>
<td><input name="AD_height" type="text" id="AD_height" size="10"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="24" align="center">广告链接:</td>
<td><input name="AD_Http" type="text" id="AD_Http" size="50"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="114" height="23"> <div align="center">新窗打开:</div></td>
<td width="365" height="23"><input name="blank" type="checkbox" id="blank" style="border:0px" value="True">
<font color="#808080">链接是否在新窗口打开</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="93">
<div align="center">广告说明:</div></td>
<td> <textarea name="AD_Note" cols="50" rows="5" id="AD_Note"></textarea>
</td>
</tr>
<tr bgcolor="#F6F6F6">
<td height="24" colspan=2 align=center> <input type="submit" name="Add" value="添加" onClick="return GaobeiSys_AdCheck">
<input type="reset" name="Reset" value="清除"></td>
</tr>
</table>
</form>
<% end if %>
<%if request("action")="Edit" then
AD_ID=request.querystring("AD_ID")
If AD_ID ="" Then response.redirect"Admin_AD.asp" : End If
rs.Open "Select * From Advertise where AD_ID="&AD_ID, conn,3,3
%>
<form action="Admin_AD.asp?Action=Modify" method="POST" name="Advertise" id="Advertise" >
<table width="482" height="207" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr bgcolor="#F6F6F6">
<td height="24" colspan=2 align=center>修 改 广 告</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="114" height="23"> <div align="center">广告标题:</div></td>
<td width="365" height="23"> <input name="AD_Title" type="text" id="AD_Title" value="<%=rs("AD_Title")%>" size="50">
<input name=AD_ID type=hidden id="AD_ID" value="<%=rs("AD_ID")%>">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="24" align="center">广告图片:</td>
<td><input name="AD_Pic" type="text" id="AD_Pic" value="<%=rs("AD_Pic")%>" size="50"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="24" align="center">广告链接:</td>
<td><input name="AD_Http" type="text" id="AD_Http" value="<%=rs("AD_Http")%>" size="50"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="114" height="23"> <div align="center">新窗打开:</div></td>
<td width="365" height="23"><input name="blank" type="checkbox" id="blank" style="border:0px" value="True" <% if Rs("blank")=True then%>checked<%end if%>>
<font color="#808080">链接是否在新窗口打开</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="24" align="center">广告宽度:</td>
<td><input name="AD_width" type="text" id="AD_width" value="<%=rs("AD_width")%>" size="10"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="24" align="center">广告高度:</td>
<td><input name="AD_height" type="text" id="AD_height" value="<%=rs("AD_height")%>" size="10"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="81"> <div align="center">广告说明:</div></td>
<td> <textarea name="AD_Note" cols="50" rows="5" id="AD_Note"><%=rs("AD_Note")%></textarea>
</td>
</tr>
<tr bgcolor="#F6F6F6">
<td height="24" colspan=2 align=center> <input type="submit" name="Submit" value="修改" onClick="return GaobeiSys_AdCheck">
<input type="reset" name="reset" value="清除"></td>
</tr>
</table>
</form>
<% end if %>
<%
if request("action") = "" then
If Request.QueryString("CurPage") = "" or Request.QueryString("CurPage") = 0 then
CurPage = 1
Else
CurPage = CINT(Request.QueryString("CurPage"))
End If
rs.Open "Select * From Advertise Order By AD_ID DESC", conn, 1,1
if rs.eof and rs.bof then
Response.Write("<p align='center'>暂时没有任何记录!</p>")
else
RS.PageSize=20 '设置每页记录数
Dim TotalPages
TotalPages = RS.PageCount
If CurPage>RS.Pagecount Then
CurPage=RS.Pagecount
end if
RS.AbsolutePage=CurPage
rs.CacheSize = RS.PageSize'设置最大记录数
Dim Totalcount
Totalcount =INT(RS.recordcount)
StartPageNum=1
do while StartPageNum+10<=CurPage
StartPageNum=StartPageNum+10
Loop
EndPageNum=StartPageNum+9
If EndPageNum>RS.Pagecount then EndPageNum=RS.Pagecount
%>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#999999" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr>
<td width="50" height="20" bgcolor="#F6F6F6"><div align="center"> ID</div></td>
<td width="258" height="20" bgcolor="#F6F6F6"><div align="center"> 广告标题</div></td>
<td width="100" height="20" bgcolor="#F6F6F6"><div align="center"> 广告宽度</div></td>
<td width="100" height="20" bgcolor="#F6F6F6"><div align="center"> 广告高度</div></td>
<td width="128" height="20" align="center" bgcolor="#F6F6F6">加 入 时 间</td>
<td width="130" height="23" align="center" bgcolor="#F6F6F6">操 作</td>
</tr>
<%I=0
p=RS.PageSize*(Curpage-1)
do while (Not RS.Eof) and (I<RS.PageSize)
p=p+1%>
<tr bgcolor="#FFFFFF">
<td height="19" align=center bordercolorlight="#C0C0C0"> <%=rs("AD_ID")%></td>
<td height="19" align=left bordercolorlight="#C0C0C0"> <img src="Images/Gaobei_doc.gif"> <%=left(rs("AD_Title"),28)%></td>
<td height="19" align=center bordercolorlight="#C0C0C0"> <%=rs("AD_width")%></td>
<td height="19" align=center bordercolorlight="#C0C0C0"> <%=rs("AD_height")%></td>
<td align="center"><%=rs("AD_AddTime")%></td>
<td height="23" align=middle bordercolorlight="#c0c0c0" bgcolor="#FFFFFF"><div align="center"><a href="Admin_AD.asp?Action=Edit&AD_ID=<%=rs("AD_ID")%>">修改</a>
| <a href="Admin_AD.asp?Action=Del&AD_ID=<%=rs("AD_ID")%>">删除</a></div></td>
</tr>
<%
I=I+1
RS.MoveNext
Loop
%>
<tr bgcolor="#FFFFFF">
<td height="23" colspan=6 align="center" bordercolorlight="#C0C0C0">页次: <font color="#CC0000"><%=CurPage%></font>/<%=TotalPages%> 页数: <a href="Admin_AD.asp?CurPage=<%=StartPageNum-1%>"><<</a>
<% For I=StartPageNum to EndPageNum
if I<>CurPage then %> <a href="Admin_AD.asp?CurPage=<%=I%>"><%=I%></a> <% else %> <%=I%> <% end if %> <% Next %> <% if EndPageNum<RS.Pagecount then %> <a href="Admin_AD.asp?CurPage=<%=EndPageNum+1%>">下页</a>
<%end if%>
|<a href="Admin_AD.asp">刷 新</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23" colspan=6 align="center" bordercolorlight="#C0C0C0">调用方式:Call
Gaobei_AD(<strong>广告ID</strong>)
</td>
</tr>
</table>
</body>
</html>
<%
end if
rs.close
set rs=nothing
end if
%>
<%
function strFilter(str)
str=Replace(str,"'","''")
str=replace(str,"|","/")
str=Replace(str,"' ","'")
strFilter=str
end function
%>
<%
if request("Action")="Save" then
AD_Title=strFilter(request("AD_Title"))
AD_Pic=strFilter(request("AD_Pic"))
AD_Http=strFilter(request("AD_Http"))
AD_width=strFilter(request("AD_width"))
AD_height=strFilter(request("AD_height"))
AD_Note=strFilter(request("AD_Note"))
If AD_Title="" Then
Response.Write "<script>alert(""请输广告标题!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
If AD_width="" Then
Response.Write "<script>alert(""请输广告宽度!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
If AD_height="" Then
Response.Write "<script>alert(""请输广告高度!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
sql="select * from Advertise "
rs.open sql,conn,3,2
rs.addnew
rs("AD_Title")=AD_Title
rs("AD_Pic")=AD_Pic
rs("AD_Http")=AD_Http
rs("AD_width")=AD_width
rs("AD_height")=AD_height
if Request("blank")<>"" then
rs("blank")=Request("blank")
else
rs("blank")=False
end if
rs("AD_Note")=AD_Note
rs("AD_AddTime")=Date()
rs("AD_AddAdmin")=Session(GaobeiManageUser)
rs.update
rs.close
response.redirect "Admin_AD.asp"
end if
%>
<%
if request("Action")="Modify" then
AD_ID=request.form("AD_ID")
AD_Title=strFilter(request("AD_Title"))
AD_Pic=strFilter(request("AD_Pic"))
AD_Http=strFilter(request("AD_Http"))
AD_width=strFilter(request("AD_width"))
AD_height=strFilter(request("AD_height"))
AD_Note=strFilter(request("AD_Note"))
If AD_Title="" Then
Response.Write "<script>alert(""请输广告标题!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
If AD_width="" Then
Response.Write "<script>alert(""请输广告宽度!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
If AD_height="" Then
Response.Write "<script>alert(""请输广告高度!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
rs.open "select * from Advertise where AD_ID="&AD_ID,conn,3,2
rs("AD_Title")=AD_Title
rs("AD_Pic")=AD_Pic
rs("AD_Http")=AD_Http
if Request("blank")<>"" then
rs("blank")=Request("blank")
else
rs("blank")=False
end if
rs("AD_width")=AD_width
rs("AD_height")=AD_height
rs("AD_Note")=AD_Note
rs("AD_AddTime")=Date()
rs("AD_AddAdmin")=Session(GaobeiManageUser)
rs.update
rs.close
response.Redirect("Admin_AD.asp")
end if
%>
<%
if request("Action")="Del" then
AD_ID=Request.QueryString("AD_ID")
delsql="delete from Advertise where AD_ID="&AD_ID
conn.execute(delsql)
conn.close
response.redirect"Admin_AD.asp"
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -