⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_topic.asp

📁 网页酷吧全站系统在此之前提供了一个新闻系统V1.0,反应十分热烈,并有不少网友提供了不少意见例如在线编辑器等问题,并强烈要求本部提供全部程序,顺应广大网友的强烈要求,并希望本人的QQ能够闲下来(因为实
💻 ASP
字号:
<%if session("username")="" or session("userkey")="" then
response.redirect "../../"
end if%>
<!--#include file="mozeenconn.asp"-->
<link href=../css/main.css rel=stylesheet>
<!--#include file="./inc/const.asp"-->
<!--#include file="./inc/char.asp"-->
<%if session("userkey")>1 then%>
<%call main()%>

<%else%>
<script language=javascript>  
alert( "错误:您无权添加专题!"  );
location.href = "javascript:history.back()"  
</script>
<%end if%>

<%sub main()%>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#999999">
  <tr> 
    <td height="20" bgcolor="#eeeeee">当前位置:<a href=main.asp>管理首页</a> >> <a href=topic.asp>专题管理</a></td>
  </tr>
</table>
<%
if Request("action") = "addtopic" then
	call addtopic()
elseif request("action") = "savetopic" then
	call savetopic()
elseif request("action") = "deltopic" then
	call deltopic()
elseif request("action") = "edittopic" then
	call edittopic()
elseif request("action") = "saveedittopic" then
	call saveedittopic()
elseif request("action") = "pubyes" then
	call pubyes()
elseif request("action") = "pubno" then
	call pubno()
end if
%>
<%end sub%>


<%sub addtopic()%>
<table width="95%" cellspacing="1" cellpadding="3" bgcolor="#999999" align="center">
<form action="admin_topic.asp?action=savetopic" method=POST name=addtopic>
  <tr bgcolor="#CCCCCC"><td colspan="2" align="center"><b>添加新专题</b></td></tr>
  <tr bgcolor=#eeeeee><td align=right width=35%>专题名称:</td><td><input type=text name=topicname size=40></td></tr>
  <tr bgcolor=#eeeeee><td align=right>所属类别:</td><td><select name=classid >

<%
set rs = server.CreateObject ("Adodb.recordset")
sql = "select * from class"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<option value=>请先添加总类"
else
do while not rs.EOF
%>
<option value=<%=rs("classid")%>><%=rs("classname")%> </option>
<%
rs.MoveNext 
loop
end if
rs.Close 
%>
</select></td></tr>
  
   <tr bgcolor=#eeeeee><td align=right>专题介绍:</td><td><textarea name="topicInfo" cols="40" rows="5"></textarea></td></tr>
   <tr bgcolor=#eeeeee><td></td><td><input type="submit" name="Submit" value="确定"> &nbsp;&nbsp;<input type="Reset" name="Reset" value="重填"></td></tr>
</form></table>
<%end sub%>



<%sub savetopic()%>
<%if request("topicname")="" then%>
<script language=javascript>  
alert( "错误:请输入专题名称!"  );
location.href = "javascript:history.back()"  
</script>
<%elseif request("topicinfo")="" then%>
<script language=javascript>  
alert( "错误:请输入专题介绍!"  );
location.href = "javascript:history.back()"  
</script>

<%else%>
<%
set rs = server.CreateObject ("adodb.recordset")
sql = "select * from topic"
	rs.Open sql,conn,1,3
	rs.AddNew
	rs("topicname") = HTMLEncode(Request("topicname"))
	rs("classid") = Request("classid")
	rs("topicinfo") = HTMLEncode(Request("topicinfo"))
	rs("Adddate") = now()
	rs("ifpub") = 0
	rs("topicnum") = 0
	rs.Update 
	rs.Close 
set rs=nothing
%>
<script language=javascript>  
alert( "专题添加成功"  );
location.href = "topic.asp"  
</script>
<%end if%>
<%end sub%>



<%sub pubno()
sql="update topic set ifpub=0  where topicid="&cstr(request("topicid"))
conn.execute(sql)
response.redirect "topic.asp"
end sub%>

<%sub pubyes()
sql="update topic set ifpub=1  where topicid="&cstr(request("topicid"))
conn.execute(sql)
response.redirect "topic.asp"
end sub%>


<%sub deltopic()
if request("topicid")="" then
response.write " <center><font color=red>系统出现错误!</font> "

else
	
	sql = "delete from topic where topicid="+Cstr(Request("topicid"))
	conn.execute(sql)
	sql="update article set topicid=0 where topicid="&cstr(request("topicid"))
        conn.execute(sql)
	
	
%>
<script language=javascript>  
alert( "专题删除成功"  );
location.href = "topic.asp"  
</script>
<%end if%>
<%end sub%>



<%sub edittopic()%>
<%
   set rs=server.createobject("adodb.recordset")
   sql="select * from [topic] where topicid="&request("topicid")
   rs.open sql,conn,1,1
%>
<table width="95%" cellspacing="1" cellpadding="3" bgcolor="#999999" align="center">
<form action="admin_topic.asp?action=saveedittopic&topicid=<%=rs("topicid")%>" method=POST name=edittopic>
  <tr bgcolor="#CCCCCC"><td colspan="2" align="center"><b>修改专题 [<%=rs("topicname")%>] </b></td></tr>
  <tr bgcolor=#eeeeee><td align=right width=35%>专题名称:</td><td><input type=text name=topicname size=40 value=<%=rs("topicname")%>></td></tr>
  <tr bgcolor=#eeeeee><td align=right>所属类别:</td><td><select name=classid >

<%
set rs_1 = server.CreateObject ("Adodb.recordset")
sql_1 = "select * from class"
rs_1.open sql_1,conn,1,1
if rs_1.eof and rs_1.bof then
response.write "<option value=>请先添加总类"
else
do while not rs_1.EOF
%>
<option <%if rs_1("classid")=rs("classid") then%>selected<%end if%> value=<%=rs_1("classid")%>><%=rs_1("classname")%> </option>
<%
rs_1.MoveNext 
loop
end if
rs_1.Close 
%>
</select></td></tr>
  
   <tr bgcolor=#eeeeee><td align=right>专题介绍:</td><td><textarea name="topicInfo" cols="40" rows="5"><%=rs("topicinfo")%></textarea></td></tr>
   <tr bgcolor=#eeeeee><td></td><td><input type="submit" name="Submit" value="确定"> &nbsp;&nbsp;<input type="Reset" name="Reset" value="重填"></td></tr>
</form></table>
<%end sub%>


<%sub saveedittopic()%>
<%if request("topicname")="" then%>
<script language=javascript>  
alert( "错误:请输入专题名称!"  );
location.href = "javascript:history.back()"  
</script>
<%elseif request("topicinfo")="" then%>
<script language=javascript>  
alert( "错误:请输入专题简介!"  );
location.href = "javascript:history.back()"  
</script>

<%else%>
<%sql="update topic set topicname='"&request("topicname")&"',topicinfo='"&request("topicinfo")&"',classid='"&request("classid")&"' where topicid="&cstr(request("topicid"))
conn.execute(sql)%>
<script language=javascript>  
alert( "专题修改成功!"  );
location.href = "topic.asp"  
</script>
<%end if%>
<%end sub%>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td>&nbsp;</td>
  </tr>
</table>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -