📄 question.asp
字号:
<!--#include file="conn.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="css.css">
</head>
<body>
<%
If Request.QueryString("sid")= "" Then
Response.Write "<script>alert('ID号不能为空!');history.back(1)</script>"
Response.End
End If
If not IsNumeric(Request.QueryString("sid")) Then
Response.Write "<script>alert('ID号为非数字!');history.back(1)</script>"
Response.End
End If
If Request.QueryString("tid")="" Then
Response.Write "<script>alert('ID号不能为空!');history.back(1)</script>"
Response.End
End If
If not IsNumeric(Request.QueryString("tid")) Then
Response.Write "<script>alert('ID号为非数字!');history.back(1)</script>"
Response.End
End If
Dim yrs,Subject,Title
Set yrs=Server.CreateObject("ADODB.RecordSet")
yrs.open "Select * from Subject where id="&Request.QueryString("sid"),conn,1,1
If (yrs.eof and yrs.bof) Then
Response.Write "<script>alert('此ID号不存在或已被删除!');history.back(1)</script>"
Response.End
Else
Subject=yrs("subject")
End If
yrs.close
yrs.open "Select * from Title where id="&Request.QueryString("tid"),conn,1,1
If (yrs.eof and yrs.bof) Then
Response.Write "<script>alert('此ID号不存在或已被删除!');history.back(1)</script>"
Response.End
Else
Title=yrs("title")
End If
yrs.close
Set yrs=nothing
%>
<div align="center">
<table border="0" width="100%" id="table1" cellspacing="1" cellpadding="3" class="tableborder">
<tr>
<th><font size="4"><a href="question.asp?action=Add&sid=<%=Request.QueryString("sid")%>&tid=<%=Request.QueryString("tid")%>">添加投票项</a> |
<a href="question.asp?action=Modify&sid=<%=Request.QueryString("sid")%>&tid=<%=Request.QueryString("tid")%>">修改投票项</a> | <a href="question.asp?action=Delete&sid=<%=Request.QueryString("sid")%>&tid=<%=Request.QueryString("tid")%>">删除投票项</a> | <a href="admin.asp?action=ChangeMsg">信息修改</a> | <a href="admin.asp?action=Logout">退出管理</a></font></th>
</tr>
</table>
</div>
<%
If Request.QueryString("action")="Add" Then
Call Add()
ElseIf Request.QueryString("action")="Modify" Then
Call Modify()
ElseIf Request.QueryString("action")="Delete" Then
Call Delete()
Else
Call Add()
End If
Sub Add()
%>
<div align="center">
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Select * from Question where tid="&Request.QueryString("tid")&" order by id desc",conn,1,1
%>
<table border="0" width="80%" id="table1" cellspacing="0" cellpadding="3" class="tableborder">
<tr>
<td class="tablebody" width="8%" align="center"><b>ID</b></td>
<td class="tablebody" width="25%" align="center"><b>投票项</b></td>
<td class="tablebody" width="5%" align="center"><b>票数</b></td>
<td class="tablebody" width="25%" align="center"><b>投票标题</b></td>
<td class="tablebody" width="25%" align="center"><b>投票主题</b></td>
</tr>
<%
Dim i
If not (rs.eof and rs.bof) Then
Do While not rs.eof
%>
<tr>
<td class="tablebody1" width="8%" align="center"><%=rs("id")%></td>
<td class="tablebody1" width="25%" align="center"><%=rs("question")%></td>
<td class="tablebody1" width="5%" align="center" nowrap><%=rs("ps")%></td>
<td class="tablebody1" width="25%" align="center"><a href="Title.asp?sid=<%=Request.QueryString("sid")%>"><%=Title%></a></td>
<td class="tablebody1" width="25%" align="center"><a href="Admin.asp"><%=Subject%></a></td>
</tr>
<%
i=i+1
rs.MoveNext
loop
Else
%>
<tr>
<td class="tablebody1" width="8%" align="center"></td>
<td class="tablebody1" width="25%" align="center">还没有任何投票项!</td>
<td class="tablebody1" width="5%" align="center" nowrap></td>
<td class="tablebody1" width="25%" align="center"><a href="Title.asp?sid=<%=Request.QueryString("sid")%>"><%=Title%></a></td>
<td class="tablebody1" width="25%" align="center"><a href="Admin.asp"><%=Subject%></a></td>
</tr>
<%
End if
%>
</table>
<%
rs.close
Set rs=nothing
%>
</div>
<br>
<div align="center">
<table border="0" width="480" cellspacing="1" cellpadding="3" class="tableborder">
<tr>
<th width="466">添加投票问题</th>
</tr>
<form action="DoQuestion.asp?act=add&sid=<%=Request.QueryString("sid")%>&tid=<%=Request.QueryString("tid")%>" method="post" name="addquestion">
<tr>
<td class="tablebody1" align="center" width="464">问题:<input type="text" name="newquestion" size="30">
票数:<input type="text" name="nps" size="5" value="0"> <input type="submit" name="submit" value="添加" onclick="if(addquestion.newquestion.value==''){alert('投票项不能为空!');addquestion.newquestion.focus();return false;}return true;"></td>
</tr>
</form>
</table>
</div>
<%
End Sub
Sub Modify()
%>
<div align="center">
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Select * from Question where tid="&Request.QueryString("tid")&" order by id desc",conn,1,1
%>
<table border="0" width="80%" id="table1" cellspacing="0" cellpadding="3" class="tableborder">
<tr>
<td class="tablebody" width="8%" align="center"><b>ID</b></td>
<td class="tablebody" width="24%" align="center"><b>投票项</b></td>
<td class="tablebody" width="6%" align="center"><b>票数</b></td>
<td class="tablebody" width="25%" align="center"><b>投票标题</b></td>
<td class="tablebody" width="25%" align="center"><b>投票主题</b></td>
<td class="tablebody" width="25%" align="center"><b>操作</b></td>
</tr>
<%
Dim i
If not (rs.eof and rs.bof) Then
Do While not rs.eof
%>
<tr>
<td class="tablebody1" width="8%" align="center"><%=rs("id")%></td>
<td class="tablebody1" width="24%" align="center"><%=rs("question")%></td>
<td class="tablebody1" width="6%" align="center" nowrap><%=rs("ps")%></td>
<td class="tablebody1" width="25%" align="center"><a href="Title.asp?sid=<%=Request.QueryString("sid")%>"><%=Title%></a></td>
<td class="tablebody1" width="25%" align="center"><a href="Admin.asp"><%=Subject%></a></td>
<td class="tablebody1" width="35%" align="center"><a href="question.asp?action=Modify&sid=<%=Request.QueryString("sid")%>&tid=<%=Request.QueryString("tid")%>&qid=<%=rs("id")%>&option=show" onclick="if(confirm('\n真的要修改该投票项?')){return true;}return false;">修改</a></td>
</tr>
<%
i=i+1
rs.MoveNext
loop
Else
%>
<tr>
<td class="tablebody1" width="8%" align="center"></td>
<td class="tablebody1" width="24%" align="center">还没有任何投票项!</td>
<td class="tablebody1" width="6%" align="center" nowrap></td>
<td class="tablebody1" width="25%" align="center"><a href="Title.asp?sid=<%=Request.QueryString("sid")%>"><%=Title%></a></td>
<td class="tablebody1" width="25%" align="center"><a href="Admin.asp"><%=Subject%></a></td>
</tr>
<%
End if
%>
</table>
<%
rs.close
Set rs=nothing
If Request.QueryString("option") = "show" Then
Dim Showrs
Set Showrs=Server.CreateObject("ADODB.RecordSet")
Showrs.open "select * from Question where id="&Request.QueryString("qid"),conn,1,1
If not (Showrs.eof and Showrs.bof) Then
%>
<div align="center">
<table border="0" width="481" id="table2" cellspacing="1" cellpadding="3" class="tableborder">
<tr>
<th width="467">修改投票项</th>
</tr>
<form action="doquestion.asp?act=Modify&sid=<%=Request.QueryString("sid")%>&tid=<%=Request.QueryString("tid")%>&qid=<%=Showrs("id")%>" method="post" name="modifyquestion">
<tr>
<td class="tablebody1" align="center" width="465">问题:<input type="text" name="oldquestion" size="30" value="<%=Showrs("question")%>"> 票数:<input type="text" name="ps" size="5" value="<%=Showrs("ps")%>"> <input type="submit" name="submit" value="修改" onclick="if(modifyquestion.oldquestion.value==''){alert('标题名不能为空!');modifyquestion.oldquestion.focus();return false;}if(modifyquestion.ps.value==''){alert('票数不能为空!');modifyquestion.ps.focus();return false;}return true;"></td>
</tr>
</form>
</table>
</div>
<%
Showrs.close
Set Showrs=nothing
Else
Response.Redirect "Question.asp?action=Modify&sid="&Request.QueryString("sid")&"&tid="&Request.QueryString("tid")
End If
End If
End Sub
Sub Delete()
%>
<div align="center">
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Select * from Question where tid="&Request.QueryString("tid")&" order by id desc",conn,1,1
%>
<table border="0" width="80%" id="table1" cellspacing="0" cellpadding="3" class="tableborder">
<tr>
<td class="tablebody" width="8%" align="center"><b>ID</b></td>
<td class="tablebody" width="24%" align="center"><b>投票项</b></td>
<td class="tablebody" width="6%" align="center"><b>票数</b></td>
<td class="tablebody" width="25%" align="center"><b>投票标题</b></td>
<td class="tablebody" width="25%" align="center"><b>投票主题</b></td>
<td class="tablebody" width="25%" align="center"><b>操作</b></td>
</tr>
<%
Dim i
If not (rs.eof and rs.bof) Then
Do While not rs.eof
%>
<tr>
<td class="tablebody1" width="8%" align="center"><%=rs("id")%></td>
<td class="tablebody1" width="24%" align="center"><%=rs("question")%></td>
<td class="tablebody1" width="6%" align="center" nowrap><%=rs("ps")%></td>
<td class="tablebody1" width="25%" align="center"><a href="Title.asp?sid=<%=Request.QueryString("sid")%>"><%=Title%></a></td>
<td class="tablebody1" width="25%" align="center"><a href="Admin.asp"><%=Subject%></a></td>
<td class="tablebody1" width="35%" align="center"><a href="doquestion.asp?act=delete&qid=<%=rs("id")%>" onclick="if(confirm('\n真的要删除该投票项?')){return true;}return false;">删除</a></td>
</tr>
<%
i=i+1
rs.MoveNext
loop
Else
%>
<tr>
<td class="tablebody1" width="8%" align="center"></td>
<td class="tablebody1" width="24%" align="center">还没有任何投票项!</td>
<td class="tablebody1" width="6%" align="center" nowrap></td>
<td class="tablebody1" width="25%" align="center"><a href="Title.asp?sid=<%=Request.QueryString("sid")%>"><%=Title%></a></td>
<td class="tablebody1" width="25%" align="center"><a href="Admin.asp"><%=Subject%></a></td>
</tr>
<%
End if
%>
</table>
<%
rs.close
Set rs=nothing
End Sub
%>
<table border="0" width="100%" id="table1" cellspacing="1" cellpadding="3" class="tableborder">
<tr>
<td class="tablebody" align="center">Powered By : 网上投票 2005<br>CopyRight 2004-2006 </td>
</tr>
</table>
<%Call EndConnection()%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -