<!--#include file="../../bbs/Inc.asp"-->
<!--#include file="../../bbs/ydzq.asp"-->
<!--#include file="../../bbs/forbbs.asp"-->

<%Call head()
dim bbsid,tid,face,fid
bbsid=request("bbsid")
fid=request("fid")
k=request("k")
taid=request("taid")
tid=request("tid")
ztname=request("ztname")
face=request("face")
fydz=request("fydz")
ffid=request.QueryString("ffid")
if face="" or IsNumeric(face)=False then face=0

if tid="" or IsNumeric(tid)=False then
  Call Error("<card title=""ID无效""><p>ID无效！")
  end if
if bbsid="" or IsNumeric(bbsid)=False then
  Call Error("<card title=""ID无效""><p>ID无效！")
  end if
Sub Fortxtrel
if bbsid<>"" then
set rs=server.createobject("adodb.recordset")
rs.open "select bbsid,strrel,strall from hmd where bbsid="&bbsid&" and guliid="&myid,conn,1,1
if not rs.eof then
if rs("strrel")>0 then
 Call Error("<card title=""出错""><p>你在本版已被禁回复！")
  end if
if rs("strall")>0 then
 Call Error("<card title=""出错""><p>你在本版已被加黑！")
  end if
end if
rs.close
set rs=nothing
end if

set rs=server.createobject("adodb.recordset")
rs.open "select bbsid,strrel,strall from hmd where bbsid=0 and guliid="&myid,conn,1,1
if not rs.eof then
if rs("strrel")>0 then
 Call Error("<card title=""出错""><p>你已被禁回复！")
  end if
if rs("strall")>0 then
 Call Error("<card title=""出错""><p>你已被加黑！")
  end if
end if
rs.close
set rs=nothing
end Sub
CALL Fortxtrel

recontent=forbbs(request("recontent"))
if recontent="" then
  Call Error("<card title=""回复失败""><p>回复内容不能为空！")
  end if
if len(recontent)>500 then
  Call Error("<card title=""回复失败""><p>回复内容字数不能大于500字！")
  end if

if maren(recontent) >0 then
  Call Error("<card title=""回复失败""><p>请文明用语，不要讲粗话，谢谢！")
end if
dim v_Price,v_PaiCent
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select st,Price,PaiCent from sell where yc=0 and id="&tid,conn,1,1
if rs.eof then
  Call Error("<card title=""回复失败""><p>帖子不存在！")
  end if
IF rs("st")=1 then 
  Call Error("<card title=""回复失败""><p>帖子已锁定！")
  end if
v_Price  = rs("Price")
v_PaiCent  = rs("PaiCent")
rs.close
set rs=nothing

'10秒钟内只能回复一个帖子
set rs=server.CreateObject("ADODB.RecordSet")
rs.open "select top 1 ID,htm from relist where fid = "&myid&" order by id desc",conn,1,1
if not rs.eof then
htm=rs("htm")
if DateDiff("s",htm,Now())<15 then
  rs.close
 set rs=Nothing
  Call Error("<card title=""回复失败""><p>15秒钟只能回复一次帖子！"&DateDiff("s",htm,Now())&"")
END IF
End if
rs.close
set rs=Nothing


'检查是否是派币贴
dim LastRe2
LastRe2=0
if v_Price>0 then
   if v_Price<v_PaiCent then
   v_PaiCent=v_Price
   end if
  '第几次回复,派币贴
  set rs=server.createobject("adodb.recordset")
  rs.open "select ID from relist where tid = " & tid&" and fid="&myid,conn,1,1
  LastRe2 = rs.RecordCount
  rs.close
  set rs=Nothing
  set rs=server.createobject("adodb.recordset")
  rs.open "select myjb from Users where ID="&myid,conn,1,2
  '派币
    if LastRe2 = 0 then
    rs("myjb")  = rs("myjb")  + v_PaiCent
  rs.update
  conn.execute("update sell Set Price =Price-"&v_PaiCent&" where ID="&tid)
  end if
  rs.close
  set rs=nothing
end if


set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from relist",conn,1,2

rs.addnew
rs("nr")=("回复"&K&"楼")+recontent
rs("biao")=face
rs("fydz")=fydz
rs("fid")=myid
rs("tid")=tid
rs("fni")=myni
rs("htm")=now()
rs.update
rs.close
set rs=nothing

set rs51=Server.CreateObject("ADODB.Recordset")
rs51.open"select * from [ydbbs] where id="&bbsid,conn,1,1
nameaa=rs51("name")
rs51.close
set rs51=nothing

set rs52=Server.CreateObject("ADODB.Recordset")
rs52.open"select * from sell where yc=0 and id=" & tid,conn,1,1
tidname=rs52("name")
rs52.close
set rs52=Nothing

If fid<>myid then
dim rshf
set rshf=Server.CreateObject("ADODB.Recordset")
rshf.open"select * from [guest]",conn,1,2
rshf.addnew
rshf("sid")=ffid
rshf("fnr")=""&myni&"(ID:"&myid&")在[url=/bbs/board.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid=[sid]]"&nameaa&"[/url]论坛版块，回复了您的回帖内容[url=/bbs/topic.asp?tid="&tid&"&amp;saytk="&saytk&"&amp;sid=[sid]]"&tidname&"[/url]，赶紧去看看吧。"
rshf.update
rshf.close
set rshf=Nothing
End if

'更新回复时间
If dztesql=0 Then 
conn.execute("update sell set retime=getdate() where ID="&tid)
Else
conn.execute("update sell set retime=now() where ID="&tid)
End if
'加币
dim zt,jk,saytkcomjb,saytkcomjy,saytkcomch,saytkcomml,saytkcomtl,saytkcomxq,saytkcomjk,smk,saytkcompz,saytkcomsmk,saytkcomsmk2,saytkcomjkk,saytkcomjkk2,jkk
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select cwzt,cw,cwrq,cwsmk,cwjkk from Users where sid='"&RequestStr(sid)&"'",conn,1,1
pz=rs("cw")
zt=rs("cwzt")
jk=rs("cwrq")
smk=rs("cwsmk")
jkk=rs("cwjkk")
rs.close
set rs=nothing

if zt=1 and pz=1 then
saytkcomjb=long1
saytkcomjy=longjy1
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcomxq=longxq1
saytkcomjk=longjk1
saytkcompz="携带龙系宠物"
saytkcomsmk="0"
saytkcomsmk2="0"
saytkcomjkk="0"
saytkcomjkk2="0"
else
if zt=1 and pz=7 then
saytkcomjb=tu1
saytkcomjy=tujy1
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcomxq=tuxq1
saytkcomjk=tujk1
saytkcompz="携带兔子系宠物"
saytkcomsmk="0"
saytkcomsmk2="0"
saytkcomjkk="0"
saytkcomjkk2="0"
else
if zt=1 and pz=2 then
saytkcomjb=jing1
saytkcomjy=jingjy1
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcomxq=jingxq1
saytkcomjk=jingjk1
saytkcompz="携带精灵系宠物"
saytkcomsmk="0"
saytkcomsmk2="0"
saytkcomjkk="0"
saytkcomjkk2="0"
else
if zt=1 and pz=3 then
saytkcomjb=niao1
saytkcomjy=niaojy1
saytkcomxq=niaoxq1
saytkcomjk=niaojk1
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcompz="携带鸟系宠物"
saytkcomsmk="0"
saytkcomsmk2="0"
saytkcomjkk="0"
saytkcomjkk2="0"
else
if zt=1 and pz=4 then
saytkcomjb=mao1
saytkcomjy=maojy1
saytkcomxq=maoxq1
saytkcomjk=maojk1
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcompz="携带猫系宠物"
saytkcomsmk="0"
saytkcomsmk2="0"
saytkcomjkk="0"
saytkcomjkk2="0"
else
if zt=1 and pz=5 then
saytkcomjb=xiong1
saytkcomjy=xiongjy1
saytkcomxq=xiongxq1
saytkcomjk=xiongjk1
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcompz="携带熊猫系宠物"
saytkcomsmk="0"
saytkcomsmk2="0"
saytkcomjkk="0"
saytkcomjkk2="0"
else
if zt=1 and pz=6 then
saytkcomjb=qingwa1
saytkcomjy=qingwajy1
saytkcomxq=qingwaxq1
saytkcomjk=qingwajk1
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcompz="携带青蛙系宠物"
saytkcomsmk="0"
saytkcomsmk2="0"
saytkcomjkk="0"
saytkcomjkk2="0"
else
if zt=2 and smk>0 then
saytkcomjb=hfjb
saytkcomjy=hfjy
saytkcomxq="0"
saytkcomjk="0"
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcompz="使用宠物生命卡"
saytkcomsmk="1"
saytkcomsmk2=smk2
saytkcomjkk="0"
saytkcomjkk2="0"

else
if zt=3 and jkk>0 then
saytkcomjb=hfjb
saytkcomjy=hfjy
saytkcomxq="0"
saytkcomjk="0"
saytkcomtl=hftl
saytkcomml=hfml
saytkcomch=hfch
saytkcompz="使用宠物智力卡"
saytkcomsmk="0"
saytkcomsmk2="0"
saytkcomjkk="1"
saytkcomjkk2=jkk2


end if
end if
end if
end if
end if
end if
end if

end if
end if
if myid<>0 then
mz="[url=/bbs/uinfo.asp?id="&myid&"&amp;saytk="&saytk&"&sid=[sid]]"&myni&"[/url]"
else
mz="游客"
end if

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select name from sell where yc=0 and id=" & tid,conn,1,1

conn.execute("insert into sqdt(shijian,dz)values('"&now&"','"&mz&"回复了帖子(url=/bbs/topic.asp?bbsid="&bbsid&"&amp;tid="&tid&"&amp;saytk="&saytk&"&sid=[sid])"&ubb(rs("name"))&"(/url)')")

if (zt=1 and jk=>11 or zt=2 and smk=>1 or zt=3 and jkk=>1) then


conn.execute("update Users set myjb=myjb+"&clng(saytkcomjb)&" where ID="&myid&"")
conn.execute("update Users set myjy=myjy+"&clng(saytkcomjy)&" where ID="&myid&"")
conn.execute("update Users set mytl=mytl+"&clng(saytkcomtl)&" where ID="&myid&"")
conn.execute("update Users set myml=myml+"&clng(saytkcomml)&" where ID="&myid&"")
conn.execute("update Users set mych=mych+"&clng(saytkcomch)&" where ID="&myid&"")
conn.execute("update Users set cwxq=cwxq-"&clng(saytkcomxq)&" where ID="&myid&"")
conn.execute("update Users set cwrq=cwrq-"&clng(saytkcomjk)&" where ID="&myid&"")
conn.execute("update Users set cwsmk=cwsmk-"&clng(saytkcomsmk)&" where ID="&myid&"")
conn.execute("update Users set cwsm=cwsm+"&clng(saytkcomsmk2)&" where ID="&myid&"")
conn.execute("update Users set cwjkk=cwjkk-"&clng(saytkcomjkk)&" where ID="&myid&"")
conn.execute("update Users set cwzs=cwzs+"&clng(saytkcomjkk2)&" where ID="&myid&"")
conn.execute("update Users set myrelnum = myrelnum+1 where ID="&myid&"")
conn.close
set conn=nothing

Call cardz("回复成功","/bbs/topic.asp?bbsid="&bbsid&"&amp;tid="&tid&"&amp;sid="&sid&"&amp;saytk="&saytk&"")

response.write "您"&saytkcompz&"回复帖子成功!奖励"&clng(saytkcomjb)&getcent&","&clng(saytkcomjy)&"经验<br/>"
response.write ""&clng(saytkcomtl)&"体力,"&clng(saytkcomml)&"魅力,"&clng(saytkcomch)&"才华.<br/>"
response.write "宠物心情-"&clng(saytkcomxq)&",健康-"&clng(saytkcomjk)&",智力+"&clng(saytkcomjkk2)&",生命+"&clng(saytkcomsmk2)&"<br/>宠物生命卡-"&clng(saytkcomsmk)&",宠物智力卡-"&clng(saytkcomjkk)&"<br/>"
If saytk=1 Then
response.write "<br/>请稍等.正在返回帖子内容.."
End if
else

conn.execute("update Users set myjb=myjb+"&clng(hfjb)&" where ID="&myid&"")
conn.execute("update Users set myjy=myjy+"&clng(hfjy)&" where ID="&myid&"")
conn.execute("update Users set mytl=mytl+"&clng(hftl)&" where ID="&myid&"")
conn.execute("update Users set myml=myml+"&clng(hfml)&" where ID="&myid&"")
conn.execute("update Users set mych=mych+"&clng(hfch)&" where ID="&myid&"")
conn.execute("update Users set myrelnum=myrelnum+1 where ID="&myid&"")

conn.close
set conn=nothing

Call cardz("回复成功","/bbs/topic.asp?bbsid="&bbsid&"&amp;tid="&tid&"&amp;sid="&sid&"&amp;saytk="&saytk&"")


if zt=1 and jk<=10 then

response.write "您的宠物已经死亡!携带宠物无效!<br/>"
else
if zt=2 and smk<=0 then

response.write "您的生命卡已经使用完了~~!<br/>"
else
if zt=3 and jkk<=0 then

response.write "您的智力卡已经使用完了~~!<br/>"
end if
end if
end if
response.write "您回复帖子成功!奖励"&clng(hfjb)&getcent&","&clng(hfjy)&"经验<br/>"
response.write ""&clng(hftl)&"体力,"&clng(hfml)&"魅力,"&clng(hfch)&"才华.<br/>"
If saytk=1 Then
response.write "请稍等.正在返回帖子内容..<br/>"
End if
end if



if v_Price>0 and LastRe2 = 0 then
response.write "楼主派"&v_PaiCent&getcent&"<br/>"
end if
Response.write "<a href='/bbs/relist.asp?tid="&tid&"&amp;bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&"'>回复列表</a>"
response.write "<br/><a href=""/bbs/topic.asp?tid="&tid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">返回主帖</a>"
response.write "<br/><a href='/bbs/board.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&"'>返回本版</a>"
%>
<!--#include file="../../bbs/fanhui.asp"-->
<%
call headsay()
%>

