www.gusucode.com > 超文本多用户论坛程序 1.1 > bbs/admin/ltsj.asp

    <!--#include file="hs.asp"-->

<head>
<style>
<!--
td{font-family:arial}
TD{FONT-SIZE:9pt;LINE-HEIGHT:18px;}
.f{line-height:120%;font-size:100%;width:32em;padding-left:15px;word-break:break-all;word-wrap:break-word;}
-->
</style>
</head>

<script language=vbscript>
<!--
sub yibd

if bd1.yjbk.value=empty then 
window.alert"请输入一级板块名称!"
window.location="ltsj.asp?act=tj"
exit sub
end if

bd1.submit
end sub


sub zibd
if bd2.cnbkmc.value=empty or bd2.cnbksm.value=empty then 
window.alert"子板块名称和板块说明不能为空!"
window.location="ltsj.asp?act=zbktj"
exit sub
end if
bd2.submit
end sub

sub sc(id)
a=msgbox("确定要删除此板块?这样将删除此板块所有帖子信息!",1)
if a=1 then
window.location="ltsj.asp?shanchu=true&id="&id&""
end if
end sub
-->
</script>
<%on error resume next%>
<body topmargin=0>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="10%" align=center>
	<tr>
		<td height="51" width="801" bgcolor="#C0C0C0">
		<p align="center"><font color="#FF0000">
		<span style="font-size: 20px; font-weight: 700">论坛板块添加</span></font></p>
		<p align="center"><a href="ltsj.asp?act=tj">
		<span style="font-size: 12px">一级板块添加</span></a><span style="font-size: 12px">
		</span><a href="ltsj.asp?act=zbktj"><span style="font-size: 12px">一级子板块添加</span></a></td>
	</tr>
<%'有数据显示此信息
sql="select*from zwbk where ltbh='"&ltbh&"'"
set rs=conn.execute(sql)
if not rs.eof then
%>	
	
	<%
	sqlbk="select id,yjbk from zwbk where ltbh='"&ltbh&"' and bkdyid=0"
	set bkxs=conn.execute(sqlbk)
	%>
	<tr>
		<td valign="top" height="49" width="801">
		<%do while not bkxs.eof%>
		<form method=post>
			<table cellpadding="0" cellspacing="0" width="279" align=center height="58">
				<tr>
					<td height="29" align="center" style="border: 1px solid #3399FF" bgcolor="#FFFF00">
					<span style="font-size: 14px"><a href="bkxg.asp?xg=bk&id=<%=bkxs("id")%>">
					<font face="Arial" color="#FF0000"><%=bkxs("yjbk")%></font></a></span></td>
					<td height="29" align="center" style="border: 1px solid #3399FF" bgcolor="#FFFF00" width="64">
					<input type="button" value="删 除" name="B3" onclick="sc(<%=bkxs("id")%>)"></td>
				</tr>
	<%
	sqlzbk="select id,bkdyid,cnbkmc,cnlogo,cnbksm,banzhu from zwbk where ltbh='"&ltbh&"'and bkdyid="&bkxs("id")&""
	set zbkxs=conn.execute(sqlzbk)
	do while not zbkxs.eof
	%>
				<tr>
					<td height="29" align="center" bgcolor="#3399FF">
					<font color="#FFFFFF" face="Arial"><span style="font-size: 14px">
					<a href="bkxg.asp?xg=zbk&id=<%=zbkxs("id")%>">
					<font color="#FFFFFF"><%=zbkxs("cnbkmc")%></font></a></span></font></td>
					<td height="29" align="center" bgcolor="#3399FF" width="66">
					<input type="button" value="删 除" name="B4" onclick="sc(<%=zbkxs("id")%>)"></td>
				</tr>
   <%
   zbkxs.movenext
   loop
   %>
			</table>
		</form>	
        <%
        bkxs.movenext
        loop
        %>
		</td>
	</tr>
	<%
	bkxs.close
	set bkxs=nothing
	zbkxs.close
	set zbkxs=nothing
	%>
	
<%'否则显示此信息
else
dim emptybk
emptybk=true
%>	
	<tr>
		<td valign="top" height="26" width="801">
		
			<p align="center"><font color="#FF0000">
			<span style="font-size: 20px">暂时没有数据!</span></font></td>
	</tr>
<%
end if
rs.close
set rs=nothing
%>	
</table>

<%if request("act")="tj" then%>
<form action="ltsj.asp?bd=1" method=post name="bd1">
<table border="0" cellpadding="0" cellspacing="0" width="602" height="56" align=center>
	<tr>
		<td valign="top" height="56" width="602">

		<span style="font-size: 14px; font-weight: 700">1级板块添加:</span><p>
		<span style="font-size: 14px">板块名称:</span><input type="text" name="yjbk" size="20">
		<input type="button" value="提 交" name="B1" onclick="yibd"></td>
	</tr>
</table>
</form>
<%end if%>

