📄 postfo.asp
字号:
<!--#include file="Connections.asp" -->
<!--#include file="fyerror.asp" -->
<!--#include file="top.asp" -->
<!--#include file="ubb.asp" -->
<%cpbtitle="发表文章"
call toptitle(l_title,cpbtitle)
call head(4,"论坛信息",Request.ServerVariables("HTTP_REFERER"),cpbtitle)
if request.querystring("action")<>"do" then
if instr(Request.ServerVariables("http_referer"),""&Request.ServerVariables("server_name")&"") = 0 then
errornum=1
errormsg="<li>非法提交数据,请不要从外部提交数据</li>"
end if
if request.querystring("l_id")="" then
errornum=1
errormsg=errormsg&"<li>很抱歉,你没有选择论坛,请从论坛首页正确登陆</li>"
end if
if isuser=false or errornum=1 then
errormsg=errormsg&"<li>请先登陆然后再发表文章</li>"
call error(errormsg)
call login()
call bq()
response.end
end if
dim h_postmoney,h_delfen,h_delmoney,h_delbeauty,h_postbeauty,t_fen,r_fen,t_size,h_replybeauty,h_replymoney,h_lesstopic,posttime,h_votetime
sql="select h_postmoney,h_delfen,h_delmoney,h_delbeauty,h_postbeauty,t_fen,r_fen,t_size,h_replybeauty,h_replymoney,h_lesstopic,posttime,h_votetime from home"
set rsconn1=conn.execute(sql)
if not rsconn1.eof then
h_postmoney=rsconn1("h_postmoney")
h_postbeauty=rsconn1("h_postbeauty")
t_fen=rsconn1("t_fen")
r_fen=rsconn1("r_fen")
t_size=rsconn1("t_size")
h_replybeauty=rsconn1("h_replybeauty")
h_replymoney=rsconn1("h_replymoney")
h_lesstopic=rsconn1("h_lesstopic")'最少发表字节
h_votetime=rsconn1("h_votetime")'论坛投票项数目
posttime=rsconn1("posttime")
h_delfen=rsconn1("h_delfen")'删除减分
h_delmoney=rsconn1("h_delmoney")
h_delbeauty=rsconn1("h_delbeauty")
end if
set rsconn1=nothing
'防关税
if DateDiff("s",Session("LastPostTime"),nowtime)<PostTime then
Response.write "<html><script>alert(""如果发贴还需要等待"&PostTime - DateDiff("s",Session("LastPostTime"),nowtime)&"秒"");self.location=(""javascript:history.go(-1)"")</script></html>"
Response.end
end if
'检查错误提交
sendtopic=Request("sendtopic")
if sendtopic="" then
response.write"错误"
response.end
end if
l_id=chktopic(Request("l_id"))
isbanzhu=false
sql="select l_pbuser,l_password,l_access,l_banzhu from lanmu where l_id="&l_id&""
set rs=conn.execute(sql)
if not rs.eof then
l_banzhu=rs("l_banzhu")
l_pbuser=rs("l_pbuser")
if issupermaster=false and ismaster=false then
if not isnull(l_banzhu) and l_banzhu<>"" and isuser and isbordermaster then
if instr(l_banzhu,cpbusername)>0 then
isbanzhu=true'获得斑竹的身份
end if
end if
'此段检查是否为加密区
if isbanzhu=false then
if rs("l_password")<>"" and session("fy_lpassword")<>rs("l_password") then response.redirect"login.asp?action=password&l_id="&l_id&""
if rs("l_access")=2 and isbordermaster=false then
errornum=1
errormsg="<Li>很抱歉,您没有权限进入,只有版主和总版主才可以操作</li>"
elseif rs("l_access")=1 and isuser=false then
errornum=1
errormsg="<Li>很抱歉,您没有权限进入,只有注册用户才可以操作</Li>"
elseif rs("l_access")=4 and isvipuser=false and isbordermaster=false then
errornum=1
errormsg="<Li>很抱歉,您没有权限进入,只有认证用户才可以操作</Li>"
elseif rs("l_access")=3 and issupermaster=false then
errornum=1
errormsg="<Li>很抱歉,只读论坛只有管理员和总斑竹或者该版块斑竹才可以操作</Li>"
end if
if l_pbuser<>"" and not isnull(l_pbuser) then
l_lockuser1=split(l_pbuser, "|")
for i=0 to ubound(l_lockuser1)
if cpbusername=l_lockuser1(i) then
erroruser=1
exit for
end if
next
end if
if erroruser=1 then
errornum=1
errormsg=errormsg&"<Li>很抱歉,您在该版块发言权已经被版主或者总版主或者管理员屏蔽</Li><Li>原因可能是你违反了论坛的有关规定</Li><Li>有什么问题请跟版主或者总版主或者管理员联系</Li>"
end if
end if
end if
else
errornum=1
errormsg="<Li>很抱歉,无此论坛!</Li>"
end if
set rs=nothing
sqluser="select lock,u_yzreg from user where username='"&cpbusername&"' and password='"&cpbpassword&"'"
set rsuser=conn.execute(sqluser)
if rsuser.BOF or rsuser.EOF then
errornum=1
errormsg=errormsg&"<Li>你的用户名错误</Li><Li>或者你的密码错误</Li>"
elseif rsuser("lock")="1" then
errornum=1
errormsg=errormsg&"<Li>很抱歉!您的发言权已经被管理员屏蔽</Li><Li>原因可能是你违反了论坛的有关规定</Li><Li>有什么问题请跟管理员联系</Li>"
elseif rsuser("u_yzreg")="1" then
errornum=1
errormsg=errormsg&"<Li>很抱歉!您的注册还没有通过管理员的验证,暂时不允许发贴</Li><Li>有什么问题请跟管理员联系</Li>"
end if
if errornum=1 then
call error(errormsg)
call bq()
response.end
end if
end if
if request.querystring("action")="" then
response.redirect("index.asp")
'发表主题
elseif request.querystring("action")="add" then
t_username=cpbusername
t_title=chktopic(trim(request.form("f3_motif")))
t_face=chktopic(Request.Form("f3_face"))
t_content=chktopic(trim(Request.Form("f3_content")))
t_ip=chktopic(Request.Form("ip"))
t_autourl=chktopic(Request.Form("t_autourl"))
t_lockubb=chktopic(Request.Form("t_lockubb"))
t_email=chktopic(Request.Form("t_email"))
t_sign=chktopic(Request.Form("t_sign"))
if t_sign="" then t_sign=1
if t_lockubb="" then t_lockubb=0
if t_autourl="" then t_autourl=0
if t_email<>"" then
t_email=cpbusername&","
end if
l_id=chktopic(request.querystring("l_id"))
t_vote=chktopic(request.form("f3_vote"))
if t_title="" then
errornum=1
errormsg="<li>主题不能为空</li>"
end if
if len(t_title)>30 then
errornum=1
errormsg=errormsg&"<li>主题不能超过30个字符</li>"
end if
if t_content="" then
errornum=1
errormsg=errormsg&"<li>内容不能为空</li>"
end if
if len(t_content)<h_lesstopic then
errornum=1
errormsg=errormsg&"<li>内容不能少于"&h_lesstopic&"个字符</li>"
end if
if len(t_content)>t_size then
errornum=1
errormsg=errormsg&"<li>内容不能超过"&t_size&"个字符</li>"
end if
if t_vote<>"" then
t_vote=replace(t_vote,"'","''")
t_vote=split(t_vote,chr(13)&chr(10))
for i=ubound(t_vote) to 0 step -1
if t_vote(i)="" then
errornum=1
errormsg="<li>发表的投票不能为空</li>"
end if
next
b=ubound(t_vote)
if b>h_votetime or b<2 then
errornum=1
errormsg=errormsg&" <li>你发表的投票超过了"&h_votetime&"条的限制,或者不够两条</li>"
end if
end if
if errornum=1 then
call error(errormsg)
call bq()
response.end
end if
t_title=chktopic(request.form("f3_motif"))
t_title=replace(t_title," "," ")
session("upcount")=""
strSql = "insert into topic (t_username,t_sign,t_email,t_autourl,t_lockubb, t_ip, t_title,t_content, t_lasttime, t_lastusername,t_lasttitle,t_time,t_face,l_id) Values ('"
strSql = StrSQl & t_username & "', "
strSql = StrSQl & t_sign & ", '"
strSql = StrSQl & t_email & "', "
strSql = StrSQl & t_autourl & ", "
strSql = StrSQl & t_lockubb & ", '"
strSql = StrSQl & t_ip & "', '"
strSql = StrSQl & t_title & "', '"
strSql = StrSQl & t_content & "', '"
strSql = StrSQl & nowtime & "', '"
strSql = StrSQl & t_username & "', '"
strSql = StrSQl & t_title & "', '"
strSql = StrSQl & nowtime & "', '"
strSql = StrSQl & t_face & "', "
strSql = StrSQl & l_id & ")"
conn.Execute (strsql)
sqlv="select top 1 t_id from topic order by t_id desc"
set rsv=conn.execute(sqlv)
t_idnew=rsv("t_id")
t_vote=chktopic(request.form("f3_vote"))
if t_vote<>"" then
t_vote=split(t_vote,chr(13)&chr(10))
sqlvo="update topic set t_vote=1 where t_id="&rsv("t_id")&""
conn.execute(sqlvo)
v_type=chktopic(request.form("v_type"))
for i=ubound(t_vote) to 0 step -1
sql1 = "INSERT INTO vote (v_num,v_title,v_type)VALUES('"&rsv("t_id")&"','"&t_vote(i)&"','"&v_type&"')"
conn.Execute(sql1)
next
end if
'写入发贴时间
Session("LastPostTime")=nowtime
'写入统计
sqlnum="update total set t_num=t_num+1,h_posttoday=h_posttoday+1"
conn.Execute (sqlnum)
sqllanmu="update lanmu set l_topiccount= l_topiccount+1 where l_id="&l_id&""
conn.Execute (sqllanmu)
sqluser1="update user set u_todaysend=u_todaysend+1,send=send+1,fen=fen+"&t_fen&",u_beauty=u_beauty+"&h_postbeauty&",u_money=u_money+"&h_postmoney&", lastsend='"&HTMLEncode(t_title)&"',lastsendtime='"&nowtime&"' where username='"&t_username&"'"
conn.Execute (sqluser1)
sqluser2="select grade,fen from user where username='"&t_username&"'"
set rsuser2=conn.Execute (sqluser2)
if not rsuser2.eof then
rsg=rsuser2("grade")-1
if rsuser2("grade")=<4 then
response.redirect"postfo.asp?t_id="&t_idnew&"&l_id="&request.querystring("l_id")&"&action=do"
end if
sqlgrade1="select * from grade where g_num="&rsg&""
set rsgrade1=conn.Execute (sqlgrade1)
if rsuser2("fen")<rsgrade1("g_fen") then
response.redirect"postfo.asp?t_id="&t_idnew&"&l_id="&request.querystring("l_id")&"&action=do"
end if
sqlgrade2="update user set grade= grade-1 where username='"&t_username&"'"
conn.Execute (sqlgrade2)
end if
response.redirect"postfo.asp?t_id="&t_idnew&"&l_id="&request.querystring("l_id")&"&action=do"
set rsv=nothing
'发表回复
elseif request.querystring("action")="reply" then
sql="select t_lock,t_jinhua from topic where t_id="&chktopic(request.querystring("t_id"))&""
set rs=conn.execute(sql)
if rs("t_lock")=1 or rs("t_jinhua")=1 or rs("t_lock")=2 then
errornum=1
errormsg=errormsg&"<Li>您要回复的主题已经被移到回收站或者已经被锁定或者你要回复的是精华帖,但精华帖不允许发回复</li>"
end if
set rs=nothing
if errornum=1 then
call error(errormsg)
call bq()
response.end
end if
r_username=cpbusername
r_face=chktopic(Request.Form("f3_face"))
r_content=chktopic(trim(Request.Form("f3_content")))
r_title=chktopic(trim(Request.Form("f3_motif")))
r_ip=chktopic(Request.Form("ip"))
t_id=chktopic(request.querystring("t_id"))
l_id=chktopic(request.querystring("l_id"))
t_autourl=chktopic(Request.Form("t_autourl"))
t_lockubb=chktopic(Request.Form("t_lockubb"))
r_email=chktopic(Request.Form("t_email"))
t_sign=chktopic(Request.Form("t_sign"))
if t_sign="" then t_sign=1
if t_autourl="" then t_autourl=0
if t_lockubb="" then t_lockubb=0
if r_face="" then
r_face="icon/1.gif"
end if
if r_title="" then
errornum=1
errormsg=errormsg&"<Li>回复标题不能为空</li>"
end if
if len(r_title)>30 then
errornum=1
errormsg=errormsg&"<li>标题不能超过30个字符</li>"
end if
if r_content="" then
errornum=1
errormsg=errormsg&"<Li>内容不能为空</li>"
end if
if len(r_content)<h_lesstopic then
errornum=1
errormsg=errormsg&"<Li>内容不能少于"&h_lesstopic&"个字符</li>"
end if
if len(r_content)>t_size then
errornum=1
errormsg=errormsg&"<Li>内容不能超过"&t_size&"个字符</li>"
end if
if errornum=1 then
call error(errormsg)
call bq()
response.end
end if
strSql = "insert into reply (r_username, r_title,r_time,r_ip, r_content,t_sign,t_autourl,t_lockubb, r_face,t_id,l_id) Values ('"
strSql = StrSQl & r_username & "', '"
strSql = StrSQl & r_title & "', '"
strSql = StrSQl & nowtime & "', '"
strSql = StrSQl & r_ip & "', '"
strSql = StrSQl & r_content & "', "
strSql = StrSQl & t_sign & ", "
strSql = StrSQl & t_autourl & ", "
strSql = StrSQl & t_lockubb & ", '"
strSql = StrSQl & r_face & "', "
strSql = StrSQl & t_id & ", "
strSql = StrSQl & l_id & ")"
conn.Execute (strsql)
isemail=0
sqlreplynum="update topic set t_replynum=t_replynum+1,t_lasttime='"&nowtime&"',t_lastusername='"&r_username&"',t_lasttitle='"&r_title&"'"
'发送邮件
sqltt="select l_id,t_id,t_email,t_title,t_time from topic where t_id="&t_id&""
set rstt=conn.execute(sqltt)
if not rstt.eof then
t_email=rstt("t_email")
if instr(t_email,cpbusername)>0 then
isemail=1
end if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -