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

📄 editpost.asp

📁 他是一个asp+access的多用户留言板!
💻 ASP
字号:
<!-- #include file="密码验证.asp" -->
<%
if NOIPUserTit="管理员" or NOIPUserTit="班长" then Ding=(Request.Form("Ding")="Ding")
del = Request.QueryString("del")
ReplyID =Request.QueryString("replyid")
PostID = Request.QueryString("PostID")


if del = "" and (ReplyID<>"" or PostID<>"")  then
   if Request.Form("D2") <>"" then
          set rs = server.CreateObject("ADODB.Recordset")
          if ReplyID<>"" then
              rs.open "SELECT * FROM 文章回复 WHERE id=" & ReplyID ,conn ,3,3

              writer=rs("回复人")
              if writer<>NOIPUserID and (NOIPUserTit<>"管理员" and NOIPUserTit<>"班长") then Response.Status="404" :  Response.End 
              rs("回复标题")=Request.Form("Subject")
              rs("回复内容")=Request.Form("content")
              postid=rs("文章")
              rs.update 
              rs.Close
              set rs = nothing
              Response.Redirect "showpost.asp?postid=" & postid & "&class=" & classnum
          else
              rs.open "SELECT * FROM 文章标题 WHERE id=" & PostID ,conn ,3,3
              writer=rs("发送人")
              if writer<>NOIPUserID and (NOIPUserTit<>"管理员" and NOIPUserTit<>"班长") then Response.Status="404" :  Response.End 
              rs("文章标题")=Request.Form("Subject")
              rs("内容")=Request.Form("content")
              rs("置顶")=Ding
              rs.update              
              rs.Close
              set rs = nothing
              Response.Redirect "showpost.asp?postid=" & postid & "&class=" & classnum
          end if
   end if
   set rs = server.CreateObject("ADODB.Recordset")
   if ReplyID<>"" then
       rs.open "SELECT * FROM 文章回复 WHERE id=" & ReplyID ,conn ,3,1
       A_title=rs("回复标题")
       A_inner=server.htmlencode(rs("回复内容"))
       writer=rs("回复人")
       rs.Close
       set rs = nothing
   else
       rs.open "SELECT * FROM 文章标题 WHERE id=" & PostID ,conn ,3,1
       A_title=rs("文章标题")
       A_inner=server.htmlencode(rs("内容"))
       
       writer=rs("发送人")
       rs.Close
       set rs = nothing
   end if
   
if (writer<>NOIPUserID and (NOIPUserTit<>"管理员" and NOIPUserTit<>"班长") ) or NOIPUserID =-1 then Response.Status="404" :  Response.End 


title="编辑帖子"
%>



<!-- #include file="head.asp" -->
<script language=VBScript>
top.document.title="编辑帖子"
if instr(1,top.location,"index.asp")=0 then top.location="index.asp?url=" & replace(self.location ,"&","%26") & "&class=" & classnum



</script>


<%valigntop()%>
<span style="font-style: 12px">

</span>
<table cellspacing="1" cellpadding="0" width="97%" align="center" border="0" class="a2"><tr height="25" id=TableTitleLink>
	<td width="12%" height="24" class="a1" align="center">
	<span style="font-style: 12px"><b>编辑帖子</b></span></td>
</table>
<center>
<table class="a2" cellSpacing="1" cellPadding="0" width="97%" border="0" id="table1">
<td class="a3" align="middle" width="7%">
<% if ReplyID<>"" then%>
<form method="POST" name="NEWtopic" action="EditPost.asp?ReplyID=<%=ReplyID%>&class=<%=classnum%>">
<%else%>
<form method="POST" name="NEWtopic" action="EditPost.asp?PostID=<%=PostID%>&class=<%=classnum%>">
<%end if%>
<TABLE cellSpacing=1 cellPadding=6 width=100% border=0 class=a2 align=center id="table1">

	
<TR>

<TD class=a3 width="180"><B>文章标题 </B> 


</TD>
<TD class=a3 height=13>
<INPUT maxLength=50 size=60 name=Subject value="<%=A_title%>">



</TD></TR>


<TR>
<TD vAlign=top class=a3>
<TABLE cellSpacing=0 cellPadding=0 align=Left border=0 width=100% height="100%" id="table2">

<TR>
<TD vAlign=top align=Left width=100% class=a3><BR><B>文章内容</B><BR>
(<a href="javascript:CheckLength();">查看内容长度</a>)<BR>
<BR><span id=UpFile></span>


</TD></TR>

<TR><TD valign="bottom">
<% if NOIPUserTit="管理员" or NOIPUserTit="班长" then%>
<input type="checkbox" name="Ding" value="Ding">置顶帖

<%end if%>

<input name="content" type="hidden" value="<%=A_inner%>">

</TD></TR>

</TABLE></TD>

<TD class=a3 height=250>

<SCRIPT src="inc/Post.js"></SCRIPT>

</TD></TR>

<TR>
<TD align=middle class=a3 colSpan=2 height=27>
<INPUT type=button value=提交修改 name=EditSubmit onclick=javascript:fabiao()>&nbsp; <INPUT type=reset value=" 重 置 " id=reset1 name=reset1></TD></TR>


</TABLE>
</FORM>




</td>

</table>
<span style="font-style: 12px">
<%valignbottom()%></span></center><span style="font-style: 12px"><br>
</span>
<!-- #include file="foot.asp" -->

<SCRIPT language=vbscript>
'for each a in 
document.frames("HtmlEditor").document.body.innerHTML=document.forms("NEWtopic").content.value
function fabiao()
setMode "EDIT"
document.forms("NEWtopic").content.value=document.frames("HtmlEditor").document.body.innerHTML
document.forms("NEWtopic").submit()
end function
'next

</SCRIPT>
<%elseif del="" then
Response.Status="404"
 Response.End
   elseif del="delit" then
      
        
   set rs = server.CreateObject("ADODB.Recordset")
   rs.open "SELECT * FROM 文章回复 WHERE 文章=" & PostID ,conn ,3,3
   
      set rs1 = server.CreateObject("ADODB.Recordset")
      rs1.open "SELECT * FROM 文章标题 WHERE id=" & PostID ,conn ,3,3
   
   if (rs1("发送人")<>NOIPUserID and (NOIPUserTit<>"管理员" and NOIPUserTit<>"班长") ) or NOIPUserID <0 then Response.Status="404" :  Response.End 
   rs1.close
   set rs1=nothing
   
   for i = 1 to rs.recordcount
   if not rs.eof then
   rs.delete
   rs.update
   rs.movenext
   end if
   next
   
   rs.close
   set rs=nothing  
   

   set rs = server.CreateObject("ADODB.Recordset")
   rs.open "SELECT * FROM 文章标题 WHERE id=" & PostID ,conn ,3,3
   
      set rs1 = server.CreateObject("ADODB.Recordset")  
      rs1.open "SELECT * FROM NOIP选手 Where id=" & rs("发送人") ,conn ,3,3
      if not rs1.eof and not rs1.bof then
      rs1("学分")=rs1("学分")-1
      rs1("文章数")=rs1("文章数")-1
      rs1.update
      end if
      rs1.close
      set rs1=nothing
   
   
   rs.delete
   rs.update
   rs.close
   set rs=nothing
   
   
   Response.Redirect "postlist.asp?class="&classnum
   
   
   
   elseif del="delreply" then
   set rs = server.CreateObject("ADODB.Recordset")
   rs.open "SELECT * FROM 文章回复 WHERE id=" & ReplyID ,conn ,3,3
   apostid=rs("文章")
      
      set rs1 = server.CreateObject("ADODB.Recordset")  
      rs1.open "SELECT * FROM NOIP选手 Where id="&rs("回复人") ,conn ,3,3
      if not rs1.eof and not rs1.bof then
      rs1("学分")=rs1("学分")-1
      rs1("文章数")=rs1("文章数")-1
      rs1.update
      end if
      rs1.close
      set rs1=nothing
      
   rs.delete
   rs.update
   rs.close
   set rs = server.CreateObject("ADODB.Recordset")
   rs.open "SELECT * FROM 文章标题 WHERE id=" & apostid ,conn ,3,3
   rs("回复")=rs("回复")-1
   rs.update
   rs.close
   
   Response.Redirect "showpost.asp?postid=" & apostid & "&class=" & classnum
end if
  %>

⌨️ 快捷键说明

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