<% dim announceid dim UserName,cname dim userPassword dim useremail dim Topic dim body dim dateTimeStr dim newUser dim UserID dim ip dim Expression dim boardID,rootid dim signflag dim mailflag dim char_changed dim boardtype if boardmaster or master then char_changed = "[align=right][color=#000066][此贴子已经被"&membername&"于"&Now()&"编辑过][/color][/align]" else char_changed = "[align=right][color=#000066][此贴子已经被作者于"&Now()&"编辑过][/color][/align]" end if cname = Request("username") UserName=trim(request("username")) UserPassWord=trim(request("passwd")) IP=Request.ServerVariables("REMOTE_ADDR") Expression=Request.Form("Expression")&".gif" BoardID=Request("boardID") AnnounceID=Cstr(Request("ID")) RootID=request("RootID") Topic=trim(request("subject")) Body=request("Content")+chr(13)+chr(10)+char_changed+chr(13) signflag=trim(request("signflag")) mailflag=trim(request("emailflag")) foundErr=false if membername="" then ErrMsg=ErrMsg+"
"+"
  • 您还没有登陆呀~" foundErr=True '判断假如修改者不是版主则判断其权限 elseif membername<>cname then if boardmaster=false and master=false then ErrMsg=ErrMsg+"
    "+"
  • 您没有权限编辑该贴子。" foundErr=True end if end if if signflag="yes" then signflag=1 else signflag=0 end if if mailflag="yes" then mailflag=1 else mailflag=0 end if if instr(Expression,"face")=0 then Randomize Do While Len(rndnum)<1 num1=CStr(Chr((57-48)*rnd+48)) rndnum=rndnum&num1 loop Expression="face" & rndnum & ".gif" end if if UserName="" or strLength(UserName)>20 then ErrMsg=ErrMsg+"
    "+"
  • 请输入姓名(长度不能大于20)" foundErr=True elseif Trim(UserPassWord)="" or strLength(UserPassWord)>10 then ErrMsg=ErrMsg+"
    "+"
  • 请输入密码(长度不能大于10)" foundErr=True end if if rootid=announceid then if Topic="" then foundErr=True if Len(ErrMsg)=0 then ErrMsg=ErrMsg+"
    "+"
  • 主题不应为空" else ErrMsg=ErrMsg+"
    "+"
  • 主题不应为空" end if elseif strLength(topic)>100 then foundErr=True if strLength(ErrMsg)=0 then ErrMsg=ErrMsg+"
    "+"
  • 主题长度不能超过100" else ErrMsg=ErrMsg+"
    "+"
  • 主题长度不能超过100" end if end if else topic="" end if if strLength(body)>AnnounceMaxBytes then ErrMsg=ErrMsg+"
    "+"
  • 发言内容不得大于" & CSTR(AnnounceMaxBytes) & "bytes" foundErr=true end if set rs=server.createobject("adodb.recordset") set rs=conn.execute("select boardtype,Tableback,Tabletitle,Tablebody,aTablebody,TableFont,TableContent,AlertFont,strAllowForumCode,strAllowHTML,strIMGInPosts,strIcons,strflash,Forumlogo,lockboard from board where boardid="&cstr(boardid)) if err then Errmsg=ErrMsg+"
    "+"
  • 数据库操作发生错误!" FoundErr=true else if not (rs.eof and rs.bof) then boardtype=rs("boardtype") Tablebackcolor=trim(rs("Tableback")) Tabletitlecolor=trim(rs("Tabletitle")) Tablebodycolor=trim(rs("Tablebody")) aTablebodycolor=trim(rs("aTablebody")) TableFontcolor=trim(rs("TableFont")) TableContentcolor=trim(rs("TableContent")) AlertFont=trim(rs("AlertFont")) strAllowForumCode=rs("strAllowForumCode") strAllowHTML=rs("strAllowHTML") strIMGInPosts=rs("strIMGInPosts") strIcons=rs("strIcons") strflash=rs("strflash") Forumlogo=rs("Forumlogo") lockboard=rs("lockboard") else if err.number<>0 then Errmsg=ErrMsg+"
    "+"
  • 数据库操作发生错误!" FoundErr=true err.clear else Errmsg=ErrMsg+"
    "+"
  • 不存在的版面!" FoundErr=true end if end if end if rs.close set rs=nothing if err.number<>0 then err.clear if foundErr=true then call nav() call headline(2) call Error() call endline() else rem 清除图片上传数的限制 response.cookies("aspsky")("upNum")=1 call nav() call headline(2) call saveedit() end if sub saveedit() DateTimeStr=CSTR(NOW()+TIMEADJUST/24) dim cmdTemp dim InsertCursor dim dataconn Set DataConn = Server.CreateObject("ADODB.Connection") dataconn.open connstr Set cmdTemp = Server.CreateObject("ADODB.Command") Set InsertCursor = Server.CreateObject("ADODB.Recordset") cmdTemp.CommandText="SELECT *, UserName FROM bbs1 where username='"&trim(cname)&"' and AnnounceID="&AnnounceID cmdTemp.CommandType = 1 Set cmdTemp.ActiveConnection = dataconn InsertCursor.Open cmdTemp, , 1, 3 if InsertCursor.eof then response.write"" set InsertCursor=nothing response.end() elseif InsertCursor("locktopic")=1 then Errmsg=ErrMsg+"
    "+"
  • 本主题已经锁定,不能编辑。" foundErr=true call error() else InsertCursor("Topic") =Topic InsertCursor("Body") =Body InsertCursor("DateAndTime") =DateTimeStr InsertCursor("length")=strlength(body) InsertCursor("ip")=ip InsertCursor("Expression")=Expression InsertCursor("signflag")=signflag InsertCursor("emailflag")=mailflag InsertCursor.Update session("subject")=topic if err.number<>0 then err.clear ErrMsg=ErrMsg+"
    "+"
  • 数据库操作失败,请以后再试"&err.Description call Error() else InsertCursor.close dataconn.close set dataconn=nothing call success() end if end if end sub sub success() response.write "" response.write "
    "&_ "
    "&_ ""&_ "
    状态:您发表帖子成功
    "&_ "本页面将在3秒后自动返回您所发表的帖子页面,您可以选择以下操作:
    " call endline() end sub %>