<!--#INCLUDE FILE="conn.asp" -->
<!--#include file="admin_Checkuser.asp"-->
<HTML><HEAD><title><%=StrVar(1)%>--管理页面</title>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<!--#include file="inc/admin_main.css"-->
</HEAD>
<BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<%
if  not sysadmin or session("adminlogin")<>"0K" Then
	Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用，请<a href=admin_index.asp target=_top>登陆</a>后进入。"
	Call Error("Information",ErrMsg)
else
%>
<table cellpadding=5 cellspacing=1 border=0 width=90% Class=TableBorder align=center>
  <tr>
        <th>欢迎<b><%=membername%></b>进入管理中心</th>
        </tr>
	</table>
<br>
<%
call main()
end if
Call endconnection()
sub main()
%>
<table cellpadding="3" cellspacing="1" border="0" class="tableBorder" align=center>
  <tr> 
    <th class="tableHeaderText" height=25>投票管理</th>
  <tr> 
    <td class="bodytitle" height=23><div align="center">
	<a href="admin_vote.asp?action=add">增加投票</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="admin_vote.asp">管理投票</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="admin_vote.asp?action=daima">调用代码</a></div></td>
  </tr>
  <tr> 
    <td height=11 class="forumRow">
<%select case request("action")
case "add"
call add()
case "save"
call savev()
case "dama"
call daima()
case "edit"
call edit()
case else
call list()
end select%></td>
  </tr>
</table>
<%end sub
sub add()
dim count
count=int(request("count"))
if count=null or count=empty then
count=4
end if
%>
<form method="POST" action="?action=save" name="form1">
          <div align="center">
            
    <table border="0" width="70%" cellspacing="0" cellpadding="0" height="240" style="border-collapse: collapse">
      <tr>
                <td width="100%" colspan="2" height="18"></td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="36">选择项个数：<input type="text" name="count" size="6" onchange="location.href='?action=add&count='+form1.count.value;" value="<%=count%>">&nbsp;   
                <input type="button" value="确 定" name="B3"></td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="36">标题：<input type="text" name="title" size="38"></td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="30">方式：<input type="radio" value="radio" name="style" checked>单选&nbsp;      
                  <input type="radio" value="checkbox" name="style">多选</td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="30">状态：<input type="radio" name="kg" value="0" checked>开&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="kg" value="1">关</td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="30">结束时间：<select size="1" name="years">
                <option value="0" selected>0</option>
                <option value="2005">2005</option>
                <option value="2006">2006</option>
				<option value="2007">2003</option>
                <option value="2008">2004</option>
                </select>年<select size="1" name="months">
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
                <option value="6">6</option>
                <option value="7">7</option>
                <option value="8">8</option>
                <option value="9">9</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
                </select>月<select size="1" name="days">
                <%for i=1 to 31
                response.write "<option value='"&i&"'>"&i&"</option>"
                next%>
                </select>日&nbsp;&nbsp;&nbsp;    
                <select size="1" name="hours">
                <option value="0">0</option>
                <%for i=1 to 23
                response.write "<option value='"&i&"'>"&i&"</option>"
                next%>
                </select>：<select size="1" name="minutes">
                <option value="00">00</option>
                <%for i=1 to 59
                if i<10 then
                response.write "<option value='0"&i&"'>0"&i&"</option>"
                else
                response.write "<option value='"&i&"'>"&i&"</option>"
                end if
                next%>
                </select>：<select size="1" name="seconds">
                <option value="00">00</option>
                <%for i=1 to 59
                if i<10 then
                response.write "<option value='0"&i&"'>0"&i&"</option>"
                else
                response.write "<option value='"&i&"'>"&i&"</option>"
                end if
                next%>
                </select></td>   
              </tr>
              <%for i=1 to count%>
              <tr>
                <td width="56%" height="30">选择<%=i%>：
          <input type="text" name="xg" size="25"></td>
                <td width="44%" height="30">条行柱颜色：<select name="color" style="font-size:12px" size="1">
                    <option style="background-color:red;color:red" value="red" selected>默认</option>
                    <option style="background-color:000000;color:000000" value="000000">黑色</option>
                    <option style="background-color:0088FF;color:0088FF" value="0088FF">海蓝</option>
                    <option style="background-color:0000FF;color:0000FF" value="0000FF">亮蓝</option>
                    <option style="background-color:000088;color:000088" value="000088">深蓝</option>
                    <option style="background-color:888800;color:888800" value="888800">黄绿</option>
                    <option style="background-color:008888;color:008888" value="008888">蓝绿</option>
                    <option style="background-color:008800;color:008800" value="008800">橄榄</option>
                    <option style="background-color:8888FF;color:8888FF" value="8888FF">淡紫</option>
                    <option style="background-color:AA00CC;color:AA00CC" value="AA00CC">紫色</option>
                    <option style="background-color:8800FF;color:8800FF" value="8800FF">蓝紫</option>
                    <option style="background-color:888888;color:888888" value="888888">灰色</option>
                    <option style="background-color:CCAA00;color:CCAA00" value="CCAA00">土黄</option>
                    <option style="background-color:FF8800;color:FF8800" value="FF8800">金黄</option>
                    <option style="background-color:CC3366;color:CC3366" value="CC3366">暗红</option>
                    <option style="background-color:FF00FF;color:FF00FF" value="FF00FF">紫红</option>
                    <option style="background-color:3366CC;color:3366CC" value="3366CC">蓝黑</option>
                  </select></td>
              </tr>
              <%next%>
            </table>
          </div>
          <p align="center"><input type="submit" value="提交" name="B1">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="取消" name="B2" ></p>
        </form>
		<p align="center"><font color="#FF0000">注意：结束时间的</font><font color="#0000FF">年份</font><font color="#FF0000">如果为</font><font color="#0000FF">0</font><font color="#FF0000">，则表示不限定投票结束时间。</font></p>
		<%
end sub
sub savev()
dim err,title,a,error,kg,overtime,rs,sql,classid
if request("id")<>"del" then
err=0
title=request("title")
if title="" then
err=1
error=error+"标题不能为空\n"
end if
a=0
for i=1 to request("xg").count
if request("xg")(i)="" then
exit for
end if
a=a+1
next
if a=0 then
err=1
error=error+"选择内容不能为空\n"
end if
if err=1 then
response.write "<script>alert('"&error&"');</script>"
response.write "<script>history.back(1);</script>"
response.end
end if

kg=int(request.form("kg"))
overtime=request("years")&"-"&request("months")&"-"&request("days")&" "&request("hours")&":"&request("minutes")&":"&request("seconds")
end if

if request("id")="xg" then
conn.execute("update voteclass set title='"&title&"',style='"&request("style")&"',kg="&kg&",overtime='"&overtime&"' where id="&request("classid"))
for i=1 to request("yc").count
if request("xg")(i)<>"" then
conn.execute("update [vote] set vote='"&request("xg")(i)&"',color='"&request("color")(i)&"' where id="&request("yc")(i))
elseif request("xg")(i)="" then
conn.execute("delete from [vote] where id="&request("yc")(i))
end if
next
for i=1 to request("xz").count
if request("xz")(i)<>"" then
conn.execute("insert into vote (vote,color,class) values ('"&request("xz")(i)&"','"&request("color")(i)&"',"&request("classid")&")")
end if
next
response.write "<script>alert('修改投票成功');</script>"
response.write "<script>location.href='admin_vote.asp';</script>"
elseif request("id")="del" then
conn.execute("delete from vote where class="&request("classid"))
conn.execute("delete from voteclass where id="&request("classid"))
response.write "<script>alert('删除投票成功');</script>"
response.write "<script>location.href='admin_vote.asp';</script>"
else
conn.execute("insert into voteclass (title,style,ren,kg,overtime) values ('"&title&"','"&request("style")&"','"&membername&"',"&kg&",'"&overtime&"')")
set rs=server.createobject("adodb.recordset")
sql="select top 1 * from voteclass where title='"&title&"' order by id desc"
rs.open sql,conn,3,1
classid=rs("id")
rs.close
set rs=nothing
for i=1 to request("xg").count
if request("xg")(i)<>"" then
conn.execute("insert into vote (vote,color,class) values ('"&request("xg")(i)&"','"&request("color")(i)&"',"&classid&")")
else
exit for
end if
next
response.write "<script>alert('添加投票成功');</script>"
response.write "<script>location.href='admin_vote.asp';</script>"
end if
end sub


sub list()
dim addr00,addr10,addr000
dim rs,sql,pagecount,page,totalpage
dim i,addr0,addr1,addr
addr00=request.servervariables("server_name")
addr10=request.servervariables("url")
addr10=replace(addr10,"admin/admin_vote.asp","")
addr000="http://"&addr00&addr10
'response.write addr000
set rs=server.createobject("adodb.recordset")
sql="select * from voteclass order by id desc"
rs.open sql,conn,3,1
count=int(request("id"))
if count<=0 then
count=30
end if
if not rs.eof then
rs.pagesize=count
pagecount=rs.pagecount
if request("id")="" then
page=1
else
page=int(request("id"))
end if
if page>=rs.pagecount then
page=rs.pagecount
elseif page<=1 then
page=1
end if
rs.absolutepage=page
else
pagecount=1
page=1
end if
i=1
addr0=request.servervariables("server_name")
addr1=request.servervariables("url")
addr="http://"&addr0&addr1
%>
<table width="90%" height="22" border="0" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
  <tr> 
              
    <td width="11%" height="20"> 
      <p align="center">ID</td>
              
    <td width="62%" height="20"> 
      <p align="center">标题</td>
              
    <td width="27%" height="20"> 
      <p align="center">管理</td>
            </tr>
          </table><%do while not rs.eof and i<=count%>
		
<table width="90%" height="22" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
              
    <td width="11%" height="20"> 
      <p align="center"><%=rs("id")%></td>
              
    <td width="62%" height="20"> 
      <p align="center"><a href="../Class_voteshow.asp?classid=<%=rs("id")%>" target="_blank"><%=rs("title")%></a></td>
              
    <td width="27%" height="20"> 
      <p align="center"><a href="admin_vote.asp?action=edit&id=<%=rs("id")%>&style=<%=rs("style")%>">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <a href="admin_vote.asp?action=save&id=del&classid=<%=rs("id")%>">删除</a></td>
            </tr>
          </table> <%if k=count then 
exit do
end if
rs.movenext
loop%> <form method='GET' action='<%=addr%>'>
        <p align='center'> 
          <% if page>1 then %>
          <a href='<%=addr%>?<%=(page-1)%>'>&lt;&lt;上一页</a>&nbsp;&nbsp; 
          <%end if%>
          <% if int(page) < int(totalpage) then %>
          <a href='<%=addr%>?<%=(page+1)%>'>下一页&gt;&gt;</a> 
          <% end if %>
          【共<font color=red><%=totalpage%></font>页】【第<font color=red><%=page%></font>页】跳转到 
          <input style='border-style: solid; border-width: 1' type='text' name='id' size='3'>
          页 
          <input type='submit' value='GO' style='border-style: solid; border-width: 1' name='B1'>
      </form><p align="center"><br>
        对于单个投票的调用代码说明：<br><br>
        &lt;script language="javascript" src=&quot;<%=addr000%>Class_votedy.asp?<font color="#FF0000">id=5</font>&quot;&gt;&lt;/script&gt;</p>
      <p align="center">请把这里的<font color="#FF0000">id=5</font>的<font color="#FF0000">5</font>改成相应投票的ID就可以了<br>
        <br>
        <br>
      </p>
<%end sub%>
<%sub edit()
dim rs,sql,title,kg,overtime,months,days,hours,minutes,seconds
dim dscount,style,i
set rs=server.createobject("adodb.recordset")
set rs=conn.execute("select title,kg,overtime from voteclass where id="&request("id"))
title=rs("title")
kg=rs("kg")
overtime=cstr(rs("overtime"))
overtime=formatdatetime(overtime)
years=year(overtime)
months=month(overtime)
days=day(overtime)
hours=hour(overtime)
minutes=minute(overtime)
seconds=second(overtime)
rs.close
sql="select * from vote where class="&request("id")&" order by id"
rs.open sql,conn,3,1
dscount=rs.recordcount
style=request("style")
%>
<form method="POST" action="admin_vote.asp?action=save&id=xg&classid=<%=request("id")%>">
          <div align="center">
            <table border="0" width="70%" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
              <tr>
                <td width="100%" colspan="2" height="18"></td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="36">标题：<input type="text" name="title" size="38" value="<%=title%>"></td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="30">方式：<input type="radio" value="radio" name="style" <%if style="radio" then%>checked<%end if%>>单选&nbsp;     
                  <input type="radio" value="checkbox" name="style" <%if style="checkbox" then%>checked<%end if%>>多选</td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="30">状态：<input type="radio" name="kg" value="0"<%if kg=0 then%> checked<%end if%>>开&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="kg" value="1"<%if kg=1 then%> checked<%end if%>>关</td>
              </tr>
              <tr>
                <td width="100%" colspan="2" height="30">结束时间：<select size="1" name="years">
                <option value="0"<%if cstr(years)="0" then%> selected<%end if%>>0</option>
                <option value="2005"<%if cstr(years)="2005" then%> selected<%end if%>>2005</option>
                <option value="2006"<%if cstr(years)="2006" then%> selected<%end if%>>2006</option>
                <option value="2007"<%if cstr(years)="2007" then%> selected<%end if%>>2007</option>
                <option value="2008"<%if cstr(years)="2008" then%> selected<%end if%>>2008</option>
                </select>年<select size="1" name="months">
                <option value="1"<%if cstr(months)="1" then%> selected<%end if%>>1</option>
                <option value="2"<%if cstr(months)="2" then%> selected<%end if%>>2</option>
                <option value="3"<%if cstr(months)="3" then%> selected<%end if%>>3</option>
                <option value="4"<%if cstr(months)="4" then%> selected<%end if%>>4</option>
                <option value="5"<%if cstr(months)="5" then%> selected<%end if%>>5</option>
                <option value="6"<%if cstr(months)="6" then%> selected<%end if%>>6</option>
                <option value="7"<%if cstr(months)="7" then%> selected<%end if%>>7</option>
                <option value="8"<%if cstr(months)="8" then%> selected<%end if%>>8</option>
                <option value="9"<%if cstr(months)="9" then%> selected<%end if%>>9</option>
                <option value="10"<%if cstr(months)="10" then%> selected<%end if%>>10</option>
                <option value="11"<%if cstr(months)="11" then%> selected<%end if%>>11</option>
                <option value="12"<%if cstr(months)="12" then%> selected<%end if%>>12</option>
                </select>月<select size="1" name="days">
                <%for i=1 to 31
                response.write "<option value='"&i&"'"
                if cstr(days)=cstr(i) then
                response.write " selected"
                end if
                response.write ">"&i&"</option>"
                next%>
                </select>日&nbsp;&nbsp;&nbsp;   
                <select size="1" name="hours">
                <%for i=1 to 23
                response.write "<option value='"&i&"'"
                if cstr(hours)=cstr(i) then
                response.write " selected"
                end if
                response.write ">"&i&"</option>"
                next%>
                </select>：<select size="1" name="minutes">
                <option value="00">00</option>
                <%for i=1 to 59
                if i<10 then
                response.write "<option value='0"&i&"'"
                if cstr(minutes)=cstr(i) then
                response.write " selected"
                end if
                response.write ">0"&i&"</option>"
                else
                response.write "<option value='"&i&"'"
                if cstr(minutes)=cstr(i) then
                response.write " selected"
                end if
                response.write">"&i&"</option>"
                end if
                next%>
                </select>：<select size="1" name="seconds">
                <option value="00">00</option>
                <%for i=1 to 59
                if i<10 then
                response.write "<option value='0"&i&"'"
                if cstr(seconds)=cstr(i) then
                response.write " selected"
                end if
                response.write ">0"&i&"</option>"
                else
                response.write "<option value='"&i&"'"
                if cstr(seconds)=cstr(i) then
                response.write " selected"
                end if
                response.write">"&i&"</option>"
                end if
                next%>
                </select></td>  
              </tr>
			  <%do while not rs.eof
			  %>
              <tr>
                <td width="56%" height="30">选择：<input type="text" name="xg" size="20" value="<%=rs("vote")%>"></td>
                <td width="44%" height="30"><INPUT TYPE="hidden" name="yc" value="<%=rs("id")%>">条行柱颜色：<select name="color" style="font-size:12px" size="1">
                    <option style="background-color:red;color:red" value="red"<%if rs("color")="red" then%> selected<%end if%>>默认</option>
                    <option style="background-color:000000;color:000000" value="000000"<%if rs("color")="000000" then%> selected<%end if%>>黑色</option>
                    <option style="background-color:0088FF;color:0088FF" value="0088FF"<%if rs("color")="0088FF" then%> selected<%end if%>>海蓝</option>
                    <option style="background-color:0000FF;color:0000FF" value="0000FF"<%if rs("color")="0000FF" then%> selected<%end if%>>亮蓝</option>
                    <option style="background-color:000088;color:000088" value="000088"<%if rs("color")="000088" then%> selected<%end if%>>深蓝</option>
                    <option style="background-color:888800;color:888800" value="888800"<%if rs("color")="888800" then%> selected<%end if%>>黄绿</option>
                    <option style="background-color:008888;color:008888" value="008888"<%if rs("color")="008888" then%> selected<%end if%>>蓝绿</option>
                    <option style="background-color:008800;color:008800" value="008800"<%if rs("color")="008800" then%> selected<%end if%>>橄榄</option>
                    <option style="background-color:8888FF;color:8888FF" value="8888FF"<%if rs("color")="8888FF" then%> selected<%end if%>>淡紫</option>
                    <option style="background-color:AA00CC;color:AA00CC" value="AA00CC"<%if rs("color")="AA00CC" then%> selected<%end if%>>紫色</option>
                    <option style="background-color:8800FF;color:8800FF" value="8800FF"<%if rs("color")="8800FF" then%> selected<%end if%>>蓝紫</option>
                    <option style="background-color:888888;color:888888" value="888888"<%if rs("color")="888888" then%> selected<%end if%>>灰色</option>
                    <option style="background-color:CCAA00;color:CCAA00" value="CCAA00"<%if rs("color")="CCAA00" then%> selected<%end if%>>土黄</option>
                    <option style="background-color:FF8800;color:FF8800" value="FF8800"<%if rs("color")="FF8800" then%> selected<%end if%>>金黄</option>
                    <option style="background-color:CC3366;color:CC3366" value="CC3366"<%if rs("color")="CC3366" then%> selected<%end if%>>暗红</option>
                    <option style="background-color:FF00FF;color:FF00FF" value="FF00FF"<%if rs("color")="FF00FF" then%> selected<%end if%>>紫红</option>
                    <option style="background-color:3366CC;color:3366CC" value="3366CC"<%if rs("color")="3366CC" then%> selected<%end if%>>蓝黑</option>
                  </select></td>
              </tr>
			  <%rs.movenext
			  loop
			  for i=1 to 4
			  %>
              <tr>
                <td width="56%" height="30">选择：<input type="text" name="xz" size="20"></td>
                <td width="44%" height="30">条行柱颜色：<select name="color" style="font-size:12px" size="1">
                    <option style="background-color:red;color:red" value="red" selected>默认</option>
                    <option style="background-color:000000;color:000000" value="000000">黑色</option>
                    <option style="background-color:0088FF;color:0088FF" value="0088FF">海蓝</option>
                    <option style="background-color:0000FF;color:0000FF" value="0000FF">亮蓝</option>
                    <option style="background-color:000088;color:000088" value="000088">深蓝</option>
                    <option style="background-color:888800;color:888800" value="888800">黄绿</option>
                    <option style="background-color:008888;color:008888" value="008888">蓝绿</option>
                    <option style="background-color:008800;color:008800" value="008800">橄榄</option>
                    <option style="background-color:8888FF;color:8888FF" value="8888FF">淡紫</option>
                    <option style="background-color:AA00CC;color:AA00CC" value="AA00CC">紫色</option>
                    <option style="background-color:8800FF;color:8800FF" value="8800FF">蓝紫</option>
                    <option style="background-color:888888;color:888888" value="888888">灰色</option>
                    <option style="background-color:CCAA00;color:CCAA00" value="CCAA00">土黄</option>
                    <option style="background-color:FF8800;color:FF8800" value="FF8800">金黄</option>
                    <option style="background-color:CC3366;color:CC3366" value="CC3366">暗红</option>
                    <option style="background-color:FF00FF;color:FF00FF" value="FF00FF">紫红</option>
                    <option style="background-color:3366CC;color:3366CC" value="3366CC">蓝黑</option>
                  </select></td>
              </tr>
			  <%next%>
            </table>
          </div>
          <p align="center"><input type="submit" value="提交" name="B1">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="全部重写" name="B2"></p>
        </form>
		<p align="center"><font color="#FF0000">注意：结束时间的</font><font color="#0000FF">年份</font><font color="#FF0000">如果为</font><font color="#0000FF">0</font><font color="#FF0000">，则表示不限定投票结束时间。</font>
		<%rs.close
		set rs=nothing
		end sub%>
</BODY></HTML>