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

📄 vote.asp

📁 淘客网上商店网站程序 淘客网上商店网站程序 淘客网上商店网站程序
💻 ASP
字号:
<!--#include file="Conn.asp"-->
<!--#include file="inc/Cl_ClsSysTem.asp" -->
<%
Cl.Get_WebSetting()
dim Action,ID,VoteType,VoteOption,arrOptions,sqlVote,rsVote
dim Voted,VotedID,i
dim FoundErr,ErrMsg
Action		= Trim(Request("Action"))
ID			= Cl.GetClng(request("ID"))
VoteType	= Trim(request("VoteType"))
VoteOption	= Trim(request("VoteOption"))
Voted		= False
VotedID		= Trim(session("VotedID"))

if Id=0 then
	Call Cl.OutErr(0,"<br /><li>不能确定调查ID</li>")
elseif VotedID<>"" then
	if instr(","&VotedID&",",","&Id&",")>0 then	Voted=True
end if
if Action="" or VoteOption="" then
	Action="Show"
end if
If Action = "Vote" And VoteOption<>"" and Voted=False Then
	UpdateVote
End If

ShowVote

Sub ShowVote()
Dim totalVote,sConTent,sNums
Set rsVote = Cl.Execute("Select * from Cl_Vote Where ID=" & ID)
if rsVote.bof and rsVote.Eof then
	Call Cl.OutErr(0,"查数据库中无此调查,可能已被管理员删除!")
end if
totalVote=rsVote("totalNums")
sConTent=Split(rsVote("ConTent"),"@")
sNums=Split(rsVote("Nums"),"@")
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.1 Transitional//EN">
<HTML>
<HEAD>
<TITLE>调查结果</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style type="text/css">
A{TEXT-DECORATION: none;}
A:hover{COLOR: #0099FF;}
A:link {color: #205064;}
A:visited {color: #006699;}
BODY{
FONT-FAMILY: 宋体;
FONT-SIZE: 9pt;
text-decoration: none;
line-height: 150%;
background-color: #FBFDFF;}
TD{
FONT-FAMILY:宋体;
FONT-SIZE: 9pt;}
Input{
FONT-SIZE: 9pt;
HEIGHT: 20px;}
Button{
FONT-SIZE: 9pt;
HEIGHT: 20px; }
Select{
FONT-SIZE: 9pt;
HEIGHT: 20px;}
.border{border: 1px solid #CCCCCC;}
.border2{
background:#fef8ed;
BORDER-RIGHT: #999999 1px solid; 
BORDER-LEFT: #999999 1px solid}
.title{background:#f6f6f6;}
</style>
</HEAD>
<BODY bgcolor="#eeeeee">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td valign="top" align="center"><strong><%
if Action="Vote" And VoteOption<>"" then
	response.write "<font color='#FF0000' size='3'>"
	if Voted=True then
		response.write "== 你已经投过票了,请勿重复投票! =="
    else	
		response.write "== 非常感谢您的投票! =="
	end if
	response.write "</font><br />"
end if
		%></strong><br /> 
      <table width="700" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF" class="border">
        <tr align="center" class="title"> 
          <td width="702" height="22" colspan="3"><strong><img src="<%=Cl.WebDir%>images/p1.GIF" width="16" height="16" align="absmiddle"> 
            网站关于<font color="#FF0000">“</font><font color="#FF0000"><%=rsVote("Title")%>”</font>的调查结果</strong></td>
        </tr>
        <tr> 
          <td bgcolor="#FFFFFF"> 
            <table width="700" border="0" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#000000" bordercolordark="#CCCCCC">
              <tr> 
                <td> <strong> &middot;目前网友的总投票数为:</strong><font color="#FF0000"> 
                  <%=totalVote & "票"%>
                  </font> </td>
              </tr>
            </table>
            <table width="700" border="0" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#000000" bordercolordark="#CCCCCC">
              <%
  for i=0 to Ubound(sNums)
  	if Trim(sContent(i))="" then exit for
  %>
              <tr> 
                <td align="right"> <div align="left"><font color="#cc0000"></font> 
                    <table width="539" border="0" cellpadding="0" cellspacing="0" background="<%=Cl.WebDir%>images/dc/BG2.GIF">
                      <tr> 
                        <td height="23"><font color="#cc0000">&nbsp;</font>&nbsp;选项:<strong><%=sContent(i)%></strong></td>
                      </tr>
                    </table>
                  </div></td>
              </tr>
              <tr> 
                <td><table border=0 cellspacing="0" cellpadding="0" height="30">
                    <tr> 
                      <td height="11" valign="top">&nbsp;&nbsp; 得票率:<img src="images/dc/left.gif" width="4" height="21" border="0" align="top"><img src="images/dc/greenbar.gif" width="1" height="21" align="top"><%
		dim perVote
		if totalVote=0 then
			perVote=0
		else
			perVote=round(sNums(i)/totalVote,4)
		end if
		response.write "<img src='images/dc/greenbar.gif' width='" & int(360*pervote) & "' height='21' align='absmiddle'>"%></td><td valign="top"><img src="images/dc/mid.gif" width="6" height="21" align="top"><%
		response.write "<img src='images/dc/whitebar.gif' width='" & 360-int(360*pervote) & "' height='21' align='absmiddle'>"
		%><img src="images/dc/right.gif" width="6" height="21" border="0" align="top"></td></tr>
                    <tr><td></td>
                      <td height="19">占:<%=perVote*100 & "%"%>
                        [得:<font color="#ff0000"><%=sNums(i)%></font>票]</td></tr></table>
                </td>
              </tr>
              <% next %>
            </table></td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr> 
    <td valign="top"> 
      <table width="100%" border="0" cellpadding="1" cellspacing="4" bgcolor="#FFFFFF" class="border">
        <tr> 
          <td width="10%">&nbsp; </td>
          <td width="90%">
            <%
if Action="Show" and Voted=False then
		Dim sType
	    response.Write "<br /><strong>您还没有投票,请您在此投下您宝贵的一票!</strong>"
		response.write "<form name='VoteForm' method='post' action='vote.asp'>"
		response.write "&nbsp;" & rsVote("Title") & "<br />"
		if rsVote("Type")=0 then
			sType="radio"
		else
			sType="checkbox"
		end if
		for i=0 to Ubound(sConTent)
			if Trim(sConTent(i))="" then exit for
			response.Write "<input type='"&sType&"' name='VoteOption' value='"&i&"' style='border:0'>" & sConTent(i) & "<br />"
		next
		response.write "<br /><input name='VoteType' type='hidden'value='" & rsVote("Type") & "'>"
		response.write "<input name='Action' type='hidden' value='Vote'>"
		response.write "<input name='ID' type='hidden' value='" & rsVote("ID") & "'>"
		response.write "&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:VoteForm.submit();'><img src='" & Cl.WebDir & "images/voteSubmit.gif' width='52' height='18' border='0'></a>&nbsp;&nbsp;"
        response.write "<a href='Vote.asp?ID=" & rsVote("ID") & "&Action=Show' target='_blank'><img src='" & Cl.WebDir & "images/voteView.gif' width='52' height='18' border='0'></a>"
		response.write "</form>"
end if

if VotedID<>"" then
	sqlVote="Select ID,title from Cl_Vote Where ID Not In (" & VotedID & ") order by ID desc"
else
	sqlVote="select * from Cl_Vote where ID<>" & ID
end if
Set rsVote = Cl.Execute(sqlVote)
if rsVote.bof and rsVote.eof then
	response.write "<br />感谢您参加了本站的所有调查!!!"
else
	response.write "<br />欢迎你继续参加本站的其他调查:<br /><br />"
	do while not rsVote.eof
		response.write "<li><a href='Vote.asp?ID=" & rsVote("ID") & "'>" & rsVote("Title") & "</a></li>"
		rsVote.movenext
	loop
end if
%>
          </td>
        </tr>
      </table> </td>
  </tr>
  <tr>
    <td valign="top"> 
      <div align="center">【<a href="javascript:window.close();">关闭窗口</a>】</div></td>
  </tr>
</table>
</BODY>
</HTML>
<%
Set rsVote = Nothing
End Sub

Sub UpdateVote()
	Dim TempNums,TempID,TempData,totalNums,sVOption
	Set rsVote=Server.CreateObject("adodb.RecordSet")
	OpenConn : rsVote.Open "Select ID,Nums,totalNums from Cl_Vote Where ID=" & ID,Conn,1,3
	if rsVote.bof and rsVote.Eof then
		Call Cl.OutErr(0,"查数据库中无此调查,可能已被管理员删除!")
	end if
	TempNums=rsVote("Nums")
	TempNums=Split(TempNums,"@")
	sVOption=VoteOption
	if instr(sVOption,",")>0 then
		sVOption=split(sVOption,",")
		for i=0 to ubound(sVOption)
			TempID=sVOption(i)
			TempNums(TempID)=Clng(TempNums(TempID))+1
		next
	else
		TempNums(sVOption)=Clng(TempNums(sVOption))+1
	end if 
	For i=0 to ubound(TempNums)
		if i=0 then
			TempData=TempNums(i)
			totalNums=Clng(TempNums(i))
		else
			TempData=TempData&"@"&TempNums(i)
			totalNums=totalNums+Clng(TempNums(i))
		end if
	next
	rsVote("Nums")=TempData
	rsVote("totalNums")=totalNums
	rsVote.Update
	rsVote.Close:Set rsVote=Nothing
	if VotedID="" then
		session("VotedID")=ID
	else
		session("VotedID")=VotedID & "," & ID
	end if
end Sub
%>
<%
'<!--
'┌───────────────────────────────────────────────────────┐
'│														 │
'│		CreateLive CMS Version 4.0						 │
'│        				Powered by Aspoo.CN	 	 │
'│ 		          						 │
'│ 	邮箱: support@aspoo.cn		Info@aspoo.cn  	 │
'│		QQ: 3315263				596197794			 │
'│		网站: www.aspoo.cn			www.aspoo.com		 │
'│		论坛: bbs.aspoo.cn			bbs.aspoo.com		 │
'│														 │
'│	Copyright (C) 2005-2007 Aspoo.CN All Rights Reserved.	 │
'└───────────────────────────────────────────────────────┘
'-->
%>

⌨️ 快捷键说明

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