<!--#include file="conn.asp" -->
<!--#include file="sd_md5.asp" -->
<%
Dim ID,menu,title,content,classn,intime,outtime,width,height,Rs,P,lx,pic
Set Rs = Server.CreateObject("adodb.recordset")
	menu = Request.QueryString("menu")
	ID = CInt(Request.QueryString("ID"))
	P = CLng(Request.QueryString("P")) '分页显示 	
	If Request.Form("title") <> "" Then
	title = Request.Form("title")
	End If
	If Request.Form("class") <> "" Then
	classn = Request.Form("class")
	End If	
	If Request.Form("content") <> "" Then
	content = Request.Form("content")
	End If
	If Request.Form("lx") <> "" Then
	lx = Request.Form("lx")
	End If
	If Request.Form("pic") <> "" Then
	pic = Request.Form("pic")
	End If
	If Request.Form("intime") <> "" Then
	intime = Request.Form("intime")
	End If
	If Request.Form("outtime") <> "" Then
	outtime = Request.Form("outtime")
	End If
	If Request.Form("width") <> "" Then
	width = Request.Form("width")
	End If
	If Request.Form("height") <> "" Then
	height = Request.Form("height")
	End If
	If Request.Form("beiz") <> "" Then
	beiz = Request.Form("beiz")
	End If
	If Request.Form("tid") <> "" Then
	tid = Request.Form("tid")
	End If
	If Request.Form("cname") <> "" Then
	cname = Request.Form("cname")
	End If
	If Request.Form("sc") <> "" Then
	sc = Request.Form("sc")
	End If
	Dim Ver
	Ver = "商奇评测系统"	
Function chkhtm(stra)
   stra = Replace(stra,"<","&lt;")
   stra = Replace(stra,">","&gt;")
   stra = Replace(stra,"'","")
   stra = Replace(stra,"(","（")
   stra = Replace(stra,")","）")
   stra = Replace(stra,";","；")
   stra = Replace(stra,",","，")
   stra = Replace(stra,"%","％")
   stra = Replace(stra,"+","＋")
   chkhtm=stra
End Function
Function finddir(filepath)
	finddir=""
	for i=1 to len(filepath)
	if left(right(filepath,i),1)="/" or left(right(filepath,i),1)="\" then
	  abc=i
	  exit for
	end if
	next
	if abc <> 1 then
	finddir=left(filepath,len(filepath)-abc+1)
	end if
End Function

Function d(i)
	Set Rs3 = Server.CreateObject("ADODB.RecordSet")
	Rs3.Open "select * from sd_adclass where sd_id="&i,conn,1,1
	If Not Rs3.eof Then
	d = Rs3("sd_name")
	End If
	Rs3.close
	Set Rs3 = Nothing	
End Function

Function a(i1,i2,i3)
	Set Rs3 = Server.CreateObject("ADODB.RecordSet")
	Rs3.open "select * from "&i2&" where "&i3&"="&i1,conn,1,1
	a = Rs3.RecordCount
	Rs3.close
	Set Rs3 = Nothing
End Function

Function b(i,s)
	Set Rs3 = Server.CreateObject("ADODB.RecordSet")
	Rs3.Open "select * from sd_adclass where sd_tid="&i,conn,1,1
	Do While Not Rs3.eof
%>
			<option value='<%=Rs3("sd_id")%>'<%If Rs3("sd_id") = ID Then Response.Write(" selected")%>><%For x=1 to s%><%Response.Write("　")%><%Next%>├<%=Rs3("sd_name")%>(<%=s%>级)</option>				
<%	
			
		b Rs3("sd_id"),s+1	
	Rs3.movenext
	Loop
	Rs3.close
	Set Rs3 = Nothing	
End Function
Sub search
%>
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td colspan="8" class="admintitle">广告管理</td>
  </tr>
  <tr bgcolor="E8FBD1" align="center">
    <td width="5%" height="30">ID</td>
    <td width="15%">广告位名称</td>
    <td width="8%">类型</td>
    <td width="19%">广告类别</td>
    <td width="10%">广告规格</td>
    <td width="10%">添加时间</td>
    <td width="10%">过期时间</td>
    <td width="15%">广告操作</td>
  </tr>
<%
Select Case Request.Form("scl")
case 1 
	Rs.open "select * from sd_foxad where sd_title like '%"&sc&"%' or sd_beiz like '%"&sc&"%'",conn,1,1
case 2
	Rs.open "select * from sd_foxad where sd_content like '%"&sc&"%'",conn,1,1
case 3
	Rs.open "select * from sd_foxad where sd_intime like '%"&sc&"%'",conn,1,1
case 4
	Rs.open "select * from sd_foxad where sd_outtime like '%"&sc&"%'",conn,1,1
End Select
If Not Rs.eof Then
	Rs.PageSize =20 '设置一页显示20条记录 
	If Not P >1 Then P = 1 
	PCount = Rs.PageCount
	If P > PCount Then P = PCount 
	Rs.AbsolutePage = P 
	For i=1 To Rs.PageSize 
	If Rs.eof Then Exit For 
%>
	<tr align="center" <%If i/2=Cint(i/2) Then response.write "bgcolor=#F7FDEF" Else Response.write "bgcolor=#FFFFFF" End If %> >
		<td height="30"><%=Rs("sd_id")%></td>
		<td><font title="<%=Rs("sd_beiz")%>"> <%=Rs("sd_title")%></font> &nbsp;<%If DateDiff("d",Rs("sd_outtime"),now) >= 0 Then Response.Write("[<font color=#FF0000>已过期</font>]")%></td>	
		<td><%if Rs("sd_lx")=0 then%>图片<%elseif Rs("sd_lx")=1 then%>动画<%else%>代码<%end if%></td>	
		<td><a href="?menu=liste&ID=<%=Rs("sd_class")%>"><%=d(Rs("sd_class"))%></a></td>	
		<td><%=Rs("sd_width")%>×<%=rs("sd_height")%></td>
		<td><%=Rs("sd_intime")%></td>
		<td><%If DateDiff("d",Rs("sd_outtime"),now) >= 0 Then Response.Write("<font color=#FF0000>"&Rs("sd_outtime")&"</font>") Else Response.Write(Rs("sd_outtime")) End If%></td>
		<td><a href="?menu=ADedit&ID=<%=Rs("sd_id")%>">编辑</a> | <a href="?menu=del&ID=<%=Rs("sd_id")%>" onClick="return window.confirm('确认执行此操作？')">删除</a> | <a href="?menu=dy&ID=<%=Rs("sd_id")%>">预览</a></td>
	</tr>
<%
 	Rs.movenext
	Next
	Rs.close
%>
<tr><td height="30" colspan="8">
	<%If P <> 1 Then%> 
		<a href="?P=1">首页</a> 
		<a href="?P=<%=P-1%>">上一页</a>
	<%Else%>
		首页
		上一页
	<%End If%>
	<%If P <> PCount Then%> 
		<a href="?P=<%=P+1%>">下一页</a>
		<a href="?P=<%=PCount%>">尾页</a>
	<%Else%>
		下一页
		尾页
	<%End If%>
		页次：<%=P%>/<%=PCount%>页  
		<%=Rs.PageSize%>记录/页 转到：
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;"> 
<% 
	For j = 1 to PCount 
	If j = P Then%> 
	<option value="?P=<%=j%>" selected><%=j%></option> 
	<%Else%> 
	<option value="?P=<%=j%>"><%=j%></option> 
<% 
	End If 
	Next 
%> 
	</select>页</td></tr>
