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

📄 announce.asp

📁 一个不错的论坛原代码
💻 ASP
字号:
<!--#include file="Connections.asp" -->
<!--#include file="top.asp" -->
<!--#include file="ubb.asp" -->

<%
 if h_viewcpb=1 and isuser=false then response.redirect("login.asp")
if request("l_id")<>"" then 
l_id=chktopic(request("l_id"))
cpbtitle="版面公告"
ltitle="返回论坛"
call toptitle(l_title,cpbtitle)
call head(3,"返回前页",Request.ServerVariables("HTTP_REFERER"),cpbtitle)
else
l_id="0"
cpbtitle="论坛公告"
call toptitle(l_title,cpbtitle)
call head(4,"返回前页",Request.ServerVariables("HTTP_REFERER"),cpbtitle)

end if

sql="select id,a_title,a_content,a_username,a_time from announce where a_num="&l_id&" order by a_time desc"
set rs=conn.execute(sql)
%>

<% checkurl=1
if   Request.QueryString("action")="" then%>
<center>
  <table border=1 borderColor=<%=tdc2%> cellPadding=2 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse">        
  <tr align="center"> 
    <td colspan="4" <%=hColor%> class=tdc1 height=22><%=cpbtitle%></td>
  </tr>
  <% if rs.bof and rs.eof then%>

  <tr align="center"> 
    <td <%=tColor%> class=tdc1 height=23 width="10%">  </td>
    <td colspan="2" <%=tColor%> class=tdc1 height=23>暂无公告</td>
    <td <%=tColor%> class=tdc1 height=23 width="10%"></td>
  </tr>
  <%else%>
  <% do while not rs.eof%>
  <tr align="center"> 
    <td <%=tColor%> class=tdc1 height=23 width="20%" colspan="4"> &gt;&gt;<%=rs("a_title")%>&lt;&lt;</td>
  </tr>
  <tr align="left" height=50> 
    <td colspan="4" bgcolor=<%=tColor2%> class=tdc align=center><table width=90%>
<tr><td class=tdc ><%=ubbcode(rs("a_content"))%> </td></tr></table></td>
  </tr><tr><td colspan="2" bgcolor=<%=tcolor1%> class=tdc width=50%>发布者:<%=rs("a_username")%></td>
    <td align="right" bgcolor=<%=tColor1%> class=tdc colspan="2" width=50%>发布时间:<%=rs("a_time")%></td></tr>

<% rs.movenext
loop
set rs=nothing%>

    
    
      



<% end if%>
</table>
</center>

<%elseif  Request.QueryString("action")="del" then
   if isuser=false then
errornum=1
errormsg="<LI>很抱歉,您没有权限操作,你没有登陆,请先登陆</LI>"
 end if
  if errornum<> 1 then
if issupermaster=false   then
errornum=1
errormsg="<LI>很抱歉,你没有权限操作</LI><LI>请确认您是管理员</LI>"
end if
end if
if errornum=1 then
 call error(errormsg)
else
     for i=1 to request.form("a_id").count
     sqldel="DELETE from announce where id="&chktopic(Request.form("a_id")(i))&""
     conn.Execute (sqldel)
     next
      succmsg="<Li>公告已经删除</Li>"
 call succ(succmsg)   
call bq()
response.end  
end if


elseif  Request.QueryString("action")="list" then
   if isuser=false then
errornum=1
errormsg="<LI>很抱歉,您没有权限操作,你没有登陆,请先登陆</LI>"
 end if
  if errornum<> 1 then
if issupermaster=false   then
errornum=1
errormsg="<LI>很抱歉,你没有权限操作</LI><LI>请确认您是管理员</LI>"
end if
end if
if errornum=1 then
 call error(errormsg)
else%>
<table border=1 borderColor=<%=tdc2%> cellPadding=2 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse">        
    <tr align="center"> 
      <td colspan="5" <%=tColor%> class=tdc1 height=25><a href="?action=post">发布公告</a> 
      | <a href="?action=list">管理公告</a></td>
    </tr
    <tr align="center"> 

          <td width="5%" align="center" height="23" <%=tColor%> class=tdc1>ID</td>
        
         
          <td <%=tColor%> class=tdc1>标题</td>
   
           <td align=center nowrap width="15%" <%=tColor%> class=tdc1>作者</td>
          <td align=center  nowrap width="15%" <%=tColor%> class=tdc1>时间</td>
          <td align=center width="5%" <%=tColor%> class=tdc1 >操作</td>
        </tr>
  <%page=chktopic(request.querystring("page"))
  if page="" then  page=1
  pages = ""&t_page&""
set rs = server.createobject("adodb.recordset") 
sql="select id,a_time,a_title,a_username  from announce order by a_time desc"
  rs.open sql,conn,1,1
  if not(rs.BOF or rs.EOF) then
rs.pagesize = pages 
maxpagecount=rs.pagecount
r=cint(rs.RecordCount)'记录总数
rs.absolutepage = page '当前页数
rcount=0
 do while not rs.eof and rcount <rs.pagesize
'判断是否要分页
%>  <form method="POST" action="?action=del">

    <tr > 
          <td width="5%" align="center" height="23" bgcolor=<%=tColor1%> class=tdc><a href=?action=edit&a_id=<%=rs("id")%> title=修改公告><%=rs("id")%></a></td>
        
         
          <td bgcolor=<%=tColor1%> class=tdc><%=rs("a_title")%> </td>
   
           <td align=center nowrap width="15%" bgcolor=<%=tColor1%> class=tdc><%=rs("a_username")%> </td>
          <td align=center  nowrap width="15%" bgcolor=<%=tColor1%> class=tdc><%=rs("a_time")%> </td>
          <td align=center width="5%" bgcolor=<%=tColor1%> class=tdc>   <input type="checkbox" name=a_id value="<%=rs("id")%>">    </td>
        </tr>
         <% 
rs.MoveNext 
rcount=rcount+1
loop 
end if
rs.close 
set rs=nothing 
%> 
<tr  align="left"> 
            <td colspan="4" bgcolor=<%=tColor2%> class=tdc >
 
 
   <%
            if maxpagecount="" then maxpagecount=1
            if r="" then r=0
pagestart=page-5
pageend=page+5
if pagestart<1 then pagestart=1
if pageend>maxpagecount then pageend=maxpagecount
response.write(" [ ")
if maxpagecount > 6 then Response.Write ("<a href=?action=list&page=1>1</a> ... ")
for i=pagestart to pageend
if i<>int(page) then
Response.Write (" <a href=?action=list&page="&i&">" & i & "</a> ")
else
Response.Write ("<b>"&i&"</b> ")
end if
next
if maxpagecount > page +5 then Response.Write( " ... <a href=?action=list&page="&maxpagecount&">"&maxpagecount&"</a>")
response.write(" ] ")
response.write("..页次:"&page&"/"&maxpagecount&"页   每页:"&pages&" 公告数:"&r&" ")
%>  </td>  <td height="21" width="11%" align="center"  bgcolor=<%=tColor2%> class=tdc> 
              
            <input type="submit" value="删除" name="B1" class=bdtj>    
                            
 </td>
</tr>
  <% end if%> 
      </form>
      </table>
        

<%
elseif  Request("action")="post" then
   if isuser=false then
errornum=1
errormsg="<LI>很抱歉,您没有权限操作,你没有登陆,请先登陆</LI>"
 end if
  if errornum<> 1 then
if issupermaster=false and ismaster=false and isbordermaster=false then
errornum=1
errormsg="<LI>很抱歉,你没有权限操作</LI><LI>请确认你是管理员或者是总版主或者是版主</LI>"
end if
end if
if errornum=1 then
 call error(errormsg)
else
 if Request.querystring("mode")="add" then
a_username=cpbusername
a_content=chktopic(request.form("a_content"))
a_title=chktopic(request.form("a_title"))
a_num=chktopic(request("a_num"))
if a_num="" or a_title="" or a_content="" or a_username="" or len(a_title)>30 then
errornum=1
errormsg="<LI>每一项都不能为空</LI><LI>版面请不要选择带“+”的</LI><LI>标题不要超过30个字符</LI>"
 call error(errormsg)
 call bq()
 response.end
