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

📄 edit.asp

📁 完美政府版,正版网站解决方案
💻 ASP
字号:
<!--#include file="up.asp"-->
<%
dim action,content,bbsid,canedit,bbsbd,bbsuserid,bbstype,topic,topictype,bad,b,uptype,contentok,face,topicok,topicinfo,addtime,content2,sql,lasttopic,oldtime,face1,oldname,renum,pagesetup,pagenum
action=request.querystring("action")
canedit=false


function strLength(str)
	dim rep,str1,i,lens
	set rep=new regexp
	rep.Global=true
	rep.IgnoreCase=true
	rep.Pattern="[\u4E00-\u9FA5\uF900-\uFA2D]"
	set str1=rep.Execute(str)
	for each i in str1
		lens=lens+1
	next
	lens=lens + len(str)
	strLength=lens
end function

function checkbad(str)
	if isnull(str) then exit function 
	bad=split(application(prefix&"badcontent"), "|")
	for b=0 to ubound(bad)
		str=Replace(str,bad(b),string(len(bad(b)),"*")) 
	next
	checkbad=str
end function

bbsid=checknum(request.querystring("bbsid"))
topictype=checknum(request.querystring("topictype"))
set rs=conn.execute("select top 1 id,bid,userid,content,bd,type from bbs"&totable&" where bbsid="&bbsid&" and bd="&bd&"")
if rs("id")=0 then id=rs("bid")
if rs("bid")=0 then id=rs("id")
bbsbd=rs("bd")
bbsuserid=rs("userid")
bbstype=rs("type")
content=rs("content")
content=split(content,"|")
oldname=content(2)
set rs=nothing
face=replace(content(0),"face","")
face1=face
if face="vote" then face1="0"


oldtime=content(5)
if usertype>3 or (usertype=3 and instr("|"&adminbd&"|","|"&bd&"|")>0) then
	canedit=true
else
	if lguserid=bbsuserid and bbstype<>2 then
		canedit=true
	end if
end if

if canedit=false then
	tl=" 操 作 失 败"
	mes="<b>对不起,你不能够编辑该帖子,可能存在以下问题:</b><br>·你不是该版版主或者管理员。<br>·你不是该帖子的作者。<br>·该帖子已经被锁定。"
	call sendinfo(tl,mes)
	call down
	response.end
end if

renum=conn.execute("select top 1 renum from topic where id="&id&"")(0)
pagesetup=checknum(application(prefix&"showbbspage"))
If renum/pagesetup > (renum\pagesetup) then
	pagenum=(renum\pagesetup)+1
	else pagenum=(renum\pagesetup)
End If

select case action
case""
if topictype=1 then
	topic=checktitle(content(1))
elseif topictype=2 then
	topic="回复帖子"
end if%>
<SCRIPT>
function preview()
{
if(htmlsubmit()){
document.form1.topic.value=document.topicform.topic.value;
document.form1.content.value=document.topicform.content.value;
var popupWin = window.open('paper.asp?action=preview', 'showgg', 'width=500,height=400,resizable=1,scrollbars=yes,menubar=no,status=yes');
document.form1.submit()
}
}

function checkeditor(editor)
{
if(editor=="html")
	{
				document.getElementById("ubbeditordiv").style.display = 'none';
				document.getElementById("htmltoolbar").style.display = 'block';
				EDITFORM_DOCUMENT.body.innerHTML = document.getElementById("CodeForm").value;
				document.getElementById("editTextarea").style.display = 'none';
				document.getElementById("editIframe").style.display = 'block';
				HtmlDisableToolbar(false);
	}
else if(editor=="ubb")
	{
				document.getElementById("ubbeditordiv").style.display = 'block';
				document.getElementById("htmltoolbar").style.display = 'none';
				document.getElementById("CodeForm").value = HtmlHtmlToXhtml(EDITFORM_DOCUMENT.body.innerHTML);
				document.getElementById("editIframe").style.display = 'none';
				document.getElementById("editTextarea").style.display = 'block';
				HtmlDisableToolbar(true);
	}
}


</SCRIPT>
<form name="topicform" method="POST" action="edit.asp?action=edit&bd=<%=bbsbd%>&bbsid=<%=bbsid%>&totable=<%=totable%>&topictype=<%=topictype%>">
<div class=addtopictitle>发表帖子</div>

<div class=addtopicbody>
    <table class=addtopictable cellpadding="0" style="border-collapse: collapse" width="100%">
      <tr>
        <td width="200" ><p style="line-height: 150%; margin: 5">
       <b>帖子主题:</b></td>
        <td>&nbsp;<input type=text name=topic id="topic" size=80 maxlength=50 value="<%=topic%>" onkeydown="if(event.keyCode==13)return false;"> <SELECT name=font onchange=DoTitle(this.options[this.selectedIndex].value) style="font-size: 9pt">
<OPTION selected value="">话题</OPTION> <OPTION value=[原创]>[原创]</OPTION><OPTION value=[转帖]>[转帖]</OPTION><OPTION value=[讨论]>[讨论]</OPTION><OPTION value=[求助]>[求助]</OPTION><OPTION value=[推荐]>[推荐]</OPTION><OPTION value=[公告]>[公告]</OPTION><OPTION value=[注意]>[注意]</OPTION><OPTION value=[贴图]>[贴图]</OPTION><OPTION value=[建议]>[建议]</OPTION> <OPTION value=[下载]>[下载]</OPTION></SELECT></td>
      </tr>
      <tr>
        <td>
        <p style="line-height: 150%; margin: 5"><b>你的表情:</b> <br>·放在帖子前面。</td>
        <td><p style="line-height: 150%; margin: 5"><script>
for(i=1;i<=18;i=i+1) {
if (i==10){document.write("<p style='line-height: 150%; margin: 5'>")}
if (i==1){document.write("<input type=radio value=face"+i+" name=face checked><img border=0 src=images/face/face"+i+".gif>")}
else {document.write("<input type=radio value=face"+i+" name=face><img border=0 src=images/face/face"+i+".gif>")}
}
        </script> </td>
      </tr>
<tr>
        <td>
        <p style="margin: 5"><b>文件上传:</b><br>·上传一个文件需要10点积分。</td>
<td>
<p style="margin: 5"><%if checknum(application(prefix&"canupload"))=1 then%><IFRAME name=ad src="upload.asp" frameBorder=0 width="100%" scrolling=no height=36></IFRAME><%else%>论坛不支持上传文件。<%end if%></td>
      </tr>      
      <tr>
        <td  valign="top">
        <p style="line-height: 150%; margin: 5"><b>帖子内容:</b><br>
		<input type="radio" name="usereditor" value="html" onclick="checkeditor('html')" checked>使用Html编辑器<br>
		<input type="radio" name="usereditor" value="ubb" onclick="checkeditor('ubb')">使用UBB编辑器<br>

</td>
<td valign="top" style="padding:5px;">
<textarea name="content" cols="40" rows="2" style="display:none"><%=content(4)%></textarea>
<SCRIPT src="Editor/Ubb/UbbEditor.js"></SCRIPT>
<script type="text/javascript" src="Editor/Html/htmlEditor.js"></script>

<script>
var ubbedit=new UbbEditor("CodeForm",100,14,"default values","editor/ubb/images/");
ubbedit.showeditor();
</script>


<script type="text/javascript">
var editor = new htmlEditor("editor");
editor.hiddenName = "content";
editor.width = "100%";
editor.height = "300px";
editor.imagePath="editor/html/images/";
editor.iconPath = 'editor/html/images/face/';
editor.show();

var strlength;

//提交表单
function submitform(){
   	if(htmlsubmit())
   		{document.topicform.submit();}
}

//检测表单
function htmlsubmit() {
	if(document.getElementsByName("usereditor").item(0).checked==true){
		var content = editor.data();
	}
	else if(document.getElementsByName("usereditor").item(1).checked==true){
		checkeditor("html");
		var content = editor.data();
		checkeditor("ubb");
	}
	
		strlength=document.getElementsByName("content").item(0).value.length;
		if (strlength>25600||strlength<5){
			alert("您输入的文章长度为"+strlength+",长度必须大于5且小于25600,请修正之后再继续。");
			return false;
		}
		else if(document.getElementsByName("topic").item(0).value==""){
			alert("标题不能为空。");
			document.getElementsByName("topic").item(0).focus();
			return false;
		}
		else{
			return true;
		}
}

</script>

</td>
      </tr>
<tr>
        <td width="200">
         </td>
        <td height="30">
&nbsp;<input class=submit type=button value=OK_!修改 name=B1 onclick="submitform()">&nbsp;&nbsp;&nbsp; 
    <input class=submit type=button value="预  览!" onclick="preview()" name="B3">&nbsp;&nbsp;&nbsp; <input class=submit type=reset value=NO_!重写 name=B2>&nbsp; [ 按 Ctrl+Enter 直接发送 ]
</td>
      </tr>      </table>
    </div>
</form>

<form name=form1 action=paper.asp?action=preview method=post target=showgg>
<input type=hidden name=topic value=><input type=hidden name=content value=>
</form>

<%case"edit"
content=checkbad(left(Request.Form("content"),15000))
content=replace(content,"|","│")
content=replace(content,"'","''")

contentok=Replace(content," ","")
if face<>"vote" then
face=replace(replace(request.form("face"),"|",""),"'","")
if face="" or len(face)>6 then face="face1"
end if
canedit=true


if strLength(contentok)<5 or len(contentok)>51200 then
canedit=false
mes=mes&"·帖子内容太少,系统认为是灌水文章。<br>"
end if

topic=Replace(left(Request.Form("topic"),50),"'","''")
topic=checkbad(Replace(topic,"|","│"))
topicok=Replace(topic," ","")
topicok=replace(topicok,chr(-24159),"")
topicok=replace(topicok,chr(-23299),"")
if topicok=""  or contentok="" then
canedit=false
mes=mes&"·请填写完整帖子主题和内容。<br>"
end if

if canedit=false then
tl=" 修 改 失 败"
mes="<b>对不起,帖子修改失败,可能存在以下问题:</b><br>"&mes&"·<a href='javascript:history.go(-1)'><img src="&styleid&"/re.gif align=absmiddle border=0> 返回重新填写</a><br>"
call sendinfo(tl,mes)
call down
response.end
end if

function uptypecheck(byval str)
dim ary,pos
ary=split(str,"[upload=")
if ubound(ary)>=1 then
pos=instr(ary(1),"[/upload]")
if pos=0 then exit function
uptypecheck=left(ary(1),3)
end if
end function
uptype=uptypecheck(contentok)

addtime=now()+timeset/24
if topictype=1 then
topicinfo=face&"|"&topic&"|"&oldname&"|"
elseif topictype=2 then
topicinfo=face&"||"&oldname&"|"
end if

if uptype<>"" and instr(application(prefix&"uploadtype"),uptype)>0 then
topicinfo=topicinfo&"<img src=images/upfiletype/"&uptypecheck(contentok)&".gif border=0 align=absmiddle>"
end if

if topictype=1 then
set rs=server.createobject("adodb.recordset")
sql="Select top 1 id,topicinfo,edittime from [topic] where id="&id&" and bd="&bbsbd&""
rs.open sql,conn,1,3
rs("topicinfo")=topicinfo
rs("edittime")=addtime
rs.Update
id=rs("id")
rs.close
set rs=nothing
end if

content2=topicinfo&"|"&content&"|"&oldtime
conn.execute("update bbs"&totable&" set content='"&content2&"',edittime='"&addtime&"' where bbsid="&bbsid&" and bd="&bbsbd&"")
content2=replace(lefttrue(RemoveHTML(content),15),"'","")
lasttopic=lguserid&"|"&oldname&"|"&addtime&"|"&content2&"|"&face&"|"&id&"|"&totable&"|"&pagenum
conn.execute("update bdinfo set lasttopic='"&lasttopic&"' where id="&bbsbd&" and followid<>0")

tl=" 编 辑 成 功"
mes="<b>你已经成功修改帖子,请选择你的要进行的操作。</b><br>·<a href=showbbs.asp?bd="&bd&"&id="&id&"&totable="&totable&">回到我所编辑的帖子。</a><br>·<a href='topiclist.asp?bd="&bd&"'>返回到"&bdinfo(0)&"。</a><br>·<a href='main.asp'>返回到首页。</a>"
call sendinfo(tl,mes)
%>

<%end select
call down%>

⌨️ 快捷键说明

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