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

📄 admin_vote.asp

📁 本人仅业余学习一些基础的ASP知识以供系统设计之用,并非专业人员,相关服务器设置、MSSQL/MySQL数据库方面的专业问题请自行解决。 本人仅提供本系统相关的一些技术问题的解释、解答。
💻 ASP
字号:
<!-- #include file="../conn.asp" -->
<!--#include file="../inc/config.asp"-->
<!-- #include file="session.asp" -->
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>

<body>

<div id=topmomo><a href="admin_vote.asp?info=add&cndb=site">网站调查</a> 
| <a href="admin_vote.asp?info=list&cndb=bclass">长篇分类调查</a>
| <a href="admin_vote.asp?info=list&cndb=aclass">短篇分类调查</a>
| <a href="admin_vote.asp?info=list&cndb=book">长篇作品调查</a>
| <a href="admin_vote.asp?info=list&cndb=article">短篇作品调查</a>
| <a href="admin_vote.asp?info=list&cndb=author">作家调查</a>
| <a href="admin_vote.asp?info=list&cndb=user">会员调查</a>
</div><br>
<%
Select Case request.querystring("info")
	Case "add"
		Call add()
	Case "list"
		Call list()
	Case "edit"
		Call edit()
	Case "add_choice"
		Call add_choice()
	Case "edit_choice"
		Call edit_choice()
end select 
Sub list()%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tborder">
	<tr>
		<td class="thead" align="center" height="25" colspan="9"><b>查看调查列表</b></td>
	</tr>
	<tr align="center" height="22">
		<td width="31%" class="tcat">调查名称</td>
		<td class="tcat" colspan="3">网站操作</td>
		<td width="20%" class="tcat">显示</td>
	</tr>
<%
Const MaxPerPage=20
If Request("page")<>"" then
    CurrentPage=Cint(Request("Page"))
Else
    CurrentPage=1
End if
cndb=request.querystring("cndb")
set rs=server.createobject("adodb.recordset")
if IsSqlDataBase = 2 then
	if cndb="site" then
		sql="select id,title from vote_class where class=0 order by id desc"
	elseif cndb="bclass" then
		sql="select id,title from vote_class where class=1 order by id desc"
	elseif cndb="aclass" then
		sql="select id,title from vote_class where class=2 order by id desc"
	elseif cndb="book" then
		sql="select id,title from vote_class where class=3 order by id desc"
	elseif cndb="article" then
		sql="select id,title from vote_class where class=4 order by id desc"
	elseif cndb="author" then
		sql="select id,title from vote_class where class=5 order by id desc"
	elseif cndb="user" then
		sql="select id,title from vote_class where class=6 order by id desc"
	end if
else
	if cndb="site" then
		sql="select id,title from [vote_class] where class=0 order by id desc"
	elseif cndb="bclass" then
		sql="select id,title from [vote_class] where class=1 order by id desc"
	elseif cndb="aclass" then
		sql="select id,title from [vote_class] where class=2 order by id desc"
	elseif cndb="book" then
		sql="select id,title from [vote_class] where class=3 order by id desc"
	elseif cndb="article" then
		sql="select id,title from [vote_class] where class=4 order by id desc"
	elseif cndb="author" then
		sql="select id,title from [vote_class] where class=5 order by id desc"
	elseif cndb="user" then
		sql="select id,title from [vote_class] where class=6 order by id desc"
	end if
end if
'MySQL需要如下语句
conn.CursorLocation=3
rs.open sql,conn,1,1
if rs.eof and rs.bof then
	Response.Write "<tr align=center><td height=22 colspan=5 class=alt1><span class=style1>暂无任何调查项目!</span></td></tr>"
else
   Rs.PageSize=MaxPerPage
   Allpage=Rs.PageCount
   If Currentpage>Allpage Then Currentpage=1
   Num=Rs.RecordCount
   Rs.MoveFirst
   Rs.AbsolutePage=CurrentPage
   i=0
do while not rs.eof
%>
	<tr align="center" height=22>
		<td width="31%" class="alt2" height="21">
		<a href="admin_vote.asp?info=edit&cndb=<%=cndb%>&id=<%=rs("id")%>"><%=rs("title")%></a></td>
		<td width="18%" class="alt1" height="21">
		<a href="admin_vote.asp?info=add_choice&cndb=<%=cndb%>&id=<%=rs("id")%>">
		添加选项</a></td>
		<td width="17%" class="alt2" height="21">
		<a href="admin_Daily.asp?info=vote_del&cndb=<%=cndb%>&id=<%=rs("id")%>">删除</a></td>
		<td width="14%" class="alt1" style="cursor:hand" onclick="window.open('../voteshow.asp?id=<%=rs("id")%>','','width=360,height=400,left=50')" height="21">
		预览</td>
		<td width="20%" class="alt2" height="21"> </td>
	</tr>
	<%      i=i+1
      If i>=MaxPerPage Then  Exit  Do
      Rs.MoveNext
   Loop
End If
Rs.Close
Set  Rs=Nothing%>
	<tr align="center">
			<td height="26" colspan="5" class="alt2"><%Response.Write ShowPage("admin_vote.asp?info=list&cndb="&cndb&"",CurrentPage,Num,MaxPerPage,True,True," 个项目")%></td>
	</tr>
</table>
<%end sub

Sub add()
cndb=request.querystring("cndb")
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tborder">
	<tr height="25">
		<td colspan="4" class="thead">添加新调查</td>
	</tr>
	<form method="post" action="admin_Daily.asp?info=vote_add&cndb=<%=cndb%>" name="form" id="form">
	<tr>
		<td colspan="4" class="alt3">
			<div id=panx>
					<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class=panel>
		<tr align="center">
			<td width="31%" class=alt2>主题内容:</td>
			<td height="34" align="left" class=alt1>
			<textarea name="title" cols="50" rows="5" id="title" class="form"></textarea> 小于200字</td>
		</tr>
		<tr align="center" height="22">
			<td width="31%" class=alt2>多选/单选</td>
			<td height="34" align="left" class=alt1>
			<input name="choice" type="radio" value="1" checked> 单选 
			<input type="radio" name="choice" value="0"> 多选</td>
		</tr></table></div>
			<div style="MARGIN-TOP: 6px;MARGIN-bottom: 6px" align="center">
				<input type=hidden name=cndb value=<%=cndb%>>
				<input type="submit" class="button" value="提 交">
                <input type="reset" class="button" value="重 置"></div>
		</td>
	</tr>
	</form>
</table>
<%end sub
Sub edit()
cndb=request.querystring("cndb")
id=request.querystring("id")
set rs=server.CreateObject("adodb.recordset")
if IsSqlDataBase = 2 then
	sql="select choice,title from vote_class where id="&id
else
	sql="select choice,title from [vote_class] where id="&id
end if
rs.open sql,conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tborder">
	<tr height="25">
		<td colspan="4" class="thead">修改网站调查</td>
	</tr>
	<form method="post" action="admin_Daily.asp?info=vote_edit&cndb=<%=cndb%>&id=<%=id%>" name="form" id="form">
	<tr>
		<td colspan="4" class="alt3">
			<div id=panx>
					<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class=panel>
		<tr align="center">
			<td width="31%" class=alt2>主题内容:</td>
			<td height="34" align="left" class=alt1>
			<textarea name="title" cols="50" rows="5" id="title" class="form"><%=rs("title")%></textarea> 
			小于200字</td>
		</tr>
		<tr align="center">
			<td width="31%" class=alt2>多选/单选</td>
			<td height="34" align="left" class=alt1>
			<input name="choice" type="radio" value="1" <%if rs("choice")=1 then response.write "checked"%>> 
			单选 
			<input type="radio" name="choice" value="0" <%if rs("choice")=0 then response.write "checked"%>> 
			多选</td>
		</tr></table></div>
			<div style="MARGIN-TOP: 6px;MARGIN-bottom: 6px" align="center">
				<input type=hidden name=cndb value=<%=cndb%>>
				<input type="submit" class="button" value="提 交">
                <input type="reset" class="button" value="重 置"></div>
		</td>
	</tr>
	</form>
</table>

<%rs.close
set rs=nothing
end sub

Sub add_choice()%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tborder">
	<tr>
		<td class="thead" align="center" height="25" colspan="9"><b>当前主题内容</b></td>
	</tr>
<%id=request.querystring("id")
cndb=request.querystring("cndb")
set rs=server.createobject("adodb.recordset")
if IsSqlDataBase = 2 then
	sql="select title,choice from vote_class where id="&id
else
	sql="select title,choice from [vote_class] where id="&id
end if
rs.open sql,conn,1,1
%>
	<tr align="center" height="25">
		<td width="31%" class="alt2">主题内容:</td>
		<td class="alt1"><%=rs("title")%></td>
	</tr>
	<tr align="center" height="25">
		<td width="31%" class="alt2">选项类型:</td>
		<td class="alt1"><%
if rs("choice")=0 then
	response.write "多选"
elseif rs("choice")=1 then
	response.write "单选"
end if 
rs.close
set rs=nothing
%> </td>
	</tr>
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tborder">
	<tr height="25">
		<td colspan="4" class="thead">添加选项</td>
	</tr>
	<form method="post" action="admin_Daily.asp?info=add_choice&cndb=<%=cndb%>" name="form" id="form">
	<tr>
		<td colspan="4" class="alt3">
			<div id=panx>
					<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class=panel>
		<tr align="center">
                          <td width="31%" height="34" class="alt2">选项内容:</td>
			<td height="34" align="left" class="alt1">
			<input name="name" type="text" id="name" size="30" class="form"></td>
		</tr>
			<input name="ids" type="hidden" id="ids" value="<%=request.querystring("id")%>">
</table></div>
			<div style="MARGIN-TOP: 6px;MARGIN-bottom: 6px" align="center">
				<input type=hidden name=cndb value=<%=cndb%>>
				<input type="submit" class="button" value="提 交">
                <input type="reset" class="button" value="重 置"></div>
		</td>
	</tr>
	</form>
</table>

<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tborder">
	<tr>
		<td class="thead" align="center" height="25" colspan="9"><b>查看调查列表</b></td>
	</tr>
	<tr align="center" height="22">
		<td width="31%" class="tcat">调查名称</td>
		<td class="tcat" colspan="3">网站操作</td>
	</tr>
	<%
set rs2=server.CreateObject("ADODB.Recordset")
if IsSqlDataBase = 2 then
	sql2="select id,vote_name from vote where vote_title="&id
else
	sql2="select id,vote_name from [vote] where vote_title="&id
end if
rs2.open sql2,conn,1,3
if rs2.eof and rs2.bof then
%>
	<tr align="center">
		<td height="22" colspan="5" class="alt1"><span class="style1">暂无任何选项,请添加!</span></td>
	</tr>
<%else
do while not rs2.eof%>
	<tr align="center" height="22">
		<td width="68%" class="alt2">
		<span class="style1"><%=rs2("vote_name")%></span></td>
		<td align="center" class="alt1">
		<a href="admin_vote.asp?info=edit_choice&cndb=<%=cndb%>&cid=<%=rs2("id")%>&id=<%=request.querystring("id")%>">
		修改</a>&nbsp;&nbsp;&nbsp;
		<a href="admin_Daily.asp?info=del_choice&cndb=<%=cndb%>&cid=<%=rs2("id")%>&id=<%=request.querystring("id")%>">
		删除</a></td>
	</tr>
	<%
rs2.movenext
loop
rs2.close
set rs2=nothing
end if
end sub

Sub edit_choice()
dim id,cid
id=request.querystring("id")
cid=request.querystring("cid")
cndb=request.querystring("cndb")
set rs1=server.createobject("adodb.recordset")
if IsSqlDataBase = 2 then
	sql1="select vote_name from vote where id="&cid
else
	sql1="select vote_name from [vote] where id="&cid
end if
rs1.open sql1,conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tborder">
	<tr height="25">
		<td colspan="4" class="thead">修改选项</td>
	</tr>
	<form method="post" action="admin_Daily.asp?info=edit_choice&cid=<%=cid%>&id=<%=id%>" name="form" id="form">
	<tr>
		<td colspan="4" class="alt3">
			<div id=panx>
					<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class=panel>
                        <tr align="center">
                          <td width="31%" height="34" class="alt2">选项内容:</td>
                          <td height="34" align="left" class="alt1"><input name="title" type="text" id="title" value="<%=rs1("vote_name")%>" size="30" class="form"></td>
                        </tr></table></div>
			<div style="MARGIN-TOP: 6px;MARGIN-bottom: 6px" align="center">
				<input type=hidden name=cndb value=<%=cndb%>>
				<input type="submit" class="button" value="提 交">
                <input type="reset" class="button" value="重 置"></div>
		</td>
	</tr>
	</form>
</table>

<%rs1.close
set rs1=nothing
end sub
%>

</table>

</body>

</html>

⌨️ 快捷键说明

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