<!--#include file="conn1.asp" -->
<%
if (ChkPost()=false)then
		Session.Contents.Remove("name")
		Session.Contents.Remove("pass")
		Response.Redirect "login.asp"
		Response.end
End if
name=Session("name")
pass=Session("pass")
if(validpersonal(name,pass)=false)then
	Session.Contents.Remove("name")
	Session.Contents.Remove("pass")
	Response.Redirect "login.asp"
	Response.end
end if

If(Request.ServerVariables("REQUEST_METHOD")="POST") Then
	ballottop=request.form("ballottop")
	mymode=request.form("mymode")
	ballot1=request.form("ballot1")
	ballot2=request.form("ballot2")
	ballot3=request.form("ballot3")
	ballot4=request.form("ballot4")
	ballot5=request.form("ballot5")
	hit1=request.form("hit1")
	hit2=request.form("hit2")
	hit3=request.form("hit3")
	hit4=request.form("hit4")
	hit5=request.form("hit5")
	ballot=Array(ballot1,ballot2,ballot3,ballot4,ballot5)
	hit=Array(hit1,hit2,hit3,hit4,hit5)
	If(ballottop="") Then
		sm=sm &"请填写投票主题\n"
	End if
	If(sm="") Then
		sql="delete from ballot"
			set rs=conn.execute(sql)
		sql="delete from ballottop"
			set rs=conn.execute(sql)
		For i=0 to 4
			If(ballot(i)<>"") Then
				sql="insert into ballot(ballot,hit) values('"& strSql(ballot(i)) &"',"& inthit(hit(i)) &")"
					set rs=conn.execute(sql)			
			End if
		next
			sql="insert into ballottop(ballottop,mymode) values('"& strSql(ballottop) &"',"& mymode &")"
					set rs=conn.execute(sql)
		sm=sm &"投票修改成功\n"
	End if
	If(sm<>"") Then
		Response.Write "<SCRIPT language=JavaScript>"
		Response.Write "alert('"& sm &"');"
		Response.Write "</SCRIPT>"
	End if
End if
	sql="select ballottop,mymode from ballottop"
		set rs=server.createobject("adodb.recordset")
			rs.open sql,conn,3,2
	ballottop=rs("ballottop")
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>flashballot1.0</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#666666" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="760" height="450" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#f2f2f2" class="zw">
      <tr>
        <td height="18" align="center" bgcolor="#99CC00"><strong><font color="#999900">|</font><a href="editpass.asp"><font color="#FFFFFF">修改密码</font></a><font color="#999900">|</font><a href="editballot.asp"><font color="#FFFFFF">修改投票内容</font></a><font color="#999900">|</font><a href="logout.asp"><font color="#FFFFFF">退出</font></a><font color="#999900">|</font></strong></td>
      </tr>
      <tr>
        <td valign="top" bgcolor="#FFFFFF"><br>
          <br>
          <br>
          <br>
          <br>
          <form name="form1" method="post">
          <table width="60%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FF9900" class="zw">
            <tr>
              <td height="20" align="center" bgcolor="#FFCC00"><strong><font color="#FFFFFF">修改投票内容</font></strong></td>
            </tr>
            <tr>
              <td bgcolor="#FFFFFF"><table width="100%"  border="0" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF" class="zw">
                  <tr bgcolor="#FFFFFF">
                    <td width="16%">投票主题:
                      <input name="ballottop" type="text" class="kuan1" size="25" value="<%=strtext(ballottop)%>">
                      是否支持多选:
		      <%if mymode=0 then%>
                      是
                      <input name="mymode" type="radio" value="-1">
                      否
                      <input type="radio" name="mymode" value="0" checked>
		       <%else%>
		       是
                      <input name="mymode" type="radio" value="-1" checked>
                      否
                      <input type="radio" name="mymode" value="0">
		        <%end if%>
		      </td>
                    </tr>
<%
sql="select * from ballot"
	set rs=server.createobject("adodb.recordset")
		rs.open sql,conn,3,2
For i=1 to rs.recordcount
%>
                  <tr bgcolor="#FFFFFF">
                    <td>投票项目<%=i%>:
                      <input name="ballot<%=i%>" type="text" class="kuan1" id="name23" size="25" value="<%=strtext(rs("ballot"))%>">
			投票值<%=i%>:
			<input name="hit<%=i%>" type="text" class="kuan1" id="name226" size="5" value="<%=rs("hit")%>"></td>
					    </tr>
<%
rs.movenext
Next
Do While(i<=5)
%>
		<tr bgcolor="#FFFFFF">
                    <td>投票项目<%=i%>:
                      <input name="ballot<%=i%>" type="text" class="kuan1" id="name32" size="25">
			投票值<%=i%>:
			<input name="hit<%=i%>" type="text" class="kuan1" id="name2222" size="5"></td>
                    </tr>
<%
i=i+1
loop
%>
              </table></td>
            </tr>
            <tr>
              <td height="25" align="center" bgcolor="#FFFFFF"><input name="Submit" type="submit" class="an1" value=" 修 改 "></td>
            </tr>
          </table>
        </form></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#FFFFFF"> 711设计网 版权所有: <a href="http://www.tc711.com"><font color="#999999">www.tc711.com </font></a>作者：阿建
          QQ：<font color="#666666">26757434</font> E-mail: <a href="mailto:tc711@tc711.com"><font color="#666666">tc711@tc711.com </font></a> </td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<%
set rs=nothing
set conn=nothing
%>