📄 a_del.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/gconn.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="err.html"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' *** Delete Record: construct a sql delete statement and execute it
If (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
If (Not MM_abortEdit) Then
' execute the delete
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_gconn_STRING
MM_editCmd.CommandText = "DELETE FROM gcontents WHERE g_id = ?"
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, Request.Form("MM_recordId")) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "index.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("g_id") <> "") Then
Recordset1__MMColParam = Request.QueryString("g_id")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_gconn_STRING
Recordset1_cmd.CommandText = "SELECT * FROM gcontents WHERE g_id = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5, 1, -1, Recordset1__MMColParam) ' adDouble
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Gxjss留言本(Asp程序) 删除留言!</title>
<link href="css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body leftmargin="1" topmargin="2">
<!--#include file="top.html" -->
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="bk">
<tr>
<td height="460"><form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
<table width="90%" border="0" align="center" class="bkse">
<tr>
<td height="30" align="right"> </td>
<td><b><font color="#CC0000">请谨慎操作!删除不可恢复!</font></b></td>
</tr>
<tr>
<td width="14%" height="30" align="right">留言ID:</td>
<td width="86%"><input name="gid" type="text" id="gid" value="<%=(Recordset1.Fields.Item("g_id").Value)%>" /></td>
</tr>
<tr>
<td height="32" align="right">姓 名:</td>
<td><input name="gname" type="text" id="gname" value="<%=(Recordset1.Fields.Item("g_name").Value)%>" /></td>
</tr>
<tr>
<td height="28" align="right">标 题:</td>
<td><input name="gbt" type="text" id="gbt" value="<%=(Recordset1.Fields.Item("g_title").Value)%>" size="60" /></td>
</tr>
<tr>
<td align="right" valign="top">内 容:</td>
<td><textarea name="gneirong" id="gneirong" cols="80" rows="12"><%=(Recordset1.Fields.Item("g_content").Value)%></textarea></td>
</tr>
<tr>
<td height="40"> </td>
<td><input type="submit" name="button" id="button" value="确定删除此留言" />
(删除后直接返回首页) <input name="button2" type="button" id="button2" onclick="MM_goToURL('parent','index.asp');return document.MM_returnValue" value="不删除返回首页" /></td>
</tr>
</table>
<input type="hidden" name="MM_delete" value="form1" />
<input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("g_id").Value %>" />
</form>
</td>
</tr>
</table>
<!--#include file="bottom.html" -->
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -