一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

简单asp投票系统源码

时间:2010-11-01 编辑:简简单单 来源:一聚教程网

本文章 一款简单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""
 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
%>投票结果
css教程.css rel=stylesheet>


   
     
   
 

       
         
           
           
           
           
         
       
 
             

           
 投票结果 

     


 
   
 

      ps教程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
%>
       
         
       
       
         
         
         
       
        <%
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
%>
       
         
         
         
          <%
 end if
next
%>
       
         
       
     


            ==================www.111com.net=======================

         
<%=rs("title")%>
序号百比分人数
<%=i%>.<%=rs("select"&i)%>: height=8>
            <%=round(answer,3)%>%
<%=rs("answer"&i)%>人
共有【<%=total%>】人参加投票

            =======================================================

     

     

关闭窗口
        <% rs.close    
set rs=nothing    
conn.close    
set conn=nothing %>
   



 
   
 

     

     

热门栏目