%
dim itemid,founderr,errmsg,itemname
founderr=false
errmsg=""
if request.querystring("vt_id")="" then
founderr=true
errmsg=errmsg+" "+"
你必须指定投票的主题!"
else
if not isInteger(request.querystring("vt_id")) then
founderr=true
errmsg=errmsg+" "+"
非法的投票主题的id参数。"
else
vtid=cint(request.querystring("vt_id"))
end if
end if
if request.form("item_id")="" then
founderr=true
errmsg=errmsg+" "+"
你必须指定操作的对象!"
else
if not isInteger(request.form("item_id")) then
founderr=true
errmsg=errmsg+" "+"
非法的投票选项id参数。"
else
itemid=cint(request.form("item_id"))
end if
end if
if request.form("itemname")="" then
founderr=true
errmsg=errmsg+" "+"
你必须指定操作的对象!"
else
itemname=request.form("itemname")
end if
if founderr then
call diserror()
response.end
else
sql="update voteitem set item_count = item_count + 1 where item_id="&itemid
conn.execute(sql)
sql="select vt_id from voteitem where item_id="&itemid
set rs=conn.execute(sql)
vtid=rs("vt_id")
sql="select vt_startdate,vt_expiredate from votetopic where vt_id="&vtid
set rs=conn.execute(sql)
vt_startdate=rs("vt_startdate")
vt_expiredate=rs("vt_expiredate")
rs.close
set rs=nothing
days=datediff("d",vt_startdate,vt_expiredate)
cookies_time=dateadd("d",days,date())
response.cookies("npw")("voted")="yes"
response.cookies("npw")("topic")=request.QueryString("vt_name")
response.cookies("npw")("itemname")=request.form("itemname")
response.cookies("npw").expires=cookies_time
closedatabase
%>
投票成功!