📄 admin_question.asp
字号:
<!--#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_Question where id="&request("id")&"")
conn.close
set conn=nothing
response.redirect "admin_question.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_Question where id in("&request("XHID")&")")
conn.close
set conn=nothing
end if
response.redirect "admin_question.asp?page="&request("page")&"&k="&request("k")
elseif request("submit")="搜索投票问题" then
response.redirect "admin_question.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>管理投票问题->
<%
if Request("tid")<>"" then
Set trs = Server.CreateObject("ADODB.RecordSet")
trs.Open "Select * from XH_Title where id=" & Request("tid"),conn,1,1
if not(trs.Eof and trs.Bof) then
if Request("k")<>"" then Response.Write "标题(" & trs("title") &") 投票问题->搜索结果(" & Request("k") &")"
if Request("k")="" then Response.Write "标题(" & trs("title") &") 投票问题"
Else
Response.Write "系统错误!"
Response.End
End if
Else
if request("k")<>"" then response.write "所有投票标题->搜索结果("&request("k")&")"
if request("k")="" then response.write "所有投票标题"
End if
%>
</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("tid")<>"" then
if request("k")<>"" then
sql="select * from XH_qustion where tid="&request("tid")&" and question like '%"&request("k")&"%' order by id desc"
else
sql="select * from XH_question where tid="&request("tid")&" order by id desc"
end if
else
if request("k")<>"" then
sql="select * from XH_question where question like '%"&request("k")&"%' order by id desc"
else
sql="select * from XH_question order by id desc"
end if
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 bgcolor="#E0EEF5" align="center" width="20%">
所属标题名称</td>
<td bgcolor="#E0EEF5" align="center" width="20%">投票数</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_question_modify.asp?id=<%=rs("id")%>&page=<%=request("page")%>&k=<%=request("k")%>&tid=<%=request("tid")%>"><%=rs("question")%></a></td>
<td align="center" width="20%">
<%
dim srs
Set srs=Server.CreateObject("ADODB.Recordset")
srs.open "select * from XH_Subject where id="&rs("sid"),conn,1,1
if not(srs.eof and srs.bof) then
response.write srs("subject")
else
response.write "不存在的主题"
end if
srs.close
set srs=nothing
%>
</td>
<td align="center" width="20%">
<%
dim trs
Set trs=Server.CreateObject("ADODB.Recordset")
trs.open "select * from XH_Title where id="&rs("tid"),conn,1,1
if not(trs.eof and trs.bof) then
response.write "<a href='admin_question.asp?page="&request("page")&"&k="&request("k")&"&tid="&rs("tid")&"'>"&trs("title")&"</a>"
else
response.write "不存在的标题"
end if
trs.close
set trs=nothing
%>
</td>
<td align="center" width="20%"><%=rs("ps")%></td>
<td width="10%" align="center"><a href="admin_question.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 bgcolor="#E0EEF5" align="center" width="20%">
所属标题名称</td>
<td bgcolor="#E0EEF5" align="center" width="20%">投票数</td>
<td width="10%" bgcolor="#E0EEF5" align="center">单项操作</td>
</tr>
<tr>
<td colspan="7">
<input type="submit" name="submit" value="删除所选投票问题">
| <input type="text" name="k">
<input type="submit" name="submit" value="搜索投票问题"></td>
</tr>
<tr>
<td colspan="7">
页次:<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_title.asp?k=<%=request("k")%>><%end if%><<-</a> <%if cint(pageno)>1 then%><a href=admin_title.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_title.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_title.asp?page=<%=pageno+1%>&k=<%=request("k")%>><%end if%>-></a> <%if cint(pageno)< mpage then%><a href=admin_title.asp?page=<%=mpage%>&k=<%=request("k")%>><%end if%>->></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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -