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

📄 admin_announcement.asp

📁 BBS论坛的开发和设计
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="admin/BBSConfig.asp"-->
<!--#include file="INC/online.asp"-->
<!--#include file="INC/ShowMsg.asp"-->
<!--#include file="INC/header.asp"-->
<!--#include file="INC/style.asp"-->
<%
'****************************************************************
'*  joinboard BBS Ver2.3.0/友盟论坛 Ver2.3.0
'*
'*  版权所有: JoinBoard V2.3
'*
'*  程序制作: 友盟工作室
'*           
'*  主页地址: http://joinboard.com    友盟论坛
'*
'*  论坛地址: http://bbs.joinboard.com/、http://youmeng.com
'*	                 
'****************************************************************
'*  Powered by: JoinBoard V2.3
'* Copyright 2003-2004. - All Rights Reserved.
'*  JoinBoard is a trademark of YouMeng Studio.
'****************************************************************
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="joinboard,forum,bbs,youmeng,友盟论坛">
<title><%=BBS_Config(0)&" - 管理论坛公告 - "%></title>
<link href="<%=Css_path%>" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<%
Call onlineuser()
call top()

response.Write "<table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""path-table"">"
response.Write "<tr><td>"
response.Write "<img src="""& BBS_Skin(3) &"JBB_bullet.gif"">&nbsp;<a href="""&BBSHomeUrl&""">"& BBS_Config(0) &"</a>&nbsp;<img src="""& BBS_Skin(3) &"JBB_bullet.gif"">&nbsp;管理论坛公告<strong></strong>"
response.Write "</td></tr></table><br><br>"

Sub errorMsg(theError)
response.write"<script language=javascript>alert('"& theError &"');history.back();</script>"
response.End
End Sub
'-----------------------------------------
if usergroup = 1 then
	adminAN = true
elseif usergroup = 2 or usergroup = 3 then
	set rs = Conn.ExeCute("select Mod_nameID from JBB_Mod where Mod_nameID="& userid &" and Mod_stop=0 and Mod_announcement=1")
	if Not rs.eof then
		adminAN = true
	End if
	set rs = nothing
End if
'-------------------------
if usergroup < 3 and adminAN <> true then
	showMsg"对不起,您不可以管理本论坛公告!~"
	Call Bottom()
	response.End()
End if
'-------------------------------------------------------
action = trim(request.QueryString("action"))
SELECT CASE action
	Case "add"
		Call add()
	Case "SaveNew"
		Call SaveNew()
	Case "edit"
		Call Edit()
	Case "SaveEdit"
		Call SaveEdit()
	Case "del"
		Call Del()
End SELECT
'--------------------------------------
Sub del()
	anID = trim(request.QueryString("ID"))
	if Not(IsNumeric(anID)) or anID = "0" then
		response.Write("<META HTTP-EQUIV='REFRESH' CONTENT='0; URL="&BBSHomeUrl&"'>")
		response.End()
	End if
	'------------------
	set rs = Conn.ExeCute("select userID from JBB_announcement where ID="&anID)
	if not rs.eof then
		if int(userid)=int(rs(0)) then
			delAN=true
		End if
	else
		showmsg "该公告不存在或者已经被删除"
		set rs = nothing
		Call Bottom()
		response.end
	End if
	set rs = nothing
	'------------------
	if delAN = true then
		Conn.ExeCute("delete From JBB_announcement where ID="&anID)
		showMsg "删除完毕,<a href=""javascript:window.close()"">点击这里关闭本窗口</a>"
	else
		showMsg "对不起,本公告不是您所发,您无法删除,<a href=""javascript:history.back()"">点击这里返回</a>"
	End if
End Sub
'------------------------------------------
Sub SaveEdit()
	ID = trim(request.QueryString("ID"))
		if Not(IsNumeric(ID)) then ErrorMsg = "参数错误!~"
	title = trim(request.form("title"))
	title = replace(title,"'","")
		if title ="" then ErrorMsg  "请输入公告标题!~"
	content = replace(request.form("content"),"'","")
		if content = "" then ErrorMsg "请输入公告内容!~"
	Conn.ExeCute("update JBB_announcement set title='"& title &"',content='"& content &"' where id = "&id)
	showMsg "修改成功!~<a href=""javascript:window.close()"">点击这里关闭本窗口</a>,<a href=""announcement.asp?ID="& id &""">点击这里返回本公告</a>"
End Sub
'---------------------------------------------
Sub Edit()
	id = trim(request.QueryString("id"))
		if Not(IsNumeric(id)) then ErrorMsg "参数错误!~"
	set rs = server.CreateObject("adodb.recordset")
	rs.open "select title,content,userid from JBB_announcement where id="&id,conn,1,1
	if Not(rs.eof and rs.bof) then
		if int(userid) <> int(rs("userid")) then
			showMsg "对不起,本公告不是您所发,您无法编辑,<a href=""javascript:history.back()"">点击这里返回</a>"
		else
%><br>
  
<form name="form1" method="post" action="?action=SaveEdit&id=<%=id%>">
  <table width="481" height="144" border="0" align="center" cellpadding="4" cellspacing="1" class="table">
    <tr class="table-title"> 
      <td colspan="2"><strong>编辑公告</strong></td>
    </tr>
    <tr class="table-dark"> 
      <td width="99" height="31">公告标题: </td>
      <td width="300"> 
        <input name="title" type="text" id="title3" value="<%=rtrim(rs(0))%>" size="30"></td>
    </tr>
    <tr valign="top" class="table-dark"> 
      <td height="30" class="table-dark">公告内容:</td>
      <td> 
        <textarea name="content" cols="50" rows="5" id="textarea2"><%=rs(1)%></textarea></td>
    </tr>
  </table>
  <div align="center"><br>
    <input name="Submit" type="submit" class="form1" value="修改">
      
    <input name="Submit2" type="reset" class="form1" value="重置">
</div>
  </form>
<%
		End if
	End if
	rs.close
	set rs = nothing	
End Sub
'----------------------------------------
Sub add()
	BoardID = trim(request.QueryString("BoardID"))
		if Not(IsNumeric(BoardID)) then ErrorMsg "参数错误!~"
	if usergroup = 3 then
		set rs = Conn.ExeCute("select Mod_nameID from JBB_Mod where Mod_nameID="&userid &" and Mod_stop=0 and Mod_announcement=1 and Mod_BoardID="&BoardID)
		if rs.eof or rs.Bof then
			showMsg "对不起,您不是本版版主或者您没有发布论坛公告的权限。<a href=""javascript:history.back()"">请点击这里返回!</a>"
			set rs = nothing
			Call Bottom()
			response.End()
		End if
		set rs = nothing
	End if
%>
<br>
  
<form name="form1" method="post" action="?action=SaveNew&BoardID=<%=trim(request.querystring("BoardID"))%>">
  <table width="481" height="40" border="0" align="center" cellpadding="4" cellspacing="1" class="table">
    <tr class="table-title"> 
      <td colspan="2"><strong>发布公告</strong></td>
    </tr>
    <tr class="table-dark"> 
      <td width="99" height="30">公告标题: </td>
      <td width="300"> 
        <input name="title" type="text" id="title" size="30"></td>
    </tr>
    <tr valign="top" class="table-dark"> 
      <td height="30" class="table-dark">公告内容: </td>
      <td> <textarea name="content" cols="50" rows="5" id="content"></textarea></td>
    </tr>
  </table>
<div align="center"><br>
    <input name="Submit" type="submit" class="form1" value="添加">
      
    <input name="Submit2" type="reset" class="form1" value="重置">
</div>
  </form>
<%
End Sub
'========================
Sub SaveNew()
	BoardID = trim(request.QueryString("BoardID"))
		if Not(IsNumeric(BoardID)) then ErrorMsg  "参数错误!~"
	if usergroup = 3 then
		set rs = Conn.ExeCute("select Mod_nameID from JBB_Mod where Mod_nameID="&userid &" and Mod_stop=0 and Mod_announcement=1 and Mod_BoardID="&BoardID)
		if rs.eof or rs.Bof then
			showMsg "对不起,您不是本版版主或者您没有发布论坛公告的权限。<a href=""javascript:history.back()"">请点击这里返回!</a>"
			set rs = nothing
			Call Bottom()
			response.End()
		End if
		set rs = nothing
	End if
	'----------------------------------
	title = trim(request.form("title"))
	title = replace(title,"'","")
		if title ="" then ErrorMsg  "请输入公告标题!~"
	content = replace(request.form("content"),"'","")
		if content = "" then ErrorMsg "请输入公告内容!~"
	UserID = request.Cookies(JBBMasterCookies)("UserID")
	if UserID="" then UserID=1
	Conn.ExeCute("insert into JBB_announcement(title,content,BoardID,UserID,times) values('"& title &"','"& content &"',"& BoardID &","& UserID &",'"& Now() &"')")
	showMsg "添加成功!~<a href=""Board.asp?BoardID="& Boardid &""">点击这里返回论坛</a>"
End Sub
'---------------------------------------------------------
Call Bottom()
%>

⌨️ 快捷键说明

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