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

📄 newtopic.asp

📁 教师评估系统
💻 ASP
字号:
<!-- #include file="Cls.asp" -->
<%
top "发表帖子",true
ChkUser
mingold=20
maxgold=5000
ForumID=ChkNumeric(Request.QueryString("Fid"))
if Conn.Execute("select UserStatus from [WxUsers] where UserName='"&CookieUserName&"'" )(0)=0 Then Error 6,"<li>您的帐户未被激活</li>"
VoteExpiry=int(Request.Form("VoteExpiry"))

ForumData=GetForumData(ForumID)
Moderated=ForumData(3)
if ForumData(0)=0 Then Error 6,"<li>类别无法发表帖子</li>"
%>
<!-- #include file="inc/ForumPermissions.asp" -->
<%if PermissionsPost=0 then Error 0,""

if Request.ServerVariables("Request_method") = "POST" then
if Request.Form=Application("LastPost") then Error 6,"<li>请不要提交重复数据</li>"
if Cache("PostVerifyCode") then
if ChkNumeric(Request.Form("VerifyCode"))<>Int(Session("VerifyCode")) then Message=Message&"<li>验证码错误</li>"
end if

if Request("PayTopicMoney")<>empty then
if IsNumeric(""&Request("PayTopicMoney")&"") then
 PayTopicMoney=int(Request("PayTopicMoney"))
if PayTopicMoney>0 then
if PayTopicMoney > Conn.Execute("select UserMoney from [WxUsers] where UserName='"&CookieUserName&"'")(0) then ErrMsg="<li>抱歉,您的金币不足支付悬赏</li>"
if PayTopicMoney < mingold then ErrMsg=ErrMsg&"<li>悬赏帖至少提供 "&mingold&" 金币</li>"
if PayTopicMoney > maxgold then ErrMsg=ErrMsg&"<li>悬赏帖至多提供 "&maxgold&" 金币</li>"
if ErrMsg<>"" Then Error 3,ErrMsg
end if
else
PayTopicMoney=0
end if
else
PayTopicMoney=0
end if

color=HTMLEncode(Request.Form("color"))
myface=Request.Form("myface")
Subject=HTMLEncode(Request.Form("Subject"))
Category=HTMLEncode(Request.Form("Category"))
Content=ContentEncode(Request.Form("Content"))
Tags=ReplaceText(Request.Form("Tags"),"<[^>]*>|\'|\&|\?|\/|\\","")
Tags=ReplaceText(Tags," |  "," ")
if Request.Form("DisableYBBCode")<>1 then Content=YbbEncode(Content)

if Len(Subject)<2 then Message=Message&"<li>文章主题不能小于 2 字符</li>"
if Len(content)<2 then Message=Message&"<li>文章内容不能小于 2 字符</li>"

if Cache("NotSamePost") then
L=Len(Content)
if L>30 then
	m=int(L/5)
	n=m*3
	On Error Resume Next
	PostsTableName=Conn.Execute("select top 1 PostsTableName from [WxThreads] Order by ID Desc")(0)
	Rs.Open "select Content from [WxPosts"&PostsTableName&"] where PostTime>"&SqlNowString&"-1",Conn,1
	Do While Not Rs.Eof
	tmp=Rs("Content")
	LL=L-Len(tmp)
	if abs(LL)<30 then
		if LL<0 then
			s1=Content
			s2=mid(tmp,m,n)
		else
			s1=tmp
			s2=mid(Content,m,n)
		end if
		if Instr(s1,s2)>0 then Error 6,"<li>内容可能有广告,请修改</li>"
	end if
	Rs.MoveNext
	Loop
	Rs.Close
	Err.Clear
end if
end if


if Cache("BannedText")<>empty then
filtrate=split(Cache("BannedText"),"|")
for i = 0 to UBound(filtrate)
Subject=ReplaceText(Subject,""&filtrate(i)&"",string(len(filtrate(i)),"*"))
next
end if

if Request.Form("Vote")<>"" then
Vote=Request("Vote")
if instr(Vote,"|") > 0 then Error 3,"<li>投票选项中不能含有“|”字符</li>"
pollTopic=split(Vote,chr(13)&chr(10))
j=0
for i = 0 to UBound(pollTopic)
if Not (pollTopic(i)="" or pollTopic(i)=" ") then
allpollTopic=""&allpollTopic&""&pollTopic(i)&"|"
j=j+1
end if
next

