⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_vote.asp

📁 商业网站/图片管理系统/投票系统/新闻管理系统/
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<%
if request.cookies("admin_OK")="" then
	response.redirect("admin_login.html")
end if
%>
<!-- 后台投票管理 -->
<%
dim db
db=0
%>
<!-- #include file="../config/db.asp" -->
<!-- #include file="../config/function.inc.asp" -->
<%
dim rst,sql,myErrors,taction,errstr,tcolor,modifyerr
dim mtitle,mstype,tmstype
set rst=server.createobject("adodb.recordset")

tcolor="#DCDCDC"
sub changecolor()
	if tcolor="#ECECEC" then
		tcolor="#DCDCDC"
	else
		tcolor="#ECECEC"
	end if
	response.write(tcolor)
end sub
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>后台投票管理</title>
<link href="../css/mycss.css" rel="stylesheet" type="text/css" />
</head>
<script language="javascript">
//<!--
//删除提示
//表单核查提示
function checkform()
{
	if (document.frmvote.v_title.value=='')
		{
			alert("请输入投票主题!");
			return false;
		}
	else
		{
			return true;
		}
}
//删除核查提示
function checkdel()
{
	if (confirm("您真的要删除这个投票主题吗?"))
		{
			return true;
		}
	else
		{
			return false;
		}
}
//-->
</script>
<body>
<%
'---------------------处理页面参数--------------
if request.querystring("act")<>"" and request.QueryString("act")<>"modify" then
	if (not isnumeric(request.querystring("v_id")) or isempty(request.querystring("v_id"))) and request.querystring("act")<>"add" then
		msgboxU "非法参数!"
	else
			select case request.querystring("act")
				case "del"'删除投票
					sql="delete from shop_vote where v_id="&request.querystring("v_id")&" or v_upid="&request.querystring("v_id")
					conn.execute sql
					errstr="删除投票"
				
				case "add"'新建投票
					if trim(request.form("v_title"))="" then'新建投票
						msgboxU "没有输入投票,新建投票失败!"
					else
						sql="select top 1 * from shop_vote"
						rst.open sql,conn,1,3
						rst.addnew
						rst("v_title")=request.form("v_title")
						rst("v_type")=true
						if request.form("v_stype")="true" then
							rst("v_stype")=true'多选
						else
							rst("v_stype")=false'单选
						end if
						rst.update
						rst.close
						errstr="新建投票"
					end if
				
				case "update"'修改投票
					sql="select * from shop_vote where v_type=true and v_id="&request.querystring("v_id")
					rst.open sql,conn,1,3
					if rst.eof and rst.bof then
						msgboxU "非法参数,或此投票已经被删除!"
					else
						rst("v_title")=request.form("v_title")
						if request.form("v_stype")="true" then
							rst("v_stype")=true
						else
							rst("v_stype")=false
						end if
						rst.update
						rst.close
						errstr="修改投票"
					end if
					
				case "changeshowflag"'修改投票是否在前台显示
					sql="update shop_vote set v_show=not v_show where v_type=true and v_id="&request.QueryString("v_id")
					conn.execute sql
					sql="update shop_vote set v_show=false where v_type=true and v_id<>"&request.QueryString("v_id")
					conn.execute sql
					errstr="修改投票是否在前台显示"
				end select
				'----------------错误描述------------------
				set myErrors=conn.errors
				if myErrors.count=0 then
					msgboxU errstr&",成功!"
				else
					msgboxU errstr&",失败!原因:"&myErrors.item(0).description
				end if
	end if
