⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewvote.asp

📁 商业网站/图片管理系统/投票系统/新闻管理系统/
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% Option Explicit %>
<!-- 投票结果查看 -->
<%
dim db
db=1
%>
<!-- #include file="config/db.asp" -->
<!-- #include file="config/function.inc.asp" -->

<%
dim rst,rst1,sql,sql1,myErrors,vid,i
set rst=server.createobject("adodb.recordset")
set rst1=server.createobject("adodb.recordset")
vid=request.querystring("v_id")
%>

<%
'--------------------页面参数-----------------------
if not isnumeric(vid) or isempty(vid) then
	msgboxU "非法参数"
	response.end'结束页面
end if
'--------------------处理投票-----------------------
if request.querystring("act")="tp" then
	sql="select v_stype from shop_vote where v_type=true and v_id="&vid
	rst.open sql,conn,1,1
	if rst.eof and rst.bof then
		msgboxU "非法参数"
		response.end
	else
	'两种处理方式:多选和单选
		if rst("v_stype") then'处理多选
			for i=1 to request.form("voteoptnum")
			'循环读取所有多选框的值,如果如现被选中则将相应的选项票数加1
				if request.form("chk_"&i)<>"" then
					sql="update shop_vote set v_num=v_num+1 where v_type=false and v_id="&request.form("chk_"&i)
					conn.execute sql
				end if
			next
		else'处理单选
			sql="update shop_vote set v_num=v_num+1 where v_type=false and v_id="&request.form("radio1")
			conn.execute sql
		end if
		set myErrors=conn.errors
		if myErrors.count<>0 then
			msgboxU "投票失败!原因:"&myErrors.item(0).description
		end if
	end if
	rst.close
end if
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>投票结果查看</title>
<link href="css/mycss.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>

<body>
<div align="center">

  <table width="754" height="83" border="1" cellpadding="0" cellspacing="0">
    <tr>
      <td height="38"><div align="center">投票结果察看</div></td>
    </tr>
    <tr>
      <td align="center"><%'---------------------显示投票主题begin---------------------
sql="select v_title from shop_vote where v_type=true and v_id="&vid
rst.open sql,conn,1,1
if rst.eof and rst.bof then
	response.write("错误的参数,或此投票主题已经被删除!")
	response.end
else
	response.write(rst("v_title"))
end if
rst.close
'--------------------------------显示投票主题end--------------------------
%></td>
    </tr>
  </table>
  <br/>
  
  
  <table width="754" height="109" border="1" cellpadding="0" cellspacing="0">
    <tr>
      <td colspan="3"><div align="center" class="STYLE1">投票结果</div></td>
    </tr>
<%
sql="select * from shop_vote where v_type=false and v_upid="&vid
rst.open sql,conn,1,1
if rst.eof and rst.bof then
%>
    <tr>
      <td colspan="3"><div align="center">这个投票主题还没有投票项!</div></td>
    </tr>
<%
else
	sql1="select sum(v_num) as snum,max(v_num) as mnum from shop_vote where v_type=false and v_upid="&vid
	rst1.open sql1,conn,1,1
	while not rst.eof
%>

    <tr>
      <td width="128" height="20"><%=rst("v_title")%></td>
	  <td width="497" height="20">
	  <table width="<%
	  if rst("v_num")=0 then
	  	response.Write("1")
	  else
	  	response.Write(rst("v_num")/rst1("mnum")*504)
	  end if
	  %>" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#0000FF">
  		<tr>
    	<td>&nbsp;</td>
  		</tr>
		</table>
	</td>
      <td width="121">
      票数:<%=rst("v_num")%>&nbsp;&nbsp;占:
      <% 
	  if rst("v_num")=0 then 
	  	response.Write "0"
	  else
	  	response.Write formatnumber(rst("v_num")/rst1("snum")*100,2)
	  end if
		%>%</td>
    </tr>
<%
		rst.movenext
	wend
%>
    <tr>
      <td colspan="3"><div align="right">总票数:<%=rst1("snum")%></div></td>
    </tr>
<%
	rst1.close
	set rst1=nothing
end if
rst.close
%>
  </table>
</div>
<%
set rst=nothing
conn.close
set conn=nothing
%>
<div align="center">
  <p>&nbsp;  </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>
    <input type="button" name="Submit" value="关闭窗口" onclick="window.close()" />
  </p>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -