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

📄 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 hell(str)
dim re
Set re=new RegExp
re.IgnoreCase=true
re.Global=True
str = replace(str, ">", "&gt;")
str = replace(str, "<", "&lt;")
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&"")
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%>">
  <tr>
    <td class=td1 width="100%" bgcolor="<%=c1%>" background="<%=tbg%>" height="28"> &nbsp;<img src="pic/gl.gif" border="0"> 
    发表帖子</td>
  </tr>
  <tr>
    <td width="100%">
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
      <tr>
        <td width="25%" bgcolor="<%=c2%>">
        <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="75%">&nbsp;<input type=text name=topic size=80 maxlength=50 value="<%=topic%>"></td>
      </tr>
      <tr>
        <td bgcolor="<%=c2%>">
        <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=face/face"+i+".gif>")}
else {document.write("<input type=radio value=face"+i+" name=face><img border=0 src=face/face"+i+".gif>")}
}
        </script> </td>
      </tr>
            <tr>
        <td bgcolor="<%=c2%>">
        <p style="margin: 5"> <b>文件上传:</b></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=25></IFRAME><%else%>论坛不支持上传文件。<%end if%></td>
      </tr>
      <tr>
        <td bgcolor="<%=c2%>">
        <p style="margin: 5"> <b>帖子UBB标签:</b></td>
<td><p style="line-height: 150%; margin: 5">
<img onclick=fly() alt=飞行字 src="pic/fly.gif" border=0> 
<img onclick=move() alt=移动字 src="pic/move.gif" border=0> 
<img onclick=light() alt=发光字 src="pic/glow.gif" border=0> 
<img onclick=ying() alt=阴影字  src="pic/shadow.gif" border=0>
<img onclick=Cbold() alt=粗体字 src="pic/bold.gif" border=0> 
<img onclick=Citalic() alt=斜体字 src="pic/italicize.gif" border=0> 
<img onclick=Cunder() alt=下划线 src="pic/underline.gif" border=0> 
<img onclick=center() alt="居中" border="0" src="pic/center.gif">
<img onclick=image() alt=图片 src="pic/image.gif" border=0> 
<img onclick=Cdir() alt=Shockwave文件 src="pic/Shockwave.gif" border=0> 
<img onclick=Crm() alt=realplay视频文件 src="pic/rm.gif" border=0> 
<img onclick=Cwmv() alt="Media Player视频文件" src="pic/mp.gif" border=0>
<img onclick=Curl() alt="超连接" border="0" src="pic/url1.gif">
<img onclick=Cemail() alt="Email连接" border="0" src="pic/ubb_email.gif">
<img onclick=Csound() alt="插入背景音乐" border="0" src="pic/csound.gif">
<img onclick=Cra() alt="real音频文件" border="0" src="pic/ra.gif"></p>
</td>
      </tr>
      <tr>
        <td bgcolor="<%=c2%>" valign="top">
        <p style="line-height: 150%; margin: 5"> <b>帖子特殊内容:</b><br>
·<a href=javascript:emoticon('[sup]内容[/sup]')>上标</a>
·<a href=javascript:emoticon('[sub]内容[/sub]')>下标</a><br>
·<a href=javascript:emoticon('[code]内容[/code]')>插入代码</a><br>
·文字大小:<select onchange=ybbsize(this.options[this.selectedIndex].value) name=a style="font-size: 9pt"><OPTION value=1>1</OPTION><OPTION value=2>2</OPTION><OPTION value=3>3</OPTION><OPTION value=4>4</OPTION></SELECT><br>
·文字颜色:<select onchange=COLOR(this.options[this.selectedIndex].value) name="111" style="font-size: 9pt"><option style='COLOR:000000;BACKGROUND-COLOR:000000' value=000000>黑色</option><option style='COLOR:FFFFFF;BACKGROUND-COLOR:FFFFFF' value=FFFFFF>白色</option><option style='COLOR:008000;BACKGROUND-COLOR:008000' value=008000>绿色</option><option style='COLOR:800000;BACKGROUND-COLOR:800000' value=800000>褐色</option><option style='COLOR:808000;BACKGROUND-COLOR:808000' value=808000>橄榄色</option><option style='COLOR:000080;BACKGROUND-COLOR:000080' value=000080>深蓝色</option><option style='COLOR:800080;BACKGROUND-COLOR:800080' value=800080>紫色</option><option style='COLOR:808080;BACKGROUND-COLOR:808080' value=808080>灰色</option><option style='COLOR:FFFF00;BACKGROUND-COLOR:FFFF00' value=FFFF00>黄色</option><option style='COLOR:00FF00;BACKGROUND-COLOR:00FF00' value=00FF00>浅绿色</option><option style='COLOR:00FFFF;BACKGROUND-COLOR:00FFFF' value=00FFFF>浅蓝色</option><option style='COLOR:FF00FF;BACKGROUND-COLOR:FF00FF' value=FF00FF>粉红色</option><option style='COLOR:C0C0C0;BACKGROUND-COLOR:C0C0C0' value=C0C0C0>银白色</option><option style='COLOR:FF0000;BACKGROUND-COLOR:FF0000' value=FF0000>红色</option><option style='COLOR:0000FF;BACKGROUND-COLOR:0000FF' value=0000FF>蓝色</option><option style='COLOR:008080;BACKGROUND-COLOR:008080' value=008080>蓝绿色</option></select><br>
·特 殊 贴:<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><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><p style="line-height: 150%; margin: 5">
<script>for(i=1;i<=15;i=i+1) {document.write("<A href=javascript:emoticon('[em"+i+"]')><img border=0 src=images/emote/em"+i+".gif>&nbsp;")}</script>
</p><br></td>
      </tr>
      </table>
    </td>
  </tr><tr>
    <td height="50" bgcolor="<%=c2%>" align="center"> <input class=submit type=submit value=OK_!修改 name=B1>&nbsp;&nbsp;&nbsp; <input class=submit type=button value="预  览!" onclick=openwin()>&nbsp;&nbsp;&nbsp; <input class=submit type=reset value=NO_!重写 name=B2>&nbsp; [ 按 Alt+Enter 直接发送 ]</td></tr>
</table><%=tbottom%></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="" 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," ","")
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=" 编 辑 成 功"
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='index.asp'>返回到首页。</a>"
call sendinfo(tl,mes)

%>

<%end select
call down%>

⌨️ 快捷键说明

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