if j<int(Cache("MinVoteItem")) or j>int(Cache("MaxVoteItem")) then Error 3,"<li>投票选项不能少于 "&Cache("MinVoteItem")&" 个</li><li>投票选项超过 "&Cache("MaxVoteItem")&" 个</li>"

for y = 1 to j
Votenum=""&Votenum&"0|"
next

end if

if Message<>"" then Error 3,""&Message&""

sql="select * from [WxUsers] where Username='"&CookieUserName&"'"
Rs.Open sql,Conn,1,3

if Cache("DuplicatePostIntervalInMinutes") then
StopPostTime=int(DateDiff("s",Rs("UserLandTime"),Now()))
if StopPostTime < int(Cache("DuplicatePostIntervalInMinutes")) then Message=Message&"<li>论坛限制一个人两次发帖间隔必须大于 "&Cache("DuplicatePostIntervalInMinutes")&" 秒!<li>您必须再等待 "&Cache("DuplicatePostIntervalInMinutes")-StopPostTime&" 秒!"
end if

if Cache("RegUserTimePost") > 0 then
StopPostTime=int(DateDiff("s",Rs("UserRegTime"),Now()))
if StopPostTime < int(Cache("RegUserTimePost")) then Message=Message&"<li>新注册用户必须等待 "&Cache("RegUserTimePost")&" 秒后才能发帖!<li>您必须再等待 "&Cache("RegUserTimePost")-StopPostTime&" 秒!"
end if

if BestRole=1 and color<>"" then Subject="<font color="&color&">"&Subject&"</font>"

'p02
if Request("PayTopicMoney")<>"" then
if Request("PayTopicMoney")>0 then
if rs("UserMoney")<int(Request("PayTopicMoney"))then
if rs("UserMoney")+rs("savemoney")<int(Request("PayTopicMoney"))then
message=message&"<li>您想发表的悬赏帖需要 "&Request("PayTopicMoney")&"元 ,您的钱不够哟"
else
if rs("savemoney")<int(Request("PayTopicMoney")) then
rs("UserMoney")=rs("UserMoney")-(int(Request("PayTopicMoney"))-rs("savemoney"))
rs("savemoney")=0
rs.update
else
rs("savemoney")=rs("savemoney")-(int(Request("PayTopicMoney"))-rs("UserMoney"))
rs("UserMoney")=0
rs.update
end if
end if
else
rs("UserMoney")=rs("UserMoney")-int(Request("PayTopicMoney"))
rs.update
end if
end if
end if

if Message<>"" then Error 3,"<li>"&Message&"</li>"

Rs("PostTopic")=Rs("PostTopic")+1
Rs("UserMoney")=Rs("UserMoney")+Cache("IntegralAddThread")
Rs("Experience")=Rs("Experience")+Cache("IntegralAddThread")
Rs("UserLandTime")=now()
Rs("UserLastIP")=Request.ServerVariables("REMOTE_ADDR")
Rs.update
Rs.close

Rs.Open "select * from [WxThreads]",Conn,1,3
Rs.addNew
Rs("UserName")=CookieUserName
Rs("PostTime")=now()
Rs("lastname")=CookieUserName
Rs("lasttime")=now()
Rs("Topic")=Subject
Rs("ForumID")=ForumID
Rs("Category")=Category
Rs("Tags")=Tags
if Request.Form("myface")<>"" then Rs("icon")=myface
if Request("Vote")<>"" then Rs("isVote")=1
if Request("IsLocked")=1 then Rs("IsLocked")=1
if ForumData(13)=1 then Rs("IsDel")=1

'p03
if Request("PayTopicMoney")<>"" then
if PayTopicMoney>0 then
rs("icon")="11"
rs("PayTopicMoney")=PayTopicMoney
end if
end if
'p03

Rs.update
ID=Rs("ID")
PostsTableName=Rs("PostsTableName")
Rs.close

if Request.Form("Vote")<>"" then
Conn.Execute("insert into [WxVote] (ThreadID,Type,Items,Result,Expiry) values ('"&ID&"','"&int(Request.Form("multiplicity"))&"','"&HTMLEncode(allpollTopic)&"','"&Votenum&"','"&now()+VoteExpiry&"')")
end if

if Request.Form("UpFileID")<>"" then
UpFileID=split(Request.Form("UpFileID"),",")
for i = 0 to UBound(UpFileID)-1
Conn.Execute("update [WxUpFiles] set Category='"&Category&"',Description='"&Subject&"' where id="&int(UpFileID(i))&" and UserName='"&CookieUserName&"'")
next
end if

Conn.Execute("insert into [WxPosts"&PostsTableName&"] (ThreadID,IsTopic,UserName,Subject,content,Postip) values ('"&ID&"','1','"&CookieUserName&"','"&Subject&"','"&content&"','"&Request.ServerVariables("REMOTE_ADDR")&"')")
Conn.Execute("update [WxForums] set lastTopic='<a href=Threads.asp?Tid="&id&">"&Left(HTMLEncode(Request.Form("Subject")),11)&"</a>',lastname='"&CookieUserName&"',lasttime="&SqlNowString&",ForumToday=ForumToday+1,ForumThreads=ForumThreads+1,ForumPosts=ForumPosts+1 where id="&ForumID&" or id="&ForumData(0)&"")
UpStat 1,1,0
ForumCache(ForumID)
Session("VerifyCode")=""
Application("LastPost")=Request.Form

if ForumData(13)=1 then
EnableCensorship="<li>由于论坛设有审查制度,您发表的帖子需要审核才能显示</li>"
else
EnableCensorship="<li><a href=Threads.asp?Tid="&id&">返回主题</a></li>"
end if
ForumCache(forumid)
CacheAdd "User_"&CookieUserName,""
Succ "发表主题",EnableCensorship&"<li><a href=Forums.asp?Fid="&ForumID&">返回版块</a></li>","Forums.asp?Fid="&ForumID
end if
%>
<div class="nav dt"><img alt='' src="Images/Forum_nav.gif" />&nbsp; <%=ClubTree%> → <%ForumTree(ForumData(0))%><%=ForumTreeList%> <a href="Forums.asp?Fid=<%=ForumID%>"><%=ForumData(2)%></a> → 发表帖子</div>
<script src="Inc/UBBPost.js" type="text/javascript"></script>
<form method="post" name="form" onsubmit="return CheckForm(this);">
<input type="hidden" name="content" />
<input type="hidden" name="UpFileID" />
<input type="hidden" name="ForumID" value="<%=ForumID%>" />
<div class="tb cb dt">
<script type="text/javascript" src="Inc/Category.js"></script>
<div id="tt">发表主题</div>
<%if Cache("PostVerifyCode") then%>
<div class="tc b cb">
<div class="fl r si w2">验证码</div>
<div class="fl si"><%=WriteVerifyCode%></div>
</div>
<%end if%>
<div class="tc b cb">
<div class="fl r si w2">文章标题 (<a onclick="ChangeCategory('#');return false;" href="#">添加类别</a>)</div>
<div class="fl si"><select name="Category" size="1"><option value="" selected="selected">类别</option>
<%
if ForumData(4)<>empty then
filtrate=split(ForumData(4),"|")
for i = 0 to UBound(filtrate)
Response.write "<option value='"&filtrate(i)&"'>["&filtrate(i)&"]</option>"
next
end if
%>
</select>
<input maxlength="30" size="60" name="Subject" />
<%if BestRole=1 or instr("|"&ForumData(3)&"|","|"&CookieUserName) Then%>
<select name="color">
<option value="">颜色</option>
<option style="color:#FF0000" value="FF0000">大红</option>
<option style="color:#EE00EE" value="EE00EE">粉红</option>
<option style="color:#CC00FF" value="CC00FF">紫红</option>
<option style="color:#FF7700" value="FF7700">橙红</option>
<option style="color:#DDBB00" value="EEBB00">金黄</option>
<option style="color:#BB8800" value="BB8800">咖啡</option>
<option style="color:#00AA00" value="00AA00">深绿</option>
<option style="color:#00AAEE" value="00AAEE">天蓝</option>
<option style="color:#7700FF" value="8800FF">紫蓝</option>
<option style="color:#888888" value="888888">灰色</option>
</select>
<%end if%></div>
</div>
<div class="tc b cb">
<div class="fl r i w2">标签<br />多个标签请用空格分隔</div>
<div class="fl i"><input maxlength="200" size="60" name="Tags" /></div>
</div>
<div class="tc b cb">
<div class="fl r si w2">心情</div>
<div class="fl si"><script type="text/javascript">for(i=1;i<=8;i++) {document.write("<input type=radio value="+i+" name=myface><img src=Images/brow/"+i+".gif> ")}</script></div>
</div>
<%if PermissionsCreatePoll=1 and ChkNumeric(Request.QueryString("Poll"))=1 then%>
<div class="tc b cb">
<div class="fl r t w2">投票项目<br />每行写一个投票项目<br />
<input type="radio" checked="checked" value="0" name="multiplicity" id="multiplicity" /><label for="multiplicity">单选投票</label> <input type="radio" value="1" name="multiplicity" id="multiplicity_1" /><label for="multiplicity_1">多选投票</label><br />
过期时间 <select name="VoteExpiry" size="1">
<option value="1">一天后</option>
<option value="2">两天后</option>
<option value="3">三天后</option>
<option value="7">一星期后</option>
<option value="14">两星期后</option>
<option value="30" selected="selected">一个月后</option>
<option value="60">两个月后</option>
<option value="90">三个月后</option>
<option value="180">六个月后</option>
</select></div>
<div class="fl t"><textarea name="Vote" rows="1" cols="1"></textarea></div>
</div>
<%end if%>
<div class="tc b cb">
<div class="fl r w2 c">内容<br />
<input id="LockMyPost" name="IsLocked" type="checkbox" value="1" /><label for="LockMyPost"> 
主题锁定,不允许回复</label><br />
<input id="DisableYBBCode" name="DisableYBBCode" type="checkbox" value="1" /><label for="DisableYBBCode"> 
禁用YBB代码</label><br />
<div>
<fieldset class="p3 lh w8">
<legend>特殊帖</legend>
<a onclick="postjb()" title="使用语法:[postjb=可浏览该部分内容需要最低金钱数]内容[/postjb]">金钱帖</a> 
<a onclick="postjy()" title="使用语法:[postjy=可浏览该部分内容需要最低经验值]内容[/postjy]">经验帖</a> 
<a onclick="postwz()" title="使用语法:[postwz=可浏览该部分内容需要最低文章数]内容[/postwz]">文章帖</a><br />
<a onclick="postmoney()" title="使用语法:[postmoney=可浏览该部分内容需要付的金币数]内容[/postmoney]">出售帖</a> 
<a onclick="retopic()" title="使用语法:[retopic]该部分内容回复后可见[/retopic]">回复帖</a> 
<a onclick="postdj()" title="使用语法:[postdj=该部分内容用户点击连接后可见]内容[/postdj]">点击帖</a>
</fieldset>
</div>
<div>
<fieldset class="p3 lh w8">
<legend>悬赏设置</legend>
悬赏 <input name="PayTopicMoney" maxlength="5" size="5" /> 个金币<br />结帖时可按成员不同的贡<br />献给予不同的报酬。悬赏<br />金不得少于 <%=mingold%> 金币且<br />您已缴纳的酬金不再退还
</fieldset>
</div>
</div>
<div class="fl c"><%WxEditor"full","content","550px","200px"%></div>
</div>
<%if Cache("UploadObj")<>empty and PermissionsAttachment=1 then
if Cache("MaxUp2") then
MaxUp2=Conn.Execute("select MaxUp2 from [WxRoles] where id="&Conn.Execute("select UserRoleID from [WxUsers] where Username='"&CookieUserName&"'")(0)&"")(0)
else
MaxUp2=int(Cache("MaxFileSize"))
end if
%>
<div class="tc b cb" id="UpFiles" style="display:none;">
<div class="fl r i w2">已上传附件</div>
<div class="fl i"><span id="UpFile"></span></div>
</div>
<div class="tc b cb">
<div class="fl r i w2">增加附件(限制:<%=CheckSize(int(Maxup2))%>)<br />支持类型:<%=Cache("UploadExt")%></div>
<div class="fl i"><%
MinUpPermission=Cache("MinUpPermission")
PostCount=Conn.Execute("select Count(ID) from [WxPosts"&PostsTableName&"] Where UserName='"&CookieUserName&"' and PostTime>"&SqlNowString&"-30")(0)
if PostCount>=int(Cache("MinUpPermission")) Then%>
<iframe src="PostUpFile.asp" frameborder="0" style="height:24px;width:450px" scrolling="No"></iframe><%else%><span class="blue">您本月的发帖没有达到要求,再发 <span class="red"><%=MinUpPermission-PostCount%></span> 帖才能获上传权限</span><%end if%></div>
</div>
<%end if%>
<div class="tc ac"><input type="submit" id="submit" value="发表主题" name="EditSubmit" /></div></form>
</div>
<%HtmlEnd%>

⌨️ 快捷键说明

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