<%@language=vbscript codepage=936 %> <% option explicit response.buffer=true Const PurviewLevel=2 '操作权限 Const CheckChannelID=0 '所属频道,0为不检测所属频道 Const PurviewLevel_Others="Vote" %> <% dim sql,rs,strFileName,i dim Action,Channel,FoundErr,ErrMsg Action=Trim(Request("Action")) Channel=Trim(Request("Channel")) if Channel="" then Channel=0 else Channel=CLng(Channel) end if strFileName="admin_Vote.asp?Channel="&Channel %> 调查管理
网 站 调 查 管 理
管理导航: 添加新调查 | 所有频道调查 | 网站首页调查 | 文章频道调查 | 软件频道调查 | 图片频道调查 | 留言频道调查 |
<% if Action="Add" then call AddVote() elseif Action="SaveAdd" then call SaveAdd() elseif Action="Modify" then call Modify() elseif Action="SaveModify" then call SaveModify() elseif Action="Set" then call SetNew() elseif Action="Del" then call DelVote() else call main() end if if FoundErr=True then call WriteErrMsg() end if call CloseConn() sub main() sql="select * from Vote" sql=sql & " where ChannelID=" & Channel sql=sql & " order by id desc" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 %>
> <% response.write "您现在的位置:网站调查管理 >> " select case Channel case 0 response.write "所有频道调查" case 1 response.write "网站首页调查" case 2 response.write "文章频道调查" case 3 response.write "软件频道调查" case 4 response.write "图片频道调查" case 5 response.write "留言频道调查" case else response.write "错误的参数" end select response.write "
" %> <% if not (rs.bof and rs.eof) then do while not rs.eof %> <% rs.movenext loop %> <% end if %>
选择 ID 主题 最新调查 操作
<%if rs("IsSelected")=true then%> checked<%end if%> name="ID"> <%=rs("ID")%> <%=rs("Title")%> <%if rs("IsSelected")=true then response.write "" end if%> <% response.write "修改  " response.write "删除" %>
<% rs.close set rs=nothing end sub sub AddVote() %>
> <% for i=1 to 8%> <%next%>
添 加 调 查
主题:
选项<%=i%>: 票数:
调查类型:
所属频道: 全部   首页   文章   软件   图片   留言 
  设为最新调查
 
<% end sub sub Modify() dim ID ID=Trim(Request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定调查IP
  • " exit sub else ID=Clng(ID) end if sql="select * from Vote where ID="& ID Set rs= Server.CreateObject("ADODB.Recordset") rs.open sql,conn,1,1 if rs.bof and rs.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的调查!
  • " rs.close set rs=nothing exit sub end if %>
    <% for i=1 to 8%> <%next%>
    修 改 调 查
    主题:
    选项<%=i%>: " size="36"> 票数: " size="5">
    调查类型:
    所属频道: > 全部   > 首页   > 文章   > 软件   > 图片   > 留言 
      > 设为最新调查
    ">
    <% rs.close set rs=nothing end sub %> <% sub SaveAdd() dim Title,VoteTime,Action,IsSelected,ChannelID,i Title=trim(request.form("Title")) VoteTime=trim(request.form("VoteTime")) if VoteTime="" then VoteTime=now() IsSelected=trim(request("IsSelected")) ChannelID=Clng(request("ChannelID")) sql="select top 1 * from Vote" Set rs= Server.CreateObject("ADODB.Recordset") rs.open sql,conn,1,3 rs.addnew rs("Title")=Title for i=1 to 8 if trim(request("select"&i))<>"" then rs("select"&i)=trim(request("select"&i)) if request("answer"&i)="" then rs("answer"&i)=0 else rs("answer"&i)=clng(request("answer"&i)) end if end if next rs("VoteTime")=VoteTime rs("VoteType")=request("VoteType") if IsSelected="" then IsSelected=false if IsSelected="True" then conn.execute "Update Vote set IsSelected=False where IsSelected=True and ChannelID=" & ChannelID & "" rs("IsSelected")=IsSelected rs("ChannelID")=ChannelID rs.update rs.close set rs=nothing call CloseConn() Response.Redirect "admin_Vote.asp?Channel="&ChannelID end sub sub SaveModify() dim ID,Title,VoteTime,IsSelected,ChannelID ID=Trim(Request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定调查IP
  • " exit sub else ID=Clng(ID) end if Title=trim(request.form("Title")) VoteTime=trim(request.form("VoteTime")) if VoteTime="" then VoteTime=now() ChannelID=Clng(request("ChannelID")) IsSelected=trim(request("IsSelected")) if IsSelected="True" then conn.execute "Update Vote set IsSelected=False where IsSelected=True and ChannelID=" & ChannelID & "" end if sql="select * from Vote where ID="& ID Set rs= Server.CreateObject("ADODB.Recordset") rs.open sql,conn,1,3 if rs.bof and rs.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的调查!
  • " rs.close set rs=nothing exit sub end if rs("Title")=Title for i=1 to 8 if trim(request("select"&i))<>"" then rs("select"&i)=trim(request("select"&i)) if request("answer"&i)="" then rs("answer"&i)=0 else rs("answer"&i)=clng(request("answer"&i)) end if else rs("select"&i)="" rs("answer"&i)=0 end if next rs("VoteTime")=VoteTime rs("VoteType")=request("VoteType") if IsSelected="" then IsSelected=false rs("IsSelected")=IsSelected rs("ChannelID")=ChannelID rs.update rs.close set rs=nothing call CloseConn() Response.Redirect "admin_Vote.asp?Channel="&ChannelID end sub sub SetNew() dim ID ID=Trim(Request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定调查IP
  • " exit sub else ID=Clng(ID) end if conn.execute "Update Vote set IsSelected=False where IsSelected=True and ChannelID=" & Channel & "" conn.execute "Update Vote set IsSelected=True Where ID=" & ID response.Write "" call main() end sub sub DelVote() dim ID ID=Trim(Request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定调查IP
  • " exit sub else ID=Clng(ID) end if conn.Execute "delete from Vote where ID=" & ID Response.Redirect strFileName end sub %>