end if
%>
	<div align="center">
	  <p>网站投票管理</p>
	  <p><br />
		<a href="admin_vote.asp">建立新投票</a></p>
	  <table width="754" height="81" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
		<tr>
		  <td width="52" height="44" bgcolor="#DCDCDC">ID</td>
		  <td width="320" bgcolor="#DCDCDC">投票主题</td>
		  <td width="60" bgcolor="#DCDCDC">类型</td>
		  <td width="312" bgcolor="#DCDCDC">操作</td>
		</tr>
	<%
	sql="select * from shop_vote where v_type=true"
	rst.open sql,conn,1,1
	if rst.eof and rst.bof then
	%>
		<tr>
		  <td height="15" colspan="4" align="center">没有建立任何投票</td>
		</tr>
	<%
	else
		while not rst.eof
	%>
		<tr bgcolor=<% changecolor %>>
		  <td><%=rst("v_id")%></td>
		  <td><%=rst("v_title")%></td>
		  <td><% 
				if rst("v_stype") then
					response.write "<input name='checkbox' type='checkbox' value='checkbox' checked='checked' />多选"
				else	
					response.Write "<input name='radiobutton' type='radio' value='radiobutton' checked='checked' />单选"
				end if
			  %>	
		  </td>
		  <td><input type="submit" name="Submit2" value="<% if rst("v_show") then 
			response.Write("取消显示")
		  else
			response.write("显示")
		  end if
		  %>" onclick="javascript:location='admin_vote.asp?act=changeshowflag&v_id=<%=rst("v_id")%>';" /> 
			<a href="admin_vote.asp?act=modify&v_id=<%=rst("v_id")%>">修改</a> 察看 投标情况 <a href="admin_voteedit.asp?v_id=<%=rst("v_id")%>" target="_blank">编辑内容</a> <a href="admin_vote.asp?act=del&v_id=<%=rst("v_id")%>" onclick="javascript:return checkdel();">删除</a></td>
		</tr>
	<%
			rst.movenext
		wend
		rst.close
	end if
	%>
	  </table>
	<%
	taction="admin_vote.asp?act=add"
	if request.querystring("act")="modify" then
		modifyerr=false
		if not isnumeric(request.querystring("v_id")) or isempty("v_id") then
			msgboxU "非法参数"
			modifyerr=true
		else
			taction="admin_vote.asp?act=update&v_id="&request.querystring("v_id")
			sql="select * from shop_vote where v_id="&request.querystring("v_id")
			rst.open sql,conn,1,1
			if rst.eof and rst.bof then
				modifyerr=true
			else
				mtitle=rst("v_title")
				mstype=rst("v_stype")
			end if
		end if
	end if
	

%>
  <form id="frmvote" name="frmvote" method="post" action="<%=taction%>" onSubmit="javascript:return checkform();">
    <table width="754" height="151" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
      <tr>
        <td height="48" colspan="2" align="center" valign="middle" bgcolor="#DCDCDC">
		<%
		if request.querystring("act")="modify" and not modifyerr then
		 	response.write("修改投票:"&rst("v_id"))
		else
			response.write("建立新的投票")
		end if
		%>		</td>
      </tr>
      <tr>
        <td width="115" height="51">投票主题</td>
        <td width="633"><textarea name="v_title" cols="60" rows="5" id="v_title"><%
		if request.querystring("act")="modify" and not modifyerr then
			response.write(rst("v_title"))
		end if
		%></textarea></td>
      </tr>
      <tr>
        <td>投票类型</td>
        <td>多选投票
          <input type="radio" name="v_stype" value="true" checked />
          单选投票
          <input type="radio" name="v_stype" value="false" /></td>
      </tr>
      <tr>
        <td colspan="2" align="center" valign="middle"><input type="submit" name="Submit" value="<%
		if request.querystring("act")="modify" and not modifyerr then
			response.write("修改投票")
		else
			response.write("新建投票")
		end if
		%>" /></td>
      </tr>
    </table>
  </form>
  <%
  	if mstype then
  		tmstype="0"
	else
		tmstype="1"
	end if
  %>
  <script language="javascript">
  //<!--
  document.frmvote.v_stype(<%=tmstype%>).checked=true;
  //-->
  </script>  
  <br />
</div>
<p align="center">&nbsp;</p>
</body>
<%
set rst=nothing
conn.close
set conn=nothing
%>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -