admin_subject.asp

来自「Build 1025更新: 美化了后台,简化了后台操作」· ASP 代码 · 共 186 行

ASP
186
字号
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>■管理中心</title>
<link rel="stylesheet" type="text/css" href="Admin_STYLE.CSS">
</head>

<script language="JavaScript">
function XH() {
	for (var i=0;i<document.XHH.XHID.length;i++) {
		var e=document.XHH.XHID[i];
		e.checked=!e.checked;
	}
}	
</script>
<%
if request("act")="del" then
	if request("id")="" or IsNumeric(request("id"))=false then
		response.write "<script>alert('ID号必须为数字');history.back(1)</script>"
		response.end
	end if	
	conn.execute("delete from XH_subject where id="&request("id")&"")
	conn.execute("delete from XH_Title where sid="&request("id")&"")
	conn.execute("delete from XH_Question where sid="&request("id")&"")
	conn.close
	set conn=nothing
	response.redirect "admin_subject.asp?page="&request("page")&"&k="&request("k")
elseif request("act")="save" then
	if request("submit")="删除所选投票主题" then
		if request("XHID")="" then
			response.write "<script>alert('未选择任何投票主题!');history.back(1)</script>"
			response.end
		else
			conn.execute("delete from XH_subject where id in("&request("XHID")&")")
			conn.execute("delete from XH_Title where sid in("&request("XHID")&")")
			conn.execute("delete from XH_Question where sid in("&request("XHID")&")")
			conn.close
			set conn=nothing
		end if
		response.redirect "admin_subject.asp?page="&request("page")&"&k="&request("k")
	elseif request("submit")="搜索投票主题" then
		response.redirect "admin_subject.asp?page="&request("page")&"&k="&request("k")
	end if
end if
%>							
<body topmargin="1" leftmargin="1">

<div align="center">
	<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table1" bgcolor="#E1F4EE" bordercolor="#009286">
		<tr>
			<td bgcolor="#009286"><font color="#FFFFFF"><b>管理投票主题-&gt;
			<%
			if request("k")<>"" then response.write "所有投票主题->搜索结果("&request("k")&")"
			if request("k")="" then response.write "所有投票主题"
			%>
			</b></font></td>
		</tr>
		<tr>
			<td>
			<%
			dim currentPage,MaxPerPage,totalPut,mpage,pageno,pp,p,pno
			if request("page")<>"" then
				currentPage=cint(request("page"))
			else
				currentPage=1
			end if
			MaxPerPage=20
			set rs=server.createobject("adodb.recordset")
			if request("k")<>"" then
				sql="select * from XH_subject where subject like '%"&request("k")&"%' order by id desc"
			else
				sql="select * from XH_subject order by id desc"
			end if
			rs.open sql,conn,1,1
			if rs.eof and rs.bof then
				response.write "<p align='center'>还没找到任何投票主题</p>"
			else
				totalPut=rs.recordcount
				rs.move (currentPage-1)*MaxPerPage
				rs.PageSize=MaxPerPage
				mpage=rs.pagecount
			%>							
			<div align="center">
				<table border="1" style="border-collapse: collapse" width="100%" id="table2" bordercolor="#FFFFFF" cellspacing="1">
					<form action="?act=save&page=<%=currentPage%>" method="post" name="XHH">
						<tr>
							<td width="5%" bgcolor="#E0EEF5" align="center">ID</td>
							<td width="5%" bgcolor="#E0EEF5" align="center"><a href="javascript:XH()">选择</a></td>
							<td bgcolor="#E0EEF5" align="center">投票主题名称</td>
							<td bgcolor="#E0EEF5" align="center" width="20%">
							投票主题到期时间</td>
							<td width="10%" bgcolor="#E0EEF5" align="center">
							调用代码</td>
							<td width="10%" bgcolor="#E0EEF5" align="center">
							投票结果</td>
							<td width="10%" bgcolor="#E0EEF5" align="center">状态</td>
							<td width="10%" bgcolor="#E0EEF5" align="center">单项操作</td>
						</tr>
						<%
						dim i
						i=0
						do while not rs.eof
						%>
						<tr>
							<td width="5%" bgcolor="#E1FFE1" align="center"><%=rs("id")%></td>
							<td width="5%" bgcolor="#E1FFE1" align="center"><input type="checkbox" name="XHID" value="<%=rs("id")%>"></td>
							<td align="center"><a href="admin_subject_modify.asp?id=<%=rs("id")%>"><%=rs("subject")%></a></td>
							<td align="center" width="20%"><%=rs("qx")%></td>
							<td width="10%" align="center"><a href="#" onclick="javascript:window.open('vcode.asp?sid=<%=rs("id")%>','','width=300,height=60,top=300,left=350,resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no');">查看</a></td>
							<td width="10%" align="center">
							<a href="view.asp?sid=<%=rs("id")%>" target="_blank">查看</a></td>
							<td width="10%" align="center"><%if rs("qx")>now() then%>正常<%else%><font color="red">到期</font><%end if%></td>
							<td width="10%" align="center"><a href="admin_subject.asp?act=del&id=<%=rs("id")%>&k=<%=request("k")%>&page=<%=currentPage%>">删除</a></td>
						</tr>
						<%
						i=i+1
						if i>=MaxPerPage then exit do
						rs.movenext
						loop
						%>
						<tr>
							<td width="5%" bgcolor="#E0EEF5" align="center">ID</td>
							<td width="5%" bgcolor="#E0EEF5" align="center"><a href="javascript:XH()">选择</a></td>
							<td bgcolor="#E0EEF5" align="center">投票主题名称</td>
							<td bgcolor="#E0EEF5" align="center" width="20%">
							投票主题到期时间</td>
							<td width="10%" bgcolor="#E0EEF5" align="center">
							调用代码</td>
							<td width="10%" bgcolor="#E0EEF5" align="center">
							投票结果</td>
							<td width="10%" bgcolor="#E0EEF5" align="center">状态</td>
							<td width="10%" bgcolor="#E0EEF5" align="center">单项操作</td>
						</tr>
						<tr>
							<td colspan="8">
							<input type="submit" name="submit" value="删除所选投票主题"> 
							| <input type="text" name="k">
							<input type="submit" name="submit" value="搜索投票主题"></td>
						</tr>
						<tr>
							<td colspan="8">
							页次:<b><font color="#FF0000"><%=currentPage%></font>/<%=mpage%></b>,每页<b><%=MaxPerPage%></b>个,<%if request("k")<>"" then%><font color="#FF0000">搜到</font><%else%>当前<%end if%>投票主题<b><%=totalPut%></b>个
							<%
							pageno=currentPage
							if isempty(pageno) or cint(pageno)<1 or cint(pageno)>mpage then
								pageno=1
							end if
							%>
							[ <%if cint(pageno)>1 then%><a href=admin_subject.asp?k=<%=request("k")%>><%end if%><<-</a> <%if cint(pageno)>1 then%><a href=admin_subject.asp?page=<%=pageno-1%>&k=<%=request("k")%>><%end if%><-</a>
							<%
							pp=cint(pageno)-3
							if pp<1 then pp=1
							for pno=pp to mpage
								p=p+1
								if pno=cint(pageno) then
							%>
								<font color="#FF0000"><%=pno%></font><%else%> <a href=admin_subject.asp?page=<%=pno%>&k=<%=request("k")%>><%=pno%></a><%end if%>
							<%
								if p>=7 then exit for
							next
							%>
							<%if cint(pageno)< mpage then%> <a href=admin_subject.asp?page=<%=pageno+1%>&k=<%=request("k")%>><%end if%>-></a> <%if cint(pageno)< mpage then%><a href=admin_subject.asp?page=<%=mpage%>&k=<%=request("k")%>><%end if%>-&gt;&gt;</a> ]											
							</td>
						</tr>
					</form>
				</table>
			</div>
			<%
			end if
			rs.close
			set rs=nothing
			conn.close
			set conn=nothing
			%>
			</td>
		</tr>
	</table>
</div>

</body>

</html>

⌨️ 快捷键说明

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