📄 modifytitle.asp
字号:
<!--#include file="config.asp"-->
<!--#include file="check.asp"-->
<!--#include file="sql.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>
<!--#include file="admin_top.asp"-->
<%
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
Dim yrs,Subject
Set yrs=Server.CreateObject("ADODB.RecordSet")
yrs.open "Select * from XH_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
Set yrs=nothing
Dim sid
sid=Request.QueryString("sid")
If Request.QueryString("XHType")="Modify" Then
Call Modify()
ElseIf Request.QueryString("XHType")="del" Then
Call Del()
Else
Call List()
End If
Dim Mfs
Set Mfs=Server.CreateObject("ADODB.RecordSet")
If Request.QueryString("act")="add" Then
If Trim(Request.Form("newtitle"))<>"" Then
Mfs.open "Select * from XH_Title",conn,1,3
Mfs.addnew
Mfs("title")=Trim(Request.Form("newtitle"))
Mfs("sid")=cint(Request.QueryString("sid"))
Mfs("ms")=cint(Request.Form("ms"))
Mfs.update
Mfs.close
End If
Response.Redirect "ModifyTitle.asp?sid="&sid
ElseIf Request.QueryString("act")="Modify" Then
If Trim(Request.Form("oldtitle"))<>"" Then
Mfs.open "Select * from XH_Title where id="&Request.QueryString("tid"),conn,1,3
Mfs("title")=Trim(Request.Form("oldtitle"))
Mfs("ms")=cint(Request.Form("ms"))
Mfs.update
Mfs.close
End If
Response.Redirect "ModifyTitle.asp?sid="&sid
End If
Set Mfs=nothing
Sub Del()
conn.execute("delete from XH_Title where id="&Request.QueryString("tid")&"")
Response.Redirect "ModifyTitle.asp?sid="&sid
End Sub
Sub List()
%>
<div align="center">
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Select * from XH_Title where sid="&sid&" order by id desc",conn,1,1
%>
<table border="0" width="70%" id="table1" cellspacing="0" cellpadding="3" class="tableborder">
<tr>
<td class="tablebody" width="10%" align="center"><b>ID</b></td>
<td class="tablebody" width="40%" align="center"><b>投票标题</b></td>
<td class="tablebody" width="35%" align="center"><b>投票主题</b></td>
<td class="tablebody" 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="10%" align="center"><%=rs("id")%></td>
<td class="tablebody1" width="40%" align="center"><a href="ModifyQuestion.asp?sid=<%=sid%>&tid=<%=rs("id")%>"><%=rs("title")%></a></td>
<td class="tablebody1" width="35%" align="center"><a href="ModifySubject.asp"><%=Subject%></a></td>
<td class="tablebody1" align="center" nowrap><a href=ModifyTitle.asp?XHType=Modify&sid=<%=sid%>&tid=<%=rs("id")%> title="修改投票标题">修改</a>/<a href="ModifyTitle.asp?XHType=del&sid=<%=sid%>&tid=<%=rs("id")%>" title="删除投票标题" onclick="if(confirm('\n真的要删除该标题及其下面的所有投票?')){return true;}return false;">删除</a></td>
</tr>
<%
i=i+1
rs.MoveNext
loop
Else
Response.Write "<tr><td class='tablebody1' align='center' colspan='4'><font color='red'>还没有任何标题!</font></td></tr>"
End if
%>
</table>
<%
rs.close
Set rs=nothing
%>
</div>
<br>
<div align="center">
<table border="0" width="50%" cellspacing="1" cellpadding="3" class="tableborder">
<tr>
<th>添加投票标题</th>
</tr>
<form action="?act=add&sid=<%=sid%>" method="post" name="addtitle">
<tr>
<td align="center" class="tablebody1">
标题:<input type="text" name="newtitle" size="30">
模式:
<select size="1" name="ms">
<option value="1">单选</option>
<option value="2">复选</option>
</select>
<input type="submit" name="submit" value="添加" onclick="if(addtitle.newtitle.value==''){alert('标题名不能为空!');addtitle.newtitle.focus();return false;}return true;"></td>
</tr>
</form>
</table>
</div>
<%
End Sub
Sub Modify()
Dim Showrs
Set Showrs=Server.CreateObject("ADODB.RecordSet")
Showrs.open "select * from XH_Title where id="&Request.QueryString("tid"),conn,1,1
If not (Showrs.eof and Showrs.bof) Then
%>
<div align="center">
<table border="0" width="50%" id="table2" cellspacing="1" cellpadding="3" class="tableborder">
<tr>
<th>修改投票标题</th>
</tr>
<form action="?act=Modify&sid=<%=Request.QueryString("sid")%>&tid=<%=Showrs("id")%>" method="post" name="modifytitle">
<tr>
<td align="center" class="tablebody1">
标题:<input type="text" name="oldtitle" size="30" value="<%=Showrs("title")%>">
模式:
<select size="1" name="ms">
<option value="1" <%if Showrs("ms")=1 then Response.Write "selected"%>>单选</option>
<option value="2" <%if Showrs("ms")=2 then Response.Write "selected"%>>复选</option>
</select>
<input type="submit" name="submit" value="修改" onclick="if(modifytitle.oldtitle.value==''){alert('标题名不能为空!');modifytitle.oldtitle.focus();return false;}return true;"></td>
</tr>
</form>
</table>
</div>
<%
Showrs.close
Set Showrs=nothing
Else
Response.Redirect "ModifyTitle.asp?sid="&sid
End If
End Sub
%>
<!--#include file="admin_foot.asp"-->
<%Call EndConnection()%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -