<!--#include file="connre.asp"-->
<!--#include file="connbbs.asp"-->
<%membername=request.cookies("aspsky")("username")

if membername="" then
response.redirect "../login.asp"
response.end
end if
dim BoardID
dim RootID
dim AnnounceID
dim isagree,noagree
dim towho,sqlto

BoardID=request("BoardID")
RootID=request("RootID")
AnnounceID=request("AnnounceID")
isagree=request("isagree")
 set rsbbs=server.createobject("adodb.recordset")
 sqlto="select username from bbs1 where AnnounceID="&AnnounceID
 rsbbs.open sqlto,connbbs,0,1
 towho=rsbbs(0)
 rsbbs.close
 set rsbbs=nothing

if rootid=announceid and towho<>membername and datediff("m",session("timer"),now())>20 then
set rsre=server.createobject("adodb.recordset")
sqlre="select boardid,rootid,isagree,noagree from rose_ege where boardid="&boardid&" and rootid="&rootid
rsre.open sqlre,connre,1,3
if rsre.eof then
  rsre.addnew
  rsre("BoardID")=BoardID
  rsre("RootID")=RootID
    if isagree=1 then
     rsre("isagree")=1
    end if
    if isagree=2 then
     rsre("noagree")=1
    end if
  rsre.update
  rsre.close
 else
   if isagree=1 then
  rsre("isagree")=rsre("isagree")+1
   end if
  if isagree=2 then
   rsre("noagree")=rsre("noagree")+1
   end if
   rsre.update
   rsre.close
 end if
 set rs=nothing

    '得到鲜花威望值加10，得到鸡蛋威望值减10
   set rsbbs=server.createobject("adodb.recordset")
    sqlbbs="select userPower from user where username='"&towho&"' "
	rsbbs.open sqlbbs,connbbs,1,3
       if isagree=1 then
    rsbbs("userpower")=rsbbs("userpower")+1
	   end if
	  if isagree=2 then
    rsbbs("userpower")=rsbbs("userpower")-1
	    end if
	rsbbs.update
	rsbbs.close
	sqlbbs2="select userWealth from user where username='"&membername&"' "
	rsbbs.open sqlbbs2,connbbs,1,3
     rsbbs("userWealth")=rsbbs("userWealth")-10
	 	rsbbs.update
        rsbbs.close
	set rsbbs=nothing
	session("timer")=now()
response.redirect "../dispbbs.asp?boardid="&boardid&"&rootid="&rootid&"&id="&rootid

else
response.redirect "../dispbbs.asp?boardid="&boardid&"&rootid="&rootid&"&id="&rootid
end if
%>