<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file = "../setup.asp"-->
<!--#include file="conn.asp"-->
<%vid=cint(request("vid"))
action=request("action")
cf=request.form("cf")
kind=request.form("kind")
v=request.form("v")
'response.write (Request.Cookies("vote_num_2")&vid)
if cf="n" and cstr(vid)=Request.Cookies("vote_num_2") then
	response.write "<script>alert('该投票不能重复进行');history.back();</script>"
else
if action="vote" then
	if v="" or vid="" then
	response.write "<script>alert('请选择投票选项');history.back();</script>"
	response.End()

    end if
	select case kind
	case "1" '单选
	conn.execute("update vitem set vcount=vcount+1 where id="&cint(v))
	case "2" '多选
	vv=replace(v," ","")
	vvv=split(vv,",")
	for i= 0 to ubound(vvv)
	conn.execute("update vitem set vcount=vcount+1 where id="&cint(vvv(i))&"")
	next
	end select
	Response.Cookies("vote_num_2").Expires=now()+0.08
	Response.Cookies("vote_num_2")=vid
	'session(idd)=idd
'response.Redirect("?vid="&vid)
response.write "<script>alert('投票成功');window.location.href='toupiao.asp?vid="&vid&"';</script>"
end if
end if
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../img/css.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=site_name%></title>
</head>

<body>
<form name="form1" method="post" action="?action=vote&vid=<%=vid%>">
  <table style="border:1px solid #6699CC" width="641" border="0" align="center" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
    <tr valign="top"> 
      <td height="44" colspan="5" align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td height="46" align="center" bgcolor="#6699CC"> <font color="#FFFFFF"><strong>标题： 
              <%set rsv=server.createobject("ADODB.recordset")
sqlv="select * from vname where id="&cint(vid)
rsv.open sqlv,conn,1,1
 response.Write(rsv("title"))
 %>
              <br>
              </strong>(发起时间： 
              <% response.Write(rsv("vtime")) 
	 %>
              )</font></td>
          </tr>
        </table></td>
    </tr>
    	<%
	set rs=server.createobject("ADODB.recordset")
sql="select * from vitem where vid="&vid
rs.open sql,conn,1,1
	do while not rs.eof
	 %>
<tr> 
      <td height="4" colspan="5"> <table width="98%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td height="4"  background="../img/dline.gif"></td>
          </tr>
        </table></td>
    </tr>
    <tr> 
      <td width="60" height="20">
<%
select case rsv("kind")
case "1" '单选
response.write "<input type='radio' name='v' value='"&rs("id")&"'"
case "2" '多选
response.write "<input type='checkbox' name='v' value='"&rs("id")&"'"
end select
%></td>
      <td>&nbsp;<%=rs("vtitle")%></td>
      <td width="190" align="left"></td>
      <td width="37"></td>
      <td width="80" align="center"></td>
    </tr>
	<%rs.movenext
	loop
	rs.close %>
	
  </table>
  <table width="266" border="0" align="center" cellpadding="2" cellspacing="2">
    <tr>
      <td align="center">&nbsp; <label>
        <input type="submit" name="Submit" value="提交">
        <input type="hidden" name="cf" value="<%=rsv("cf")%>">
        <input type="hidden" name="kind" value="<%=rsv("kind")%>">
        <input name="reset" type="reset" id="reset" value="重置">
      </label> </td>
    </tr>
  </table>
</form>
<% rsv.close
	  set rsv=nothing%>
</body>
</html>