</table>
<%
Else
%>
<tr><td height="30" colspan="8"><font color="#FF0000">没有发现包含<%=sc%>的广告</font></td></tr>
</table>
<%
End If
End Sub
Sub list
%>
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td colspan="8" class="admintitle">广告管理</td>
  </tr>
  <tr bgcolor="E8FBD1" align="center">
    <td width="5%" height="30">ID</td>
    <td width="15%">广告位名称</td>
    <td width="8%">类型</td>
    <td width="19%">广告类别</td>
    <td width="10%">广告规格</td>
    <td width="10%">添加时间</td>
    <td width="10%">过期时间</td>
    <td width="15%">广告操作</td>
  </tr>
<%
	Rs.open "select * from sd_foxad order by sd_id",conn,1,1
	Rs.PageSize =20 '设置一页显示20条记录 
	If Not P >1 Then P = 1 
	PCount = Rs.PageCount
	If P > PCount Then P = PCount 
	Rs.AbsolutePage = P 
	For i=1 To Rs.PageSize 
	If Rs.eof Then Exit For 
%>
	<tr align="center" <%If i/2=Cint(i/2) Then response.write "bgcolor=#F7FDEF" Else Response.write "bgcolor=#FFFFFF" End If %> >
		<td height="30"><%=Rs("sd_id")%></td>
		<td><font title="<%=Rs("sd_beiz")%>"> <%=Rs("sd_title")%></font> &nbsp;<%If DateDiff("d",Rs("sd_outtime"),now) >= 0 Then Response.Write("[<font color=#FF0000>已过期</font>]")%></td>	
		<td><%if Rs("sd_lx")=0 then%>图片<%elseif Rs("sd_lx")=1 then%>动画<%else%>代码<%end if%></td>	
		<td><a href="?menu=liste&ID=<%=Rs("sd_class")%>"><%=d(Rs("sd_class"))%></a></td>	
		<td><%=Rs("sd_width")%>×<%=rs("sd_height")%></td>
		<td><%=Rs("sd_intime")%></td>
		<td><%If DateDiff("d",Rs("sd_outtime"),now) >= 0 Then Response.Write("<font color=#FF0000>"&Rs("sd_outtime")&"</font>") Else Response.Write(Rs("sd_outtime")) End If%></td>
		<td><a href="?menu=ADedit&ID=<%=Rs("sd_id")%>">编辑</a> | <a href="?menu=del&ID=<%=Rs("sd_id")%>" onClick="return window.confirm('确认执行此操作？')">删除</a> | <a href="?menu=dy&ID=<%=Rs("sd_id")%>">预览</a></td>
	</tr>
<%
 	Rs.movenext
	Next
	Rs.close
%>
<tr>
<td height="30" colspan="8">
	<%If P <> 1 Then%> 
		<a href="?P=1">首页</a> 
		<a href="?P=<%=P-1%>">上一页</a>
	<%Else%>
		首页
		上一页
	<%End If%>
	<%If P <> PCount Then%> 
		<a href="?P=<%=P+1%>">下一页</a>
		<a href="?P=<%=PCount%>">尾页</a>
	<%Else%>
		下一页
		尾页
	<%End If%>
		页次：<%=P%>/<%=PCount%>页  
		<%=Rs.PageSize%>记录/页 转到：
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;"> 
<% 
	For j = 1 to PCount 
	If j = P Then%> 
	<option value="?P=<%=j%>" selected><%=j%></option> 
	<%Else%> 
	<option value="?P=<%=j%>"><%=j%></option> 
<% 
	End If 
	Next 
%> 
	</select>页</td></tr>
</table>
<%
End Sub

Sub liste
%>
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td colspan="8" class="admintitle">广告管理 </td>
  </tr>
  <tr bgcolor="E8FBD1" align="center">
    <td width="8%" height="30">ID</td>
    <td width="20%">广告位名称</td>
    <td width="8%">类型</td>
    <td width="11%">广告类别</td>
    <td width="10%">广告规格</td>
    <td width="10%">添加时间</td>
    <td width="10%">过期时间</td>
    <td width="15%">广告操作</td>
  </tr>
<%
	Rs.open "select * from sd_foxad where sd_class="&ID,conn,1,1
	Rs.PageSize =20 '设置一页显示20条记录 
	If Not P >1 Then P = 1 
	PCount = Rs.PageCount
	If P > PCount Then P = PCount 
	'Rs.AbsolutePage = P 
	For i=1 To Rs.PageSize 
	If Rs.eof Then Exit For 
%>
	<tr align="center" <%If i/2=Cint(i/2) Then response.write "bgcolor=#F7FDEF" Else Response.write "bgcolor=#FFFFFF" End If %> >
		<td height="30"><%=Rs("sd_id")%></td>
		<td><font title="<%=Rs("sd_beiz")%>"> <%=Rs("sd_title")%></font> &nbsp;<%If DateDiff("d",Rs("sd_outtime"),now) >= 0 Then Response.Write("[<font color=#FF0000>已过期</font>]")%></td>	
		<td><%if Rs("sd_lx")=0 then%>图片<%elseif Rs("sd_lx")=1 then%>动画<%else%>代码<%end if%></td>	
		<td><a href="?menu=liste&ID=<%=Rs("sd_class")%>"><%=d(Rs("sd_class"))%></a></td>	
		<td><%=Rs("sd_width")%>×<%=rs("sd_height")%></td>
		<td><%=Rs("sd_intime")%></td>
		<td><%If DateDiff("d",Rs("sd_outtime"),now) >= 0 Then Response.Write("<font color=#FF0000>"&Rs("sd_outtime")&"</font>") Else Response.Write(Rs("sd_outtime")) End If%></td>
		<td><a href="?menu=ADedit&ID=<%=Rs("sd_id")%>">编辑</a> | <a href="?menu=del&ID=<%=Rs("sd_id")%>" onClick="return window.confirm('确认执行此操作？')">删除</a> | <a href="?menu=dy&ID=<%=Rs("sd_id")%>">预览</a></td>
	</tr>
<%
 	Rs.movenext
	Next
	Rs.close
%>
<tr>
<td height="30" colspan="8">
	<%If P <> 1 Then%> 
		<a href="?P=1">首页</a> 
		<a href="?P=<%=P-1%>">上一页</a>
	<%Else%>
		首页
		上一页
	<%End If%>
	<%If P <> PCount Then%> 
		<a href="?P=<%=P+1%>">下一页</a>
		<a href="?P=<%=PCount%>">尾页</a>
	<%Else%>
		下一页
		尾页
	<%End If%>
		页次：<%=P%>/<%=PCount%>页  
		<%=Rs.PageSize%>记录/页 转到：
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;"> 
<% 
	For j = 1 to PCount 
	If j = P Then%> 
	<option value="?P=<%=j%>" selected><%=j%></option> 
	<%Else%> 
	<option value="?P=<%=j%>"><%=j%></option> 
<% 
	End If 
	Next 
%> 
	</select>页</td></tr>
</table>
<%
End Sub

Sub dy
	If ID > 0 Then
	Rs.Open "select * from sd_foxad where sd_id="&ID,Conn,1,1
%>

<br />
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
<tr><th>广告代码调用</th></tr>
<tr><td>
<textarea onmouseover=this.select(); onClick="this.select();js=this.createTextRange();js.execCommand('Copy');alert('代码复制成功,直接在需要插入广告的地方粘贴');" cols="100" rows="4">&lt;script src="sd_dy.asp?id=<%=id%>&amp;menu=js" language="JavaScript" charset="gb2312"&gt;&lt;/script&gt;</textarea>
</td></tr>
<tr><th>代码内容预览</th></tr>
<tr><td>
<div style="width:760px; height:auto; margin:auto; overflow:auto;">
<%if Rs("sd_lx")=2 then%><%=Rs("sd_content")%>
<%elseif Rs("sd_lx")=1 then%>
<param name='movie' value='<%=Rs("sd_content")%>'><param name='quality' value='high'><embed src='<%=Rs("sd_content")%>' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='<%=Rs("sd_width")%>' height='<%=Rs("sd_height")%>'></embed></object> 
<%else%>
<a href="<%=Rs("sd_content")%>" target="_blank"><img src="<%=Rs("sd_content")%>" width="<%=Rs("sd_width")%>" height='<%=Rs("sd_height")%>' border="0"></a> 
<%end if%></div>
</td></tr>
</table>
<%
	End If
	Rs.close
End Sub
Sub ADedit
	If id > 0 Then
		Rs.Open "sd_foxad where sd_id="&ID,Conn,1,1
	If Not Rs.eof Then	
		ID = Rs("sd_ID")
		title = Rs("sd_title")
		content = Rs("sd_content")
		lx = Rs("sd_lx")
		classn = Rs("sd_class")
		intime = Rs("sd_intime")
		outtime = Rs("sd_outtime")
		width = Rs("sd_width")
		height = Rs("sd_height")
		beiz = Rs("sd_beiz")  
	End If
	Rs.close
	End If		
%>
<form name="formpub" method="post" action="?menu=ADedite&ID=<%=ID%>">
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td colspan="2" class="admintitle">编辑广告</td>
  </tr>
  <tr>
    <td width="20%" height="30" align="right" bgcolor="#FFFFFF">广告位名称：</td>
    <td width="80%" bgcolor="#FFFFFF"><input name="title" value="<%=title%>" type="text" size="35"> <font color="#FF0000">不可重复</font></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">广告分类：</td>
    <td bgcolor="#FFFFFF"><select name="class">
		  <option>请选择分类</option>
<%
		Rs.open "select * from sd_adclass",conn,1,1
		Do while NOT Rs.eof	
%>
		  <option value=<%=Rs("sd_id")%><% If classn = Rs("sd_id") Then Response.Write " selected" %>><% If Rs("sd_tid")<>0 Then Response.Write " ├" %><%=Rs("sd_name")%></option>
<%
		Rs.movenext
		Loop
		Rs.close
%>
		</select> <a href="?menu=ADclass">添加分类</a></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">广告类型：</td>
    <td bgcolor="#FFFFFF"><input type="radio" <%if lx=0 then%>checked<%end if%> value="0" name="lx" onclick='boy1.style.display="";boy2.style.display="none";'>图片&nbsp;&nbsp; 
		<input type="radio" <%if lx=1 then%>checked<%end if%> value="1" name="lx" onclick='boy1.style.display="";boy2.style.display="none";'>动画&nbsp;&nbsp;
		<input type="radio" <%if lx=2 then%>checked<%end if%> value="2" name="lx" onclick='boy1.style.display="none";boy2.style.display="";'>代码</td>
  </tr>
  <tr id="boy1" style="display:<%if lx=2 then%>none<%end if%>">
    <td height="30" align="right" bgcolor="#FFFFFF">上传：</td>
    <td bgcolor="#FFFFFF"><input class="wenbenkuang" maxLength="40" name="pic" size="46" value="<%=content%>"> <input type="button" name="Submit2" value="上传图片" onclick="window.open('sd_upimgload.asp?formname=formpub&uppath=../ad/&amp;editname=pic','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"></td>
  </tr>
	<tr id="boy2" style="display:<%if lx=0 or lx=1 then%>none<%end if%>">
	<td height="30" align="right" bgcolor="#FFFFFF">广告内容代码：</td>
	<td bgcolor="#FFFFFF"><textarea name="content" id="content" style="width:500px; height:130px;"><%=content%></textarea></td>
</tr>
	<tr><td height="30" align="right" bgcolor="#FFFFFF">添加时间：</td>
	<td bgcolor="#FFFFFF"><input name="intime" type="text" value="<%=intime%>" size="18"/></td></tr>
	<tr><td height="30" align="right" bgcolor="#FFFFFF">过期时间：</td>
	<td bgcolor="#FFFFFF"><input name="outtime" type="text" value="<%=outtime%>"size=18/> <font color="#FF0000">留空则为永不过期</font></td></tr>
	<tr><td height="30" align="right" bgcolor="#FFFFFF">广告规格：</td>
	<td bgcolor="#FFFFFF"><input name="width" type="text" value="<%=width%>" size="15" maxlength="10"/>×<input name="height" value="<%=height%>" type="text" size="15" maxlength="10"/> 宽度×高度</td></tr>
	<tr><td height="30" align="right" bgcolor="#FFFFFF">链接地址：</td>
	<td bgcolor="#FFFFFF"><textarea name="beiz" id="beiz" style="width:500; height:39;"><%=beiz%></textarea></td></tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF"></td>
    <td bgcolor="#FFFFFF"><input type="submit" align="middle" value="确认修改"/>   <input type="reset" align="middle" value=" 重 填 "/></td>
  </tr>
</table>
</form>
<%
End Sub
Sub ADadd
%>
<form name="formpub" method="post" action="?menu=ADadde">
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td colspan="2" class="admintitle">添加广告</td>
  </tr>
  <tr>
    <td width="20%" height="30" align="right" bgcolor="#FFFFFF">广告位名称：</td>
    <td width="80%" bgcolor="#FFFFFF"><input name="title" type="text" size="35"> <font color="#FF0000">不可重复</font></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">广告分类：</td>
    <td bgcolor="#FFFFFF"><select name="class">
			<option>请选择分类</option>
<%					  
		Rs.Open "select * from sd_adclass where sd_tid=0",conn,1,1
		While Not Rs.eof
%>
			<option value='<%=Rs("sd_id")%>'<%If Rs("sd_id") = ID Then Response.Write(" selected")%>><b><%=Rs("sd_name")%></b>(1级)</option>
<% 
			b Rs("sd_id"),2
		Rs.movenext
		Wend
		Rs.close
%>
	  </select> <a href="?menu=ADclass">添加分类</a></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">广告类型：</td>
    <td bgcolor="#FFFFFF"><input type="radio" checked value="0" name="lx" onclick='boy1.style.display="";boy2.style.display="none";'>图片&nbsp;&nbsp; 
		<input type="radio" value="1" name="lx" onclick='boy1.style.display="";boy2.style.display="none";'>动画&nbsp;&nbsp;
		<input type="radio" value="2" name="lx" onclick='boy1.style.display="none";boy2.style.display="";'>代码</td>
  </tr>
  <tr id="boy1">
    <td height="30" align="right" bgcolor="#FFFFFF">上传：</td>
    <td bgcolor="#FFFFFF"><input class="wenbenkuang" maxLength="40" name="pic" size="46"> <input  type="button" name="Submit2" value="上传图片" onclick="window.open('sd_upimgload.asp?formname=formpub&uppath=../ad/&amp;editname=pic','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"></td>
  </tr>
  <tr id="boy2" style="display:none">
    <td height="30" align="right" bgcolor="#FFFFFF">广告内容代码：</td>
    <td bgcolor="#FFFFFF"><textarea name="content" id="content" style="width:500px; height:130px;"></textarea></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">添加时间：</td>
    <td bgcolor="#FFFFFF"><input name="intime" type="text" value="<%=date()%>" size="18"></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">过期时间：</td>
    <td bgcolor="#FFFFFF"><input name="outtime" type="text" size=18/> <font color="#FF0000">留空则为永不过期</font></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">广告规格：</td>
    <td bgcolor="#FFFFFF"><input name="width" type="text" size="15" maxlength="10"/>×<input name="height" type="text" size="15" maxlength="10"/> 宽度×高度</td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF">链接地址：</td>
    <td bgcolor="#FFFFFF"><textarea name="beiz" id="beiz" style="width:500; height:38;"></textarea></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#FFFFFF"></td>
    <td bgcolor="#FFFFFF"><input type="submit" align="middle" value="确认添加">   <input type="reset" align="middle" value=" 重 填 "></td>
  </tr>