<%
if request("act")="zbktj" then
if emptybk=true then
response.write"<span style=""font-size: 14px"">请添加至少一个一级板块在做此操作!</span>"
else
sql="select yjbk,id from zwbk where ltbh='"&ltbh&"' and bkdyid=0"
set zbk=conn.execute(sql)
%>
<form action="ltsj.asp?bd=2" method=post name="bd2">
<table border="0" cellpadding="0" cellspacing="0" width="602" height="56" align=center>
	<tr>
		<td height="28" width="602" colspan="2">

		<span style="font-size: 14px; font-weight: 700">1级子板块添加:</span> </td>
	</tr>
	<tr>
		<td valign="top" height="8" width="144">

		<font face="Arial">
		<span style="font-size: 14px">子板块名称:</span> </font></td>
		<td valign="top" height="8" width="458">

		<span style="font-size: 12px">
		<input type="text" name="cnbkmc" size="20"></span>
		<font color="#FF0000">*</font></td>
	</tr>
	<tr>
		<td valign="top" height="5" width="144">

		<font face="Arial" style="font-size: 14px">子板块logo:</font></td>
		<td valign="top" height="5" width="458">

		<span style="font-size: 12px">
		<input type="text" name="cnlogo" size="20"></span></td>
	</tr>
	<tr>
		<td height="5" width="144">

		<font face="Arial" style="font-size: 14px">子板块说明:</font></td>
		<td valign="top" height="5" width="458">

		<span style="font-size: 12px">
		<textarea rows="3" name="cnbksm" cols="39"></textarea></span><font color="#FF0000"> 
		*</font></td>
	</tr>
	<tr>
		<td valign="top" height="5" width="144">

		<font face="Arial" style="font-size: 14px">板块斑竹:</font></td>
		<td valign="top" height="5" width="458">

		<span style="font-size: 12px">
		<input type="text" name="banzhu" size="20"></span><font color="#FF0000">*多个用&quot;|&quot;隔开</font></td>
	</tr>
	<tr>
		<td valign="top" height="3" width="144">

		<font face="Arial" style="font-size: 14px">对应哪个一级板块?</font></td>
		<td valign="top" height="3" width="458">

		<span style="font-size: 12px">
		
		<select size="1" name="bkdyid">
		<%do while not zbk.eof%>
		<option selected value="<%=zbk("id")%>"><%=zbk("yjbk")%></option>
		<%
		zbk.movenext
		loop
		zbk.close
		set zbk=nothing
		%>
		</select>
		
		</span>
		<font color="#FF0000">*</font></td>
	</tr>
	<tr>
		<td valign="top" height="2" width="602" colspan="2">

		<p align="center">
		<input type="button" value="提 交" name="B2" onclick="zibd"></td>
	</tr>
</table>
</form>
<%
end if
end if
%>
</body>

<%
'表单处理程序
wbfz
bd=request("bd")

if bd=1 then'表单1处理程序
yjbk=ReplaceBadChar(request("yjbk"))
yjbdsql="insert into zwbk (yjbk,ltbh)values('"&yjbk&"','"&ltbh&"')"
conn.execute(yjbdsql)
%>
<script language=vbscript>
<!--
window.alert"添加一级板块成功!"
window.location="ltsj.asp"
-->
</script>
<%
end if
%>

<%
if bd=2 then'表单2处理程序
cnbkmc=ReplaceBadChar(request("cnbkmc"))
cnlogo=request("cnlogo")
cnbksm=ReplaceBadChar(request("cnbksm"))
banzhu=ReplaceBadChar(request("banzhu"))
bkdyid=request("bkdyid")

zbktj="insert into zwbk(cnbkmc,cnlogo,cnbksm,banzhu,bkdyid,ltbh)values('"&cnbkmc&"','"&cnlogo&"','"&cnbksm&"','"&banzhu&"',"&bkdyid&",'"&ltbh&"')"
conn.execute(zbktj)
%>
<script language=vbscript>
<!--
window.alert"添加子板块成功!"
window.location="ltsj.asp"
-->
</script>
<%
end if

'删除操作
if request("shanchu")="true" then
id=request("id")

sqlcx="select id,bkdyid from zwbk where id="&id&" and ltbh='"&ltbh&"'"'查询主板块
set cxjg=conn.execute(sqlcx)
cxid=cxjg("id")
bkdyid=cxjg("bkdyid")

if bkdyid=0 then
sqlcx1="select id from zwbk where bkdyid="&cxid&" and ltbh='"&ltbh&"'"'查询主板块
set cxjg1=conn.execute(sqlcx1)

if not cxjg1.eof then
response.write "<script language='javascript'>alert ('请先删除子板块在删除一级板块');history.go(-1);</script>" 
else
sqlsc="delete*from zwbk where id="&cxid&" and ltbh='"&ltbh&"'"'删除板块
conn.execute(sqlsc)
end if

end if
'------------------------------------------------------------
if bkdyid<>0 then

sqlcxtzid="select id from zwtizi where cnbkid="&cxid&" and ltbh='"&ltbh&"'"'查询帖子id
set tzidcxjg=conn.execute(sqlcxtzid)

'删除程序
sqlsc="delete*from zwbk where id="&cxid&" and ltbh='"&ltbh&"'"'删除板块
conn.execute(sqlsc)

do while not tzidcxjg.eof
tzid=tzidcxjg("id")
sql1="delete*from zwhtz where tzid='"&tzid&"' and ltbh='"&ltbh&"'" '删除帖子
conn.execute(sql1)
tzidcxjg.movenext
loop

sql="delete*from zwtizi where cnbkid="&cxid&" and ltbh='"&ltbh&"'" '删除主题
conn.execute(sql)
end if
%>
<script language=vbscript>
<!--
window.alert"删除成功!"
window.location="ltsj.asp"
-->
</script>
<%
end if
cxjg.close
set cxjg=nothing
cxjg1.close
set cxjg1=nothing
tzidcxjg.close
set tzidcxjg=nothing
dbclose
%>