<!--#include file="conn.asp"-->
<%
dim BoardID
dim RootID
dim AnnounceID
dim membername
dim host
dim payfor
dim towho
dim rs
dim sql
membername=request.cookies("aspsky")("username")
if membername="" then
response.redirect "login.asp"
response.end
end if

BoardID=request("BoardID")
RootID=request("RootID")
AnnounceID=request("AnnounceID")

sql="select username,payfor from bbs1 where boardid="&boardid&" and rootid="&rootid&" and parentid=0"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
response.write "提交的参数有误"
else
host=rs(0)  '取得楼主姓名及贴子分值
payfor=rs(1)
end if
rs.close


if membername<>host then'判断操作人是不是楼主
response.redirect "dispbbs.asp?boardid="&boardid&"&rootid="&rootid&"&id="&AnnounceID
set rs=nothing
response.end
else
sql="select username from bbs1 where AnnounceID="&AnnounceID
set rs=conn.execute(sql)
 towho=rs(0)
  rs.close
   set rs=nothing
if host=towho then
response.redirect "dispbbs.asp?boardid="&boardid&"&rootid="&rootid&"&id="&AnnounceID
response.end
end if

sql="update bbs1 set payfor=0 where boardid="&boardid&" and rootid="&rootid&" and parentid=0"
conn.execute(sql)
sql="update [user] set userep=userep+"&payfor&" where username='"&towho&"'"
conn.execute(sql)
sql="update bbs1 set payfor=+"&payfor&"  where AnnounceID="&AnnounceID
conn.execute(sql)
response.redirect "dispbbs.asp?boardid="&boardid&"&rootid="&rootid&"&id="&AnnounceID
end if%>