</TABLE>
</form>
<%
End Sub

Sub ADclass
%>
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td class="admintitle">添加分类</td>
  </tr>
<form method="post" action="?menu=ADclasse">
  <tr>
    <td bgcolor="#FFFFFF" height="30">广告分类名称：<input name="cname" type="text" size="20">　　　上级分类：<select name="tid">
			<option value="0">请选择分类</option>
<%					  
		Rs.Open "select * from sd_adclass where sd_tid=0",conn,1,1
		While Not Rs.eof
%>
			<option value='<%=Rs("sd_id")%>'<%If Rs("sd_id") = ID Then Response.Write(" selected")%>><b><%=Rs("sd_name")%></b>(1级)</option>
<% 
			b Rs("sd_id"),2
		Rs.movenext
		Wend
		Rs.close
%>
	  </select> <font color="#FF0000">留空则为顶级分类</font>　　　<input type="submit" align="middle" value="确认添加"></td>
  </tr>
</form>
</TABLE>
<%
End Sub
Sub ADclassc
%>
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td class="admintitle">编辑分类</td>
  </tr>
<form method="post" action="?menu=ADclassce&ID=<%=ID%>">
  <tr>
    <td bgcolor="#FFFFFF" height="30">广告分类名称：<%					  
		Rs.Open "select * from sd_adclass where sd_id="&ID,conn,1,1
		If Not Rs.eof Then
%><input name="cname" type="text" value="<%=Rs("sd_name")%>" size="20"/>
<% 
		ID = CInt(Rs("sd_tid"))
		End If
		Rs.close
%>　　　上级分类：<select name="tid">
			<option value="0">请选择分类</option>
<%					  
		Rs.Open "select * from sd_adclass where sd_tid=0",conn,1,1
		While Not Rs.eof
%>
			<option value='<%=Rs("sd_id")%>'<%If Rs("sd_id") = ID Then Response.Write(" selected")%>><b><%=Rs("sd_name")%></b>(1级)</option>
<% 
			b Rs("sd_id"),2
		Rs.movenext
		Wend
		Rs.close
%>
	  </select> <font color="#FF0000">留空则为顶级分类</font>　　　<input type="submit" align="middle" value="确认修改"></td>
  </tr>
</form>
</TABLE>
<%
End Sub
Sub ADclassl
%>
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1" style="margin-top:5px;">
  <tr>
    <td colspan="6" class="admintitle">广告分类管理</td>
  </tr>
  <tr bgcolor="E8FBD1" align="center">
    <td width="8%" height="30">ID</td>
    <td width="20%">分类名称</td>
    <td width="10%">子栏目数</td>
    <td width="10%">广告数</td>
    <td width="25%">操作</td>
    <td></td>
  </tr>
</table>
<%
	Rs.open "select * from sd_adclass where sd_tid=0",conn,1,1
	Do while NOT Rs.eof	
%>
<table border="0" width="98%" cellpadding="3" cellspacing="1">
	<tr align="center" bgcolor="#FFFFFF">
	<td width="8%" height="30"><%=Rs("sd_id")%></td>
	<td width="20%" align="left"><a href="?menu=liste&ID=<%=Rs("sd_id")%>"><%=Rs("sd_name")%></a></td>
	<td width="10%"><%=a(Rs("sd_id"),"sd_adclass","sd_tid")%></td>
	<td width="10%"><%=a(Rs("sd_id"),"sd_foxad","sd_class")%></td>
	<td width="25%"><a href="?menu=ADclass&ID=<%=Rs("sd_id")%>">添加子分类</a> | <a href="?menu=ADclassc&ID=<%=Rs("sd_id")%>">修改</a> | <a onclick="return window.confirm('确认执行此操作，当前分类下的所有子分类将都被删除？')" href="?menu=classdel&ID=<%=Rs("sd_id")%>">删除</a></td>
	<td></td>
  </tr></TABLE>
<%
	c Rs("sd_id"),2
	Rs.movenext
	Loop	
	Rs.close
End Sub

Function c(i,s)
	Set Rs2 = Server.CreateObject("ADODB.RecordSet")
	Rs2.open "select * from sd_adclass where sd_tid="&i,conn,1,1
	Do while NOT Rs2.eof	
%>

<table border="0" cellpadding="3" cellspacing="1" width="98%">
	<tr align="center" bgcolor="#FFFFFF">
	<td width="8%" height="30"><%=Rs2("sd_id")%></td>
	<td width="20%" align="left"><%For x=1 to s%><%Response.Write("&nbsp;&nbsp;")%><%Next%>├&nbsp;<a href="?menu=liste&ID=<%=Rs2("sd_id")%>" target="_blank"><%=Rs2("sd_name")%></a>　<font color="#FF0000">[<%=s%>级]</font></td>
	<td width="10%"><%=a(Rs2("sd_id"),"sd_adclass","sd_tid")%></td>
	<td width="10%"><%=a(Rs2("sd_id"),"sd_foxad","sd_class")%></td>
	<td width="25%"><a href="?menu=ADclass&ID=<%=Rs2("sd_id")%>">添加子分类</a> | <a href="?menu=ADclassc&ID=<%=Rs2("sd_id")%>">修改</a> | <a onclick="return window.confirm('确认执行此操作，当前分类下的所有子分类将都被删除？')" href="?menu=classdel&ID=<%=Rs2("sd_id")%>">删除</a></td>
	<td></td>
  </tr>
</TABLE>
<%
	c Rs2("sd_id"),s+1
	Rs2.movenext
	Loop
	Rs2.close
	Set Rs2 = Nothing	
End Function
Sub Help
%>
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td colspan="6" class="admintitle"><%=Ver%>广告帮助</td>
  </tr>
  <tr bgcolor="ffffff" height="30">
    <td style="line-height:20px; padding:10 10 10 10;">
帮助你把网站上的所有广告按照广告大小或位置进行分类管理，然后用本系统分配的固定Scrip代码调用设置广告,获取代码请点广告管理的预览。<br>
把做好的广告代码添加进数据库里，点广告操作里的预览获取系统自动分配的Script代码！<br></p>
<ol>
	<li><b>插入文字广告链接的代码:</b><br>&lt;a href=&quot;<font color="#FF0000">文字链接</font>&quot; target=&quot;_blank&quot;&gt;<font color="#FF0000">文字</font>&lt;/a&gt;</li>
	<li><b>插入图片广告链接的代码:</b><br>&lt;a href=&quot;<font color="#FF0000">图片链接地址</font>&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;<font color="#FF0000">图片地址</font>&quot; width=&quot;<font color="#FF0000">图片宽度</font>&quot; height='<font color="#FF0000">图片高度</font>' border=&quot;0&quot;&gt;&lt;/a&gt;</li>
	<li><b>插入Flash广告链接的代码:</b><br>&lt;param name='movie' value='<font color="#FF0000">Flash地址</font>'&gt;&lt;param name='quality' value='high'&gt;&lt;embed src='<font color="#FF0000">Flash地址</font>' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='<font color="#FF0000">Flash宽度</font>' height='<font color="#FF0000">Flash高度</font>'&gt;&lt;/embed&gt;&lt;/object&gt;
	</li>
	<li><b>插入联盟广告的代码如google:</b><br>&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--<br>
	google_ad_client = &quot;pub-4305957092449247&quot;;<br>
	/* 728x90, 创建于 08-3-20 */<br>
	google_ad_slot = &quot;8601220956&quot;;<br>
	google_ad_width = 728;<br>
	google_ad_height = 90;<br>
	//--&gt;<br>
	&lt;/script&gt;<br>
	&lt;script type=&quot;text/javascript&quot;<br>
	src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;<br>
	&lt;/script&gt;</li>
</ol></td>
  </tr>
<table>
<%
End Sub
%>
