<!--#include file = admin_conn.asp -->
<!--#include file = titleb.asp -->

<%

NewsID=trim(chkhtm(request("NewsID")))
tpx2=trim(chkhtm(request("tpx")))

tpxCOOKIES=Request.Cookies("TPxNewsID"&NewsID)
if tpxCOOKIES="1" then 
 Response.Write "<script>alert('你已经投过票了，请不要反复刷票。谢谢！');</script> <meta http-equiv='refresh' content='0; url="&Request.ServerVariables("HTTP_REFERER") &"'>"
 Response.end
end if


if (not isNumeric(NewsID)) then
   Response.Write "<script>alert('NewsID编号不正确。');</script> <meta http-equiv='refresh' content='0; url=javascript:window.history.go(-1);'>"
   Response.end
end if

if (not isNumeric(tpx)) then
   Response.Write "<script>alert('tpx编号不正确。');</script> <meta http-equiv='refresh' content='0; url=javascript:window.history.go(-1);'>"
   Response.end
end if


set rs = Server.CreateObject("ADODB.RecordSet"):rs.cursorlocation=3
rs.Open "select * from [News] where ID="&NewsID&" order by id desc",conn,3,3
if rs.recordcount<>0 then
	tpx1=rs("tpx")
	id=rs("id")
	
	if tpx2=1 then 
		rs("tpx")=tpx1+1
		rs.update
	elseif typ2=0 then
		if tpx1<1 then tpx1=1
		rs("tpx")=tpx1-1
		rs.update
	end if
	
	Response.Cookies ("TPxNewsID"&ID)="1"
	Response.Cookies ("TPxNewsID"&ID).Expires=Date+1
	
	http=glhtml(path&hrefID(ID,rs("filename")))
end if
rs.close:set rs=nothing

conn.close
set conn=nothing


Response.Redirect http
%>