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

📄 admin_voteedit.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,modifyerr,tcolor
dim mtitle
set rst=server.createobject("adodb.recordset")
%>
<!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 checkdel()
{
	if (confirm("你确定要删除此投票项吗?"))
		{
		return true;
		}
	else
		return false;
}
//提交表单中新建、修改投票项标题时提示
function checkform()
{
	if (document.frmvote.v_title.value=='')
		{
			alert("请输入投票项!");
			return false;
		}
	else
		return true;	
}
//-->
</script>

<body>
<%
'---------------------------投票管理页传递过来的v_id参数合法检测和session变量检测---------------------------------------
if (not isnumeric(request.querystring("v_id")) or isempty(request.querystring("v_id"))) and session("editvoteid")="" then
	msgboxU "参数错误!"
else
	if not isempty(request.querystring("v_id")) then session("editvoteid")=request.querystring("v_id")
end if

'--------------------------投票项ID检测-------------------------------------------
if request.querystring("act")<>"" then
	if (not isnumeric(request.querystring("subv_id")) or isempty(request.querystring("subv_id"))) and request.querystring("act")<>"add" then 
		msgboxU "参数错误!"
	elseif request.querystring("act")<>"modify" then 
		select case request.QueryString("act")
			
			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_upid")=session("editvoteid")
					rst("v_title")=request.form("v_title")
					rst("v_type")=false
					rst.update
					rst.close
				end if
				errstr="添加投票项"
				
			case "del"'删除投票项
				sql="delete from shop_vote where v_type=false and v_id="&request.querystring("subv_id")
				conn.execute sql
				errstr="删除投票项"
				
			case "update"'修改投票项
				if trim(request.form("v_title"))="" then
					msgboxU "没有输入投票项说明,修改投票项失败!"
				else
					sql="update shop_vote set v_title='"&request.form("v_title")&"' where v_type=false and v_id="&request.querystring("subv_id")
					conn.execute sql
				end if
				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><span class="bluetitle">网站投票项管理</span></p>
						<!-- 显示投票主题表格begin! -->
	  <table width="754" height="88" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
		<tr>
		  <td width="232" height="30" bgcolor="#DCDCDC">ID</td>
		  <td width="281" bgcolor="#DCDCDC">投票主题</td>
		  <td width="233" bgcolor="#DCDCDC">类型</td>
		</tr>
	<%
	sql="select * from shop_vote where v_type=true and v_id="&session("editvoteid")
	rst.open sql,conn,1,1
	if rst.bof and rst.bof then
	%>
		<tr>
		  <td height="23" colspan="3" align="center">错误的投票ID参数,或此投票已经被删除!</td>
		</tr>
	<%
	else
	%>
			<tr>
			  <td width="231" bgcolor="#ECECEC"><%=rst("v_id")%></td>
			  <td width="282" bgcolor="#ECECEC"><%=rst("v_title")%></td>
			  <td width="233" bgcolor="#ECECEC">
			  <%
			  if rst("v_stype") then
				response.write("<input name='checkbox' type='checkbox' id='checkbox' value='checkbox' checked='checked' />多选")
			  else
				response.write("<input name='radio' type='radio' value='radiobutton checked='checked' />单选")
			  end if
			  %>
			  </td>
			</tr>
	<%
	end if
	rst.close
	%>
  </table>
						<!-- 显示投票主题表格end! -->
  <br />
	  					<!-- 显示投票项表格begin! -->
	  <table width="754" height="93" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
		<tr>
		  <td width="231" bgcolor="#DCDCDC">ID</td>
		  <td width="282" bgcolor="#DCDCDC">投票项说明</td>
		  <td width="233" bgcolor="#DCDCDC">操作</td>
		</tr>
<%
tcolor="#ECECEC"
sub changecolor()
	if tcolor="#DCDCDC" then
		tcolor="#ECECEC"
	else
		tcolor="#DCDCDC"
	end if
	response.write(tcolor)
end sub

sql="select * from shop_vote where v_type=false and v_upid="&session("editvoteid")
rst.open sql,conn,1,1
if rst.eof and rst.bof then
%>
		<tr>
		  <td height="25" colspan="3" align="center"><span class="redtitle">还没有建立任何投票项!</span></td>
		</tr>
<%
else
	while not rst.eof
%>
		<tr bgcolor=<%changecolor%>>
		  <td><%=rst("v_upid")%></td>
		  <td><%=rst("v_title")%></td>
		  <td><a href="admin_voteedit.asp?act=modify&subv_id=<%=rst("v_id")%>">修改</a>&nbsp;<a href="admin_voteedit.asp?act=del&subv_id=<%=rst("v_id")%>" onclick="javascrip:return checkdel();">删除</a></td>
		</tr>
<%
		rst.movenext
	wend
end if 
rst.close
%>
  </table>
	 					<!-- 显示投票项表格end! -->
	  <p><a href="admin_voteedit.asp">建立新投票项</a></p>
	  
	  
	  
<%
taction="admin_voteedit.asp?act=add"
if request.querystring("act")="modify" then 
	modifyerr=false
	if not isnumeric(request.querystring("subv_id")) or isempty(request.querystring("subv_id")) then 
		msgboxU "修改投票项参数错误"
		modifyerr=true
	else
		taction="admin_voteedit.asp?act=update&subv_id="&request.querystring("subv_id")
		sql="select * from shop_vote where v_type=false and v_id="&request.querystring("subv_id")
		rst.open sql,conn,1,1
		if rst.eof and rst.bof then 
			modifyerr=true 
		else 
			mtitle=rst("v_title") 
		end if 
		rst.close
	end if 
end if 
%>
  <form id="frmvote" name="frmvote" method="post" action="<%=taction%>" onSubmit="javascript:return checkform();">
  					<!-- 新建投票、修改投票表单begin -->
	<table width="754" height="116" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
		  <tr align="center">
			<td height="24" colspan="2" bgcolor="#DCDCDC">
			<%
			if request.querystring("act")="modify" and not modifyerr then 
				response.write("修改投票项,"&request.querystring("subv_id")) 
			else 
				response.write("新建投票项")  
			end if 
			'rst.close
			%></td>
	  </tr>
		  <tr>
			<td width="183">投票项说明</td>
			<td width="565" align="left"><textarea name="v_title" cols="50" rows="5" id="v_title"><%if request.querystring("act")="modify" and not modifyerr then response.write(mtitle) end if%></textarea></td>
		  </tr>
		  <tr align="center">
			<td colspan="2">
			<%
			if request.querystring("act")="modify" and not modifyerr then 
				response.write("<input type='submit' name='Submit' value='修改投票项' />") 
			else
				response.write("<input type='submit' name='Submit' value='新建投票项' />") 
			end if
			%>
			</td>
		  </tr>
	</table>
						<!-- 新建投票、修改投票表单end -->
  </form>

</div>
<%
set rst=nothing
conn.close
set conn=nothing
%>
</body>
</html>

⌨️ 快捷键说明

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