📄 editpost.asp
字号:
<!--#include file="../Conn.asp"-->
<!--#include file="Char.asp"-->
<!--#include file="../Board/Const.asp"-->
<!--#include file="BtBBS_Fun.asp"-->
<%
Dim FileName,Post,FileNl,aRS,I,j,K,sf,titlename,titlenamex,StarTime,EndTime,AccessNum,Login,UserName,BoardID,PostUser
StarTime = Timer():AccessNum=0
Login=Request.Cookies("Login")
Username=Request.Cookies("Username")
File=Request.QueryString("File")
File=replace(replace(replace(replace(File,"'","‘"),"<","<"),">",">")," "," ")
Post=Request.QueryString("Post")
IF IsNumeric(Post)=False THEN Response.Redirect "index.asp" END IF
BoardID=Request.QueryString("BoardID")
IF IsNumeric(BoardID)=False THEN Response.Redirect "index.asp" END IF
PostUser=Request.QueryString("PostUser")
PostUser=replace(replace(replace(replace(PostUser,"'","‘"),"<","<"),">",">")," "," ")
Titlename=Request.QueryString("titlename")
titlename=replace(replace(replace(replace(titlename,"'","‘"),"<","<"),">",">")," "," ")
Titlenamex=FtoJ(Request.Form("titlenamex"))
titlenamex=replace(replace(replace(replace(titlenamex,"'","‘"),"<","<"),">",">")," "," ")
FileName="../Board/bbs"+BoardID+"/"+File
BT_Board()
aRS=Application(BBSname&"BT_Board")
K=-1
If not (aRS(0,0)=-1 or VarType(aRS)=0) Then
For I=0 To UBound(aRS,2)
If Cint(BoardID)=aRS(0,I) then K=I End If
Next
End If
If Login="Y" and K>=0 Then '---------身份确认,如果sf=1,那么登陆者是版主或管理员,如果是0,则是其它用户
If (instr(1,aRS(7,K),Username)<>0 and Request.Cookies("bbsgl")="bbsadmin") or Request.Cookies("bbsgl")="admin" Then
sf=1
Else
sf=0
End If
Else '匿名用户
sf=0
End If
DIM myFile
Const ForReading = 1 Const Forwriting = 2
Const ForAppending = 8 myFile = Server.MapPath(FileName)
SET fileStreamObj = CreateObject("Scripting.FileSystemObject")
if not(fileStreamObj.FileExists(myFile)) then
FileName=""
else SET textStream = fileStreamObj.OpenTextFile(myFile,ForReading,False)
while not textStream.AtEndOfStream FileNl=FileNl+textStream.ReadLine()
wend textStream.Close()
end if
set fileStreamObj=nothing
Key="<a href=../EditPost.asp?BoardID="&BoardID&"&Post="&Post&"&File="&File&"&PostUser="&PostUser&""
If FileName<>"" and Post<>"" and Instr(1,FileNL,Key)>0 and (sf=1 or UserName=PostUser) then
BeginPost="<!--BeginNl"&Post&"-->"
EndPost="<!--EndNl"&Post&"-->"
i=Instr(1,Filenl,BeginPost)+Len(BeginPost)
j=Instr(1,Filenl,EndPost)
Left_NL=left(FileNL,i-1)
Right_NL=right(FileNl,Len(FileNL)-j)
Mid_NL=Mid(FileNl,i,Len(FileNl)-(i+Len(Right_NL)))
IF Request.Form("EditPost")="ЧΘ" then
UBB_MID_NL=FtoJ(Request.Form("nl"))
If Request.Form("UBBable")="yes" then
UBB_Mid_NL=UBBcode(UBB_MID_NL)
else
UBB_Mid_NL=HTMLEnHTML(UBB_MID_NL)
end if
'FileNL = replace(FileNl, Mid_NL, UBB_MID_NL)
FileNL=Left_NL+UBB_MID_NL+"<"+Right_NL
if post="0" then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="SELECT ID,BoardID,FileName,Subject,PostUser,PostNum,Hits,LastPostTime,LastPostUser,IsTop,IsBest,PollID FROM BT_Topic where FileName='"&File&"' "
rs.open sql,conn,1,3
if not(rs.BOF and rs.eof) then
titlename=rs("Subject")
rs("Subject")=titlenamex
rs.Update
end if
rs.Close
conn.close
set rs=nothing
set conn=nothing
Dim Reg
set reg=new regexp
reg.IgnoreCase=true
reg.Global=true
reg.Pattern="userwz=(.*)&dis=NO"
FileNL=Reg.Replace(FileNL,"userwz="&Titlenamex&"&dis=NO")
reg.Pattern="titlename=(.*?)>"
FileNL=Reg.Replace(FileNL,"titlename="&Titlenamex&">")
reg.Pattern="<!--Title1-->(.*)<!--Title2-->"
FileNL=Reg.Replace(FileNL,"<!--Title1-->"&Titlenamex&"<!--Title2-->")
reg.Pattern="<!--Title3-->(.*)<!--Title4-->"
if len(Titlenamex)>15 then Titlenamex=left(Titlenamex,12)+"..." end if
FileNL=Reg.Replace(FileNL,"<!--Title3-->"&Titlenamex&"<!--Title4-->")
reg.Pattern="value=Re:(.*?)>"
FileNL=Reg.Replace(FileNL,"value=Re:"&Titlenamex&">")
end if
SET fileStreamObj = CreateObject("Scripting.FileSystemObject")
SET textStream = fileStreamObj.OpenTextFile(myFile,ForWriting,False)
textStream.Write(FileNL) textStream.Close()
set fileStreamObj=nothing
if post="0" then
Application.Lock
Application(BBSname&boardname+"bs")=Application(BBSname&boardname+"bs")+1
Application.UnLock
end if
Response.Redirect "JtoF/JtoF.asp?BoardID="&BoardID&"&File="&File&""
else
%>
<%
Call JCC_Board_Top
Login_EN()%>
<center><table width=743><tr><td colspan=4><a href=index.asp><font class=NavColor>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -