gusucode.com > 仿MOP对开式论坛程序 1.0源码程序 > topic.asp

    <%@language="VBScript"%>
<!--#include file="title.asp"-->
<!--#include file="sub.asp"-->
<%
contents=contents &"<title>发表新帖子-"& caption &"</title>"&_
"</head>"&_
"<body>"&_
""&_
"<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"" class=""tdc"">"
if gbmaduser="" then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你还没登陆或者已经掉线。<br>请<a href=""login.asp"">登陆</a>,2秒后自动执行<Script Language=""JavaScript"">setTimeout(""location.href='login.asp'"",3000)</script>。<br><br></td></tr>"
else
if validate<>creatvalidate(gb+imprison,ip) then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>验证Cookies信息出错,请<a href=""login.asp"">重新登陆</a>。<br>引起该错误的原因可能是因为你手动修改了Cookies。<br><br></td></tr>"
else
if imprison="1" or imprison="4" or imprison="5" or imprison="7" then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你因为违反社区条例,被禁止发贴。具体可以查看<a href=""report.asp"">异动报告</a>。<br><br></td></tr>"
else
Dim ntsql,nfsql,color,types,forum,forumtype,tfselect,id,link,title,content,help,aboutlink,imglink,anonymity,htmlyes,unreply,face,remark,erryes,fso,savecookies,temptopic
color=Request.QueryString("color")
types=Request.QueryString("types")
forum=Request.QueryString("forum")
if IsNumeric(types) then
types=Clng(types)
else
types=""
end if
if forum="" then forum=Request.Form("forum")
if IsNumeric(forum) then
forum=Clng(forum)
else
forum="0"
end if
htmlyes=Request.Form("htmlyes")
title=Trim(titlecode(Request.Form("title")))
if gb>99 and htmlyes="yes" then
content=Trim(contentcode(Request.Form("content"),1))
else
content=Trim(contentcode(Request.Form("content"),0))
end if
if color="" then color=Request.Form("color")
help=Request.Form("help")
aboutlink=Trim(Replace(Replace(Request.Form("aboutlink"),"http://http://","http://"),"http://..",".."))
imglink=Trim(Replace(Replace(Request.Form("imglink"),"http://http://","http://"),"http://..",".."))
unreply=Request.Form("unreply")
anonymity=Request.Form("anonymity")
face=Request.Form("face1") & Request.Form("face2")
savecookies=Request.Cookies(bbssn)("savecookies")
temptopic=Request.Cookies("temp")("topic")
if color="yes" then
if imprison="2" or imprison="4" or imprison="6" or imprison="7" then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你因为违反社区条例,被禁止使用道具。具体可以查看<a href=""report.asp"">异动报告</a>。<br><br></td></tr>"
else
rs.Open "Select userpwd From gbmaduser Where gbmaduser='"& gbmaduser &"'",conn,1,1
if Not rs.Eof then
if rs("userpwd")<>userpwd then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>密码验证错误,请<a href=""login.asp"">重新登陆</a>。<br>引起该错误的原因可能是因为你手动修改了Cookies。<br><br></td></tr>"
erryes="yes"
end if
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>不存在的用户,请<a href=""login.asp"">重新登陆</a>。<br>引起该错误的原因可能是因为你手动修改了Cookies。<br><br></td></tr>"
erryes="yes"
end if
rs.Close
if erryes<>"yes" then
rs.Open "tools Where gbmaduser='"& gbmaduser &"' and toolname='暗夜极光'",conn,1,3
if Not rs.Eof then
if rs("amount")=1 then
rs.Delete
else
rs("amount")=rs("amount")-1
rs.Update
end if
color="succeed"
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你没有暗夜极光,请到<a href=""market.asp"">道具市场</a>购买。<br><br></td></tr>"
end if
rs.Close
end if
end if
end if
if title<>"" and content<>"" then
if IsNull(bbsadmin) or bbsadmin="" then
ntsql=" and typeshow=1"
nfsql=" and forumshow=1"
end if
if title & Left(content,20)=temptopic then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你的帖子已经提交了,请刷新<a href=""forum.asp?forum="& forum &""" target="""& bbssn &"left"">帖子列表</a>。<br>引起该错误的原因可能是因为你重复提交该帖子。<br>如果刷新帖子列表后依旧不能看到你发表的帖子请<a href=""reporting.asp"">联系管理员报告错误</a>。<br><br></td></tr>"
erryes="yes"
end if
if erryes<>"yes" then
rs.Open "forum Where id="& forum & nfsql,conn,1,1
if rs.Eof then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>该版面不存在或者是隐藏的。<br><a href=""JavaScript:history.back();"">返回刚才的页面重新选择版面</a>。<br>如果依旧出错,请<a href=""reporting.asp"">联系管理员报告错误</a>。<br><br></td></tr>"
erryes="yes"
else
forumtype=rs("forumtype")
end if
rs.Close
end if
if erryes<>"yes" then
rs.Open "forumtype Where id="& forumtype & ntsql,conn,1,1
if rs.Eof then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>该版面不属于任何的分类或者分类是隐藏的。<br>请重新选择版面,如果依旧出错,请<a href=""reporting.asp"">联系管理员报告错误</a>。<br><br></td></tr>"
erryes="yes"
end if
rs.Close
end if
if face>0 and face<100 then remark="<br><img src=""../../face/"& face &".gif"" border=""0"">"
if color<>"" then
title="<font color="""& color &""">"& title &"</font>"
color="succeed"
end if
if Left(aboutlink,7)<>"http://" then aboutlink=Replace("http://"& aboutlink,"http://..","..")
if Left(imglink,7)<>"http://" then imglink=Replace("http://"& imglink,"http://..","..")
if erryes<>"yes" then
rs.Open "Select userpwd,topicpiece,gb From gbmaduser Where gbmaduser='"& gbmaduser &"'",conn,1,3
if Not rs.Eof then
if rs("userpwd")=userpwd then
rs("topicpiece")=rs("topicpiece")+1
if anonymity="yes" then rs("gb")=rs("gb")-anonymitygb
rs.Update
gb=rs("gb")
if savecookies="yes" then Response.Cookies(bbssn).expires=Date()+365
Response.Cookies(bbssn)("gb")=gb
Response.Cookies(bbssn)("validate")=creatvalidate(gb+imprison,ip)
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>密码验证错误,请<a href=""login.asp"">重新登陆</a>。<br>引起该错误的原因可能是因为你手动修改了Cookies。<br><br></td></tr>"
erryes="yes"
end if
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>不存在的用户,请<a href=""login.asp"">重新登陆</a>。<br>引起该错误的原因可能是因为你手动修改了Cookies。<br><br></td></tr>"
erryes="yes"
end if
rs.Close
end if
if erryes<>"yes" then
if anonymity<>"yes" then
rs.Open "remark Where gbmaduser='"& gbmaduser &"'",conn,1,3
if Not rs.Eof then
remark=remark & rs("content")
if rs("amount")=1 then
rs.Delete
else
rs("amount")=rs("amount")-1
rs.Update
end if
end if 
rs.Close
end if
rs.Open "topic Where id=0",conn,1,3
rs.AddNew
rs("title")=title
rs("content")=content
rs("remark")=remark
if anonymity="yes" then rs("anonymity")=anonymitycode(ip)
if unreply="yes" then rs("unreply")=1
if help="yes" then rs("topictype")=0
rs("gbmaduser")=gbmaduser
if bbsadmin>0 then rs("admincolor")=bbsadmin
rs("posttime")=Now()
rs("lastupdate")=Now()
rs("click")=0
rs("reply")=0
rs("forumid")=forum
if aboutlink<>"http://" then rs("aboutlink")=aboutlink
if imglink<>"http://" then rs("imglink")=imglink
rs.Update
id=rs("id")
Set fso=CreateObject("Scripting.FileSystemObject")
if Not fso.FolderExists(Server.Mappath("topic/"& Year(rs("posttime")) & Month(rs("posttime")))) then fso.CreateFolder(Server.Mappath("topic/"& Year(rs("posttime")) & Month(rs("posttime"))))
Set fso=Nothing
link=Year(rs("posttime")) & Month(rs("posttime")) &"/"& Year(rs("posttime")) & Month(rs("posttime")) & Day(rs("posttime")) & Hour(rs("posttime")) & Minute(rs("posttime")) & Second(rs("posttime")) & id &".htm"
rs.Close
rs.Open "Select link From topic Where id="& id,conn,1,3
rs("link")=link
rs.Update
rs.Close
Response.Cookies("temp")("topic")=title & Left(content,20)
call creattopic(id)
call connclose
Response.Redirect "topic/"& link
end if
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">发布新帖子</td></tr>"&_
"<tr class=""tds""><td>"&_
"<script language=""JavaScript"">"&_
"function validinput()"&_
"{"&_
"if (document.topic.forum.value.length==0){"&_
"alert(""请选择你要发的帖子对应具体的版面名称,请不要选择分类。"");"&_
"document.topic.forum.focus();"&_
"return false;"&_
"}"&_
"if (document.topic.title.value.length==0){"&_
"alert(""请填写好帖子标题。"");"&_
"document.topic.title.focus();"&_
"return false;"&_
"}"&_
"if (document.topic.content.value.length==0){"&_
"alert(""请填写好帖子内容。"");"&_
"document.topic.content.focus();"&_
"return false;"&_
"}"&_
"document.topic.button.disabled=""true"";"&_
"return true;"&_
"}"&_
"function showimg()"&_
"{"&_
"face_1=document.topic.face1.value;"&_
"face_2=document.topic.face2.value;"&_
"face=""face/""+face_1+face_2+"".gif"";"&_
"show_file='<img src='+face+'>';"&_
"document.all.show.innerHTML=show_file;"&_
"}"&_
"</script>"&_
"<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"">"&_
"<form name=""topic"" onsubmit=""return validinput();"" method=""post"" action=""topic.asp"">"&_
"<tr><td width=""64"">注意事项:</td><td>原创须文明,转贴标出处。</td></tr>"&_
"<tr><td>帖子版面:</td><td><select name=""forum"" size=""1"">"
%>
<!--#include file="sforum.asp"-->
<%
contents=contents &"</select></td></tr>"&_
"<tr><td>帖子标题:</td><td><input name=""title"" type=""text"" maxlength=""255"" size=""40"" class=""iptwin""></td></tr>"
if color="" then
contents=contents &"<tr><td> </td><td>使用 [<a href=""javascript:if(confirm('如果你已经在撰写贴子了,点确定前先将内容复制,因为已编写的内容将丢失,\n而且你的 暗夜极光 将减少一个,即使不发帖子,确认继续?'))location='topic.asp?"& Request.QueryString &"&color=yes'"">暗夜极光</a>] 发一个有颜色标题的帖子.<br><font title=""选择上之后该帖子将被移入求助帖""><input name=""help"" type=""checkbox"" value=""yes"">求助帖</font>&nbsp;&nbsp;<a href=ubb.htm onClick=""return showb(this.href);"">超级转帖工具</a>"&_
" &nbsp;<span style=""cursor:hand"" onclick=""if(content.rows<100)content.rows=content.rows+2;"" title=扩大编缉区>[+]</span> <span style=""cursor:hand"" onclick=""if(content.rows>15)content.rows=content.rows-2;"" title=缩小编缉区>[-]</span> <span style=""cursor:hand"" onclick=""content.rows=15;"" title=恢复编缉区>[=]</span>"&_
"</td></tr>"
elseif color="succeed" then
contents=contents &"<tr><td>标题颜色:</td><td><select name=""color"" size=""1"">"&_
"<option style=""color:#0000FF;background-color:#0000FF"" value=""#0000FF"">#0000FF</option>"&_
"<option style=""color:#FF0000;background-color:#FF0000"" value=""#FF0000"">#FF0000</option>"&_
"</select> </td></tr>"
end if
contents=contents &"<tr><td valign=""top"">帖子内容:</td><td><textarea name=""content"" rows=""15"" cols=""50""></textarea><a id=""show""></a></td></tr>"&_
"<tr><td>相关链接:</td><td><input name=""aboutlink"" type=""text"" maxlength=""255"" size=""40"" class=""iptwin"" value=""http://""></td></tr>"&_
"<tr><td>相关图片:</td><td><input name=""imglink"" type=""text"" maxlength=""255"" size=""40"" class=""iptwin"" value=""http://""></td></tr>"&_
"<tr><td>  表情:</td><td><select name=""face1"" size=""1"" onchange=""showimg()""><option value=""0"">0</option><option value=""1"">1</option></select><select name=""face2"" size=""1"" onchange=""showimg()""><option value=""0"">0</option><option value=""1"">1</option><option value=""2"">2</option><option value=""3"">3</option><option value=""4"">4</option><option value=""5"">5</option><option value=""6"">6</option><option value=""7"">7</option><option value=""8"">8</option><option value=""9"">9</option></select>"&_
" <font title=""选择上之后该帖子将不能被回复""><input name=""unreply"" type=""checkbox"" value=""yes"">不接受回复</font>"
if gb>99 then contents=contents &" <font title=""选择上之后你发表的信息里就可以使用html语法了""><input name=""htmlyes"" type=""checkbox"" value=""yes"" checked>HTML</font>"
if gb>149 then contents=contents &" <font title=""选择上之后你的ID将显示为 神秘人物??????,但是会扣除"& anonymitygb & gbname &"""><input name=""anonymity"" type=""checkbox"" value=""yes"">隐身发贴</font>"
contents=contents &" <input name=""button"" type=""submit"" value=""提交"" onmouseover=""this.className='over';"" onmouseout=""this.className='out';"" class=""out""></td></tr>"&_
"</form>"&_
"</table>"&_
"</td></tr>"
end if
end if
end if
end if
contents=contents &"</table>"&_
""
%>
<!--#include file="bottom.asp"-->