end if
if issupermaster=false and ismaster=false then
if a_num<>0 then
sql="select l_banzhu from lanmu where l_id="&a_num&""
set rs=conn.execute(sql)
if not rs.eof then
l_banzhu=rs("l_banzhu")
if not isnull(l_banzhu) and l_banzhu<>"" and isuser and isbordermaster then
    if instr(l_banzhu,cpbusername)=0 then
errornum=1
errormsg="<LI>很抱歉,你没有权限操作</LI><LI>请确认你是管理员或者是总版主或者是该版块的版主</LI>"
  end if
  else
  errornum=1
errormsg="<LI>很抱歉,你没有权限操作</LI><LI>请确认你是管理员或者是总版主或者是该版块的版主</LI>"
  end if
  else
  errornum=1
errormsg="<LI>很抱歉,你没有权限操作</LI><LI>请确认你是管理员或者是总版主或者是该版块的版主</LI>"
end if
  set rs=nothing
else
errornum=1
errormsg="<LI>很抱歉,你没有权限操作</LI><LI>请确认你是管理员或者是总版主或者是该版块的版主</LI>"
end if
end if
if errornum=1 then
 call error(errormsg)
 call bq()
 response.end
 end if


sql="insert into announce (a_title,a_content,a_username,a_time,a_num) values('"&a_title&"','"&a_content&"','"&a_username&"','"&nowtime&"',"&a_num&")"
conn.execute(sql)
succmsg="<LI>公告已经发布</LI>"
call succ(succmsg)
call bq()
response.end
end if
 %>
<table border=1 borderColor=<%=tdc2%> cellPadding=0 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse">        
  <tr align="center"> 
<form ACTION="announce.asp?action=post&mode=add" METHOD="POST" name="form1">
      <td colspan="2" <%=tColor%> class=tdc1 height=25><a href="?action=post">发布公告</a> 
      | <a href="?action=list">管理公告</a></td>
    </tr>
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>发布者:</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<input type="text" name="a_author" value="<%=cpbusername%>" size="20" class=bdtj3 disabled>
      </td>
    </tr>
     <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>版面:</td>
    
      <td bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<SELECT size=1 name=a_num class=bdtj3><OPTION value="0">++==论坛首页==++</OPTION>
<% sqlfen="select f_id,f_title from fenlei order by f_num asc"
set rsfen=conn.execute(sqlfen)
do while not rsfen.eof%>
<option value="">++<%=rsfen("f_title")%>++</option>
<%sql_lanmu1="select l_id,l_title from lanmu where f_id="&rsfen("f_id")&""
set rs_lanmu1=conn.execute(sql_lanmu1)
%>
               <% do while not rs_lanmu1.Eof %>
      
      <option value=<%=rs_lanmu1("l_id")%> <%if int(request("l_id"))=int(rs_lanmu1("l_id")) then response.write(" selected")%>>&nbsp;&nbsp;├<%=rs_lanmu1("l_title")%></option>
      
      <%rs_lanmu1.MoveNext 
        Loop
        set rs_lanmu1=nothing
       
        rsfen.movenext
			loop
			set rsfen=nothing
			 set rslanmu=nothing%>  </select>
</SELECT>&nbsp;&nbsp;您只能在您管理的版面发布公告,请不要选择带“+”的 
      </td>
    </tr>
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>公告标题:</td>
      <td  bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<input type="text" name="a_title"  class=bdtj3 size="40">
      </td>
    </tr>
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>公告内容:</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<textarea name="a_content" cols="50" rows="5" class=bdtj3></textarea>
      </td>
    </tr>
    <tr> 
      <td bgcolor=<%=tColor2%> class=tdc> </td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        <input type="submit" name="Submit" value="提交" class=bdtj>
        <input type="reset" name="Submit2" value="重设" class=bdtj>
      </td>
    </tr>
</form>
  </table>

<% 
end if

elseif  Request.QueryString("action")="edit" then
   if isuser=false then
errornum=1
errormsg="<LI>很抱歉,您没有权限操作,你没有登陆,请先登陆</LI>"
 end if
  if errornum<> 1 then
if issupermaster=false   then
errornum=1
errormsg="<LI>很抱歉,你没有权限操作</LI><LI>请确认您是管理员</LI>"
end if
end if
if errornum=1 then
 call error(errormsg)
else
sql="select id,a_num,a_title,a_content,a_username from announce where id="&chktopic(request("a_id"))&""
set rs=conn.execute(sql)
if rs.eof then
errormsg="<LI>无此公告</LI>"
 call error(errormsg)
 call bq()
 response.end
end if

 if Request.querystring("mode")="add" then
a_username=chktopic(request.form("a_username"))
a_content=chktopic(request.form("a_content"))
a_title=chktopic(request.form("a_title"))
a_num=chktopic(request("a_num"))
if a_num="" or a_title="" or a_content="" or a_username="" or len(a_title)>30 then
errornum=1
errormsg="<LI>每一项都不能为空</LI><LI>版面请不要选择带“+”的</LI><LI>标题不要超过30个字符</LI>"
 call error(errormsg)
 call bq()
 response.end
end if



sql="update announce set a_title='"&a_title&"',a_content='"&a_content&"',a_num="&a_num&",a_username='"&a_username&"' where id="&chktopic(request("a_id"))&""

conn.execute(sql)
succmsg="<LI>公告已经更新</LI>"
call succ(succmsg)
call bq()
response.end
end if
 %>
<table border=1 borderColor=<%=tdc2%> cellPadding=0 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse">        
  <tr align="center"> 
<form ACTION="announce.asp?action=edit&mode=add&a_id=<%=rs("id")%>" METHOD="POST" name="form1">
      <td colspan="2" <%=tColor%> class=tdc1 height=25><a href="?action=post">发布公告</a> 
      | <a href="?action=list">管理公告</a></td>
    </tr>
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>发布者:</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<input type="text" name="a_username" value="<%=rs("a_username")%>" size="20" class=bdtj3 >
      </td>
    </tr>
     <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>版面:</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<SELECT size=1 name=a_num class=bdtj3><OPTION value="0">++==论坛首页==++</OPTION>
<% sqlfen="select f_id,f_title from fenlei order by f_num asc"
set rsfen=conn.execute(sqlfen)
do while not rsfen.eof%>
<option value="" >++<%=rsfen("f_title")%>++</option>
<%sql_lanmu1="select l_id,l_title from lanmu where f_id="&rsfen("f_id")&""
set rs_lanmu1=conn.execute(sql_lanmu1)
%>
               <% do while not rs_lanmu1.Eof %>
      
      <option value="<%=rs_lanmu1("l_id")%>" <%if int(rs("a_num"))=int(rs_lanmu1("l_id")) then response.write(" selected")%>>&nbsp;&nbsp;├<%=rs_lanmu1("l_title")%></option>
      
      <%rs_lanmu1.MoveNext 
        Loop
        set rs_lanmu1=nothing
       
        rsfen.movenext
			loop
			set rsfen=nothing
			 set rslanmu=nothing%>  </select>
</SELECT>&nbsp;&nbsp;请不要选择带“+”的 
      </td>
    </tr>
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>公告标题:</td>
      <td  bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<input type="text" name="a_title"  value=<%=rs("a_title")%>  class=bdtj3 size="40">
      </td>
    </tr>
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>公告内容:</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        &nbsp;<textarea name="a_content" cols="50" rows="5" class=bdtj3><%=rs("a_content")%></textarea>
      </td>
    </tr>
    <tr> 
      <td bgcolor=<%=tColor2%> class=tdc> </td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        <input type="submit" name="Submit" value="提交" class=bdtj>
        <input type="reset" name="Submit2" value="重设" class=bdtj>
      </td>
    </tr>
</form>
  </table>
 <% end if
end if%><!--#include file="bq.asp" -->

⌨️ 快捷键说明

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