📄 edit.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 hell(str)
dim re
Set re=new RegExp
re.IgnoreCase=true
re.Global=True
str = replace(str, ">", ">")
str = replace(str, "<", "<")
set re=Nothing
hell=str
end function
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=kbbs(content(1))
elseif topictype=2 then
topic="回复帖子"
end if%>
<SCRIPT src="inc/ybbcode.js"></SCRIPT>
<SCRIPT>
function emoticon(theSmilie){
document.topic.content.value +=theSmilie + '';
document.topic.content.focus();
}
function presskey(eventobject)
{
if(event.ctrlKey && window.event.keyCode==13){this.document.topic.submit();}else{return false}
}
</SCRIPT>
<form name="topic" method="POST" action="edit.asp?action=edit&bd=<%=bbsbd%>&bbsid=<%=bbsid%>&totable=<%=totable%>&topictype=<%=topictype%>"><%=ttop%><table align="center" border="1" bordercolor=<%=c2%> cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="<%=tbw%>">
</table>
<div align="center">
<table border="1" bordercolor="<%=c1%>" bgcolor=#ffffff cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="<%=tbw%>">
<tr>
<td class=td1 width="95%" bgcolor="<%=c1%>" background="<%=tbg%>" height="28" colspan="2"> <img src="pic/gl.gif" border="0">
<font color="<%=c3%>">发表帖子</font></td>
<tr>
<td width="25%">
<p style="line-height: 150%; margin: 5"> <b>帖子主题:</b><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>
<td width="70%"> <input type=text name=topic size=80 maxlength=50 value="<%=topic%>"></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==<%=int(face1)%>){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></td>
<td>
<%set rs=conn.execute("select grade from [user] where userid="&lguserid&"")%>
<p style="margin: 5"><%if rs("grade")>=checknum(bbsinfo(22)) then%><%if checknum(application(prefix&"canupload"))=1 then%><IFRAME name=ad src="upload.asp" frameBorder=0 width="100%" scrolling=no height=25></IFRAME><%else%>论坛不支持上传文件。<%end if%><%else%>该项需要等级为 <b><%=kbbs(bbsinfo(22))%></b> 以上的用户才能使用。<%end if%></td>
</tr>
<tr>
<td>
<p style="margin: 5"> <b>帖子UBB标签:</b></td>
<td><p style="line-height: 150%; margin: 5">
<%call qian%></td>
</tr>
<tr>
<td valign="top">
<p style="line-height: 150%; margin: 5"> <b>帖子特殊内容:</b><%call tie%>
·特 殊 贴:<SELECT style="BACKGROUND-COLOR: #ffffff; font-family:宋体; font-size:9pt" onchange="if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;this.options[0].selected=true;}" name=sptie>
<option selected>无</option>
<option value="javascript:grade()">等级可见</option>
<option value="javascript:reply()">回复可见</option>
<option value="javascript:name()">指定读者</option>
<option value="javascript:smark()">积分可见</option>
<option value="javascript:showdate()">日期可见</option>
<option value="javascript:mustlogin()">登陆可见</option>
</SELECT>
<br><br>
</td>
<td valign="top"><p style="line-height: 150%; margin: 5">
字限:<INPUT disabled maxLength=5 name=total size=4 value=15000>
已写:<INPUT disabled maxLength=5 name=used size=4 value=0>
剩余:<INPUT disabled maxLength=5 name=remain size=4 value=15000>
<span style="cursor:hand" onclick="if(content.rows<60)content.rows=content.rows+5;" title=扩大编缉区>[+]</span>
<span style="cursor:hand" onclick="if(content.rows>5)content.rows=content.rows-5;" title=缩小编缉区>[-]</span>
<span style="cursor:hand" onclick="content.rows=10;" title=恢复编缉区>[=]</span><BR>
<SCRIPT language=javascript>
<!--
function gbcount(message,total,used,remain)
{
var max;
max = total.value;
if (message.value.length > max) {
message.value = message.value.substring(0,max);
used.value = max;
remain.value = 0;
alert("您输入的帖子内容已经超过系统允许的最多15000字!\n请删减部分帖子内容在发表!");
}
else {
used.value = message.value.length;
remain.value = max - used.value;
}
}
-->
</SCRIPT>
</p>
<p style="line-height: 150%; margin: 5">
<textarea rows="9" name="content" cols="85" style="font-family: 宋体; font-size: 9pt" onkeydown=presskey(); onkeyup=gbcount(this.form.content,this.form.total,this.form.used,this.form.remain);><%=hell(content(4))%></textarea>
</p><br></td>
</tr>
<p align="center">
</td>
</tr><tr>
<td height="50" align="center" colspan="2"> <input class=submit type=submit value=OK_!修改 name=B1> <input class=submit type=button value="预 览!" onclick=openwin()> <input class=submit type=reset value=NO_!重写 name=B2> [ 按
Ctrl+Enter 直接发送 ]</td></tr>
</table></div>
<%=tbottom%></p>
</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>
<div id='MaoDiv' style='position: absolute; width:570px; height:160px; display:none;'><iframe id='MView' name='MView' src='about:blank' frameborder='0' scrolling='no' valign='top' width='100%' height='100%'></iframe></div>
<%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="" 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=pic/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 and topictype=1 then
topicinfo=topicinfo&"<img src=pic/"&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&""
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&"")
content2=replace(lefttrue(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=1
mes="<b>你已经成功修改帖子,请选择你的要进行的操作。</b><br>·<a href=show.asp?bd="&bd&"&id="&id&"&totable="&totable&">回到我所编辑的帖子。</a><br>·<a href='list.asp?bd="&bd&"'>返回到"&bdinfo(0)&"。</a><br>·<a href='index.asp'>返回到首页。</a>"
call sendinfo(tl,mes)
%>
<%end select
call down%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -