<!--#include file="conn.asp" -->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');history.go(-1);</script>"
response.End
else
if request.cookies("Buy2Buy")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');history.go(-1);</script>"
response.End
end if
end if
'所有无权限
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('您的管理权限未达到此操作等级!');history.go(-1);</script>"
response.End
end if
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">
<style type="text/css">
<!--
body {
	background-color: #FFFFFF;
}
.STYLE1 {color: #000000;
	font-weight: bold;
}
.style4 {color: #FF0000}
-->
</style>
<link href="../admin/admincss.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE5 {color: #FFFFFF}
-->
</style>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="99%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#7B869A">
  <tr>
    <td height="25" align="center"><span class="STYLE1"><span class="style4 STYLE5">修改投票内容</span></span></td>
  </tr>
  <tr>
    <td height="168" valign="top" bgcolor="#FFFFFF"><form name="form1" method="post">
      <table width="80%"  border="2" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC" class="zw">
        <tr>
          <td height="25" align="center" background="../admin/images/topbg.gif"><strong>修改投票内容</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="input_bot" value=" 修 改 "></td>
        </tr>
      </table>
    </form></td>
  </tr>
</table>
</body>
</html>
<%
set rs=nothing
set conn=nothing
%>