📄 view.asp
字号:
<!--#include file="config.asp"-->
<!--#include file="sql.asp"--><%
Dim sid,yrs
sid=Request.QueryString("sid")
If sid="" Then
Response.Write "<script>alert('ID号不能为空!');window.close()</script>"
Response.End
End If
If not IsNumeric(sid) Then
Response.Write "<script>alert('ID号为非数字!');window.close()</script>"
Response.End
End If
Set yrs=Server.CreateObject("ADODB.RecordSet")
yrs.open "Select * from XH_Subject where id="&sid,conn,1,1
If (yrs.eof and yrs.bof) Then
Response.Write "<script>alert('此ID号不存在或已被删除!');window.close()</script>"
Response.End
End If
yrs.close
Set yrs=nothing
Dim stp,dtp,tt1,tt2,vtip,fIP
If Request.Form("submit")="投票" Then
If RestrictIP=True Then
fIP=Request.ServerVariables("Remote_Addr")
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Select * from XH_IP where sid="&sid&" and ip='"&fIP&"'",conn,1,3
If not(rs.eof and rs.bof) Then
Response.Write "<script>alert('你已经投过票了!');window.close()</script>"
Response.End
Else
rs.addnew
rs("sid")=sid
rs("ip")=fIP
rs("vtime")=now()
rs.update
End If
rs.close
Set rs=nothing
conn.execute("delete from XH_IP where datediff('h',vtime,now())>=1")
End If
stp=split(Trim(Request.Form("squestion"))&",",",")
dtp=split(Trim(Request.Form("dquestion"))&",",",")
Set rs=Server.CreateObject("ADODB.RecordSet")
For tt1=0 to ubound(stp)-1
If stp(tt1)<>"" Then
rs.open "Select ps from XH_Question where id="&stp(tt1),conn,1,3
rs("ps")=rs("ps")+1
rs.update
rs.close
End if
Next
For tt2=0 to ubound(dtp)-1
If dtp(tt2)<>"" Then
rs.open "Select ps from XH_Question where id="&dtp(tt2),conn,1,3
rs("ps")=rs("ps")+1
rs.update
rs.close
End If
Next
Set rs=nothing
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>雪晖在线投票系统--查看投票结果</title>
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body topmargin="0" leftmargin="0">
<div align="center">
<table border="0" width="40%" id="table1" cellspacing="1" cellpadding="3" class="tableborder">
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "select * from XH_Title where sid="&sid,conn,1,1
If not (rs.eof and rs.bof) Then
Do While not rs.eof
%>
<tr>
<th colspan="4"><%=rs("title")%></th>
</tr>
<%
Dim rsq,rsp,zps
zps=0
Set rsp=Server.CreateObject("ADODB.RecordSet")
rsp.open "select ps from XH_Question where tid="&rs("id"),conn,1,1
Do While not rsp.eof
zps=zps+rsp("ps")
rsp.MoveNext
loop
rsp.close
Set rsp=nothing
Set rsq=Server.CreateObject("ADODB.RecordSet")
rsq.open "select * from XH_Question where tid="&rs("id"),conn,1,1
If not (rsq.eof and rsq.bof) Then
Do While not rsq.eof
%>
<tr>
<td class="tablebody1"><%=rsq("question")%></td>
<td class="tablebody1" width="10%" nowrap><b><%=rsq("ps")%></b>票</td>
<td class="tablebody1" width="80">
<table border="0" width="<%if zps<>0 then%><%=80*formatNumber((rsq("ps")/zps),3)%><%end if%>" cellspacing="0" cellpadding="0" height="5" bgcolor="#CC99FF">
<tr>
<td></td>
</tr>
</table>
</td>
<td class="tablebody1" width="18%" nowrap>占<b><%If zps=0 Then Response.Write "0.0%" Else Response.Write FormatPercent((rsq("ps")/zps),3) End If%></b></td>
</tr>
<%
rsq.MoveNext
Loop
End If
rsq.close
Set rsq=nothing
rs.MoveNext
Loop
End If
rs.close
Set rs=nothing
%>
</table>
</div>
<br>
<div align="center">
<input type="button" name="button" value="关闭" onclick="javascript:window.close()" style="color: #F19373; border: 1px dotted #FCF5D6; background-color: #FEFCF1">
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -