www.gusucode.com > 学校共青团组织网站源代码 > 学校共青团组织网站源代码/626/JS-TP2.asp

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

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type="text/css">
<!--
a:link {text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited {text-decoration: none; color: #000000 }
A:hover {COLOR: green; FONT-FAMILY: "宋体,MingLiU"; TEXT-DECORATION: underline}
body {font-size: 9pt; font-family: 宋体,MingLiU, Arial;color: #000000}
TD {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000;line-height: 120%;table-layout:fixed;word-break:break-all}
p {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
input {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
body {margin-top: 0; margin-bottom: 0;margin-left:0;margin-right:0; color: #000000}
select {FONT-SIZE: 9PT;font-family: 宋体}
option {FONT-SIZE: 9pt;font-family: 宋体}
textarea {FONT-SIZE: 9pt;font-family: 宋体}
-->
</STYLE>
</head>

<body>
<%
tpid=chkhtm(trim(request("tpid")))
tps=trim(Request("tps"))
tps=replace(tps," ","")
if (not isNumeric(tpid)) then
  Response.Write "<Script Language=JavaScript>alert('ID参数错误或有非法字符或没指定参数,请勿随意提交数据!');</Script>"
  response.end  
end if

aaa=split(tps,",")

if Request.Cookies("tpid"&tpid&"")=tpid then
	Response.Write "<BR><BR><BR><center>已经投过了,请不要重复投票!"
	er=1
end if

set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select * from [tp] where id="&tpid&" order by id desc",conn,1,1
if rs.recordcount<>0 then
	endtime=rs("endtime")
	title=rs("title")
	ddsl=rs("ddsl")
end if
rs.close:set rs=nothing

if dd="2" then
	if (not isNumeric(ddsl)) then
		ddsl=20
	end if
	
	if ubound(aaa)>ddsl then
		Response.Write "<BR><BR><BR><center>最多只能选择"&ddsl&"项,你选项了"&ubound(aaa)+1&"项,本次无效。</center>"
		er=1
	end if
end if

if datediff("d",endtime,date())>0 then
	Response.Write "已经到期了,不能再投票了"
	er=1
end if

if er<>1 then

		for i=0 to ubound(aaa)
			tpsid=aaa(i)
			'Response.Write tpsid&"<BR>"
			conn.Execute "update [tptitle] set [tps]=tps+1 where id="&clng(tpsid)
			Response.Cookies ("tpid"&tpid&"")=tpid
			Response.Cookies("tpid"&tpid&"").expires=date+1
		next

end if
%>
<br>
<div align="center">
	<table border="1" cellpadding="4" width="760" id="table1" style="border-collapse: collapse" bordercolor="#C0C0C0">
		<tr>
			<td colspan="3" background="images/bj3.jpg" height="25"><%=title%>(过期时间:<%=endtime%>)</td>
		</tr>
<%
set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select * from [tptitle] where tpid="&tpid&" order by id desc",conn,1,1
if rs.recordcount<>0 then


set rssum = Server.CreateObject("ADODB.RecordSet")
rssum.Open "select sum(tps) as f_sum from [tptitle] where tpid="&tpid&" ",conn,1,1
tpsall=rssum(0)
rssum.close:set rssum=nothing

for i=1 to rs.recordcount
tps=rs("tps")

if tpsall<>0 then
	bfb=Round(rs("tps")/tpsall*100,2)
else
	bfb=0
end if
%>
		<tr>
			<td width="537" ><%=i%>、<%=rs("tpxx")%> (<%=tps%>票)</td>
			<td width="87">支持率:<%=bfb%>%</td>
			<td width="107">
			<img border="0" src="images/bg11.GIF" width="<%=int(bfb)%>" height="25"></td>
		</tr>
<%
rs.movenext
if rs.eof then exit for
next
end if
rs.close:set rs=nothing
conn.close:set conn=nothing
%>

	</table>
</div>
</body>

</html>