簡單asp投票系統源碼

來源:互聯網
上載者:User

本文章 一款簡單asp教程投票系統源碼,同時可以判斷使用者是否是當天第一次投票,如果不是就提示感謝您的支援,您已經投過票了,謝謝,否則就增加投票資料,並且把使用者的ip地址儲存到cookies裡面,這樣可以判斷使用者是否投票了。

<%dim options,total,sql,i,answer
if request.querystring("stype")="" then
 if request.servervariables("remote_addr")=request.cookies("ipaddress") then
  response.write"<script language=網頁特效>alert('感謝您的支援,您已經投過票了,謝謝!');"
  response.write"javascript:window.close();</script>"
 else
  options=request.form("options")
  response.cookies("ipaddress")=request.servervariables("remote_addr")
  conn.execute("update vote set answer"&options&"=answer"&options&"+1 where ischecked=1")
 end if
end if
%><head><title>投票結果</title>
<link href=images/css教程.css rel=stylesheet>
</head>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
      <td height="29">
        <table width=170 height="20" align="center" cellpadding=0 cellspacing=0>
          <tr>
            <td width=5>&nbsp;</td>
            <td width=28>
              <div align="center"></div>
            </td>
            <td class=hg12 valign=bottom width="123">&nbsp;<font color="#000000"><b>投票結果</b></font></td>
            <td width=12>&nbsp;</td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="29">
      <table border="0" cellpadding="0" cellspacing="0" width="95%" height="48" style="border-collaps教程e: collapse" align="center">
        <%
total=0
set rs=server.createobject("adodb.recordset")
sql="select * from vote where ischecked=1"
rs.open sql,conn,3,3
%>
        <tr>
          <td height="48" valign="top" colspan="3" align=left><font color="#000000"><br>
            ==================www.111cn.net=======================<br>
          </font> <font color="#000073"> <%=rs("title")%></font> </td>
        </tr>
        <tr>
          <td valign="top">序號</td>
          <td valign="top">百比分</td>
          <td valign="top">人數</td>
        </tr>
        <%
for i=1 to 8
 if rs("select"&i)<>"" then
  total=total+rs("answer"&i)
 end if
next
%>
        <%for i=1 to 8
 if rs("select"&i)<>"" then
  if total=0 then
   answer=0
  else
   answer=(rs("answer"&i)/total)*100
  end if
%>
        <tr>
          <td valign="top"><%=i%>.<%=rs("select"&i)%>:</td>
          <td valign="top"><img src=images/rscount.gif width=<%=int(answer*2)%> height=8>
            <%=round(answer,3)%>%</td>
          <td valign="top"><%=rs("answer"&i)%>人</td>
          <%
 end if
next
%>
        <tr>
          <td colspan="3"> 共有【<%=total%>】人蔘加投票<br>
            =======================================================</td>
        </tr>
      </table>
      <div align="center"></div>
      <p align="center">【<a href="javascript:window.close()">關閉視窗</a>】
        <% rs.close    
set rs=nothing    
conn.close    
set conn=nothing %>
    </td>
  </tr>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="23">
      <div align="center"></div>
      </td>
  </tr>
</table>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.