⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit.asp

📁 用软件做留言板
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT"%> 
<!--#include file="Connections/shuju.asp" -->
<%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_shuju_STRING
  MM_editTable = "fbbs"
  MM_editColumn = "fid"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "index.asp"
  MM_fieldsStr  = "fname|value|foicq|value|femail|value|fcontent|value|ftime|value|frepcontent|value"
  MM_columnsStr = "fname|',none,''|foicq|',none,''|femail|',none,''|fcontent|',none,''|ftime|',none,NULL|frepcontent|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
      FormVal = EmptyVal
    Else
      If (AltVal <> "") Then
        FormVal = AltVal
      ElseIf (Delim = "'") Then  ' escape quotes
        FormVal = "'" & Replace(FormVal,"'","''") & "'"
      Else
        FormVal = Delim + FormVal + Delim
      End If
    End If
    If (i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim edit__MMColParam
edit__MMColParam = "1"
if (Request.QueryString("fid") <> "") then edit__MMColParam = Request.QueryString("fid")
%>
<%
set edit = Server.CreateObject("ADODB.Recordset")
edit.ActiveConnection = MM_shuju_STRING
edit.Source = "SELECT * FROM fbbs WHERE fid = " + Replace(edit__MMColParam, "'", "''") + " ORDER BY ftime ASC"
edit.CursorType = 0
edit.CursorLocation = 2
edit.LockType = 3
edit.Open()
edit_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center"> 
  <table width="780" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
    <tr> 
      <td width="147" height="42"></td>
      <td width="417"></td>
      <td width="139"></td>
      <td width="77"></td>
    </tr>
    <tr> 
      <td height="508"></td>
      <td valign="top" colspan="2"> 
        <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
          <tr> 
            <td width="16" height="7"></td>
            <td width="516"></td>
            <td width="21"></td>
            <td width="2"></td>
            <td width="2"></td>
          </tr>
          <tr> 
            <td colspan="4" valign="top" height="19"><img src="image/11.gif" width="550" height="19"></td>
            <td width="2"></td>
          </tr>
          <tr> 
            <td rowspan="3" valign="top" width="16"><img src="image/333.gif" width="14" height="460"></td>
            <td height="278" valign="top" width="516">&nbsp; 
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <form method="POST" action="<%=MM_editAction%>" name="form1">
                <table align="center">
                  <tr valign="baseline"> 
                    <td nowrap align="right"><font size="2">姓名:</font></td>
                    <td> 
                      <input type="text" name="fname" value="<%=(edit.Fields.Item("fname").Value)%>" size="32">
                    </td>
                  </tr>
                  <tr valign="baseline"> 
                    <td nowrap align="right"><font size="2">QQ:</font></td>
                    <td> 
                      <input type="text" name="foicq" value="<%=(edit.Fields.Item("foicq").Value)%>" size="32">
                    </td>
                  </tr>
                  <tr valign="baseline"> 
                    <td nowrap align="right"><font size="2">邮箱:</font></td>
                    <td> 
                      <input type="text" name="femail" value="<%=(edit.Fields.Item("femail").Value)%>" size="32">
                    </td>
                  </tr>
                  <tr valign="baseline"> 
                    <td nowrap align="right"><font size="2">留言内容:</font></td>
                    <td> 
                      <textarea name="fcontent" cols="50" rows="3"><%=(edit.Fields.Item("fcontent").Value)%></textarea>
                    </td>
                  </tr>
                  <tr valign="baseline"> 
                    <td nowrap align="right"><font size="2">时间:</font></td>
                    <td> 
                      <input type="text" name="ftime" value="<%=(edit.Fields.Item("ftime").Value)%>" size="32">
                    </td>
                  </tr>
                  <tr valign="baseline"> 
                    <td nowrap align="right"><font size="2">站长回复:</font></td>
                    <td> 
                      <textarea name="frepcontent" cols="50" rows="3"><%=(edit.Fields.Item("frepcontent").Value)%></textarea>
                    </td>
                  </tr>
                  <tr valign="baseline"> 
                    <td nowrap align="right"><font size="2"></font></td>
                    <td> 
                      <input type="submit" value="回复与编辑">
                    </td>
                  </tr>
                </table>
                <input type="hidden" name="MM_update" value="true">
                <input type="hidden" name="MM_recordId" value="<%= edit.Fields.Item("fid").Value %>">
              </form>
              <p>&nbsp;</p>
            </td>
            <td rowspan="3" valign="top" width="21"><img src="image/44.gif" width="18" height="467"></td>
            <td width="2"></td>
            <td width="2"></td>
          </tr>
          <tr> 
            <td height="15" width="516"></td>
            <td width="2"></td>
            <td width="2"></td>
          </tr>
          <tr> 
            <td valign="top" height="19" width="516"><img src="image/22.gif" width="516" height="19"></td>
            <td width="2"></td>
            <td width="2"></td>
          </tr>
        </table>
      </td>
      <td></td>
    </tr>
    <tr> 
      <td height="33"></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td height="36"></td>
      <td></td>
      <td valign="top">
        <table width="80%" border="0">
          <tr>
            <td><font size="2"><a href="guanli.asp">返回管理</a></font></td>
          </tr>
        </table>
      </td>
      <td></td>
    </tr>
    <tr>
      <td height="91"></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </table>
</div>
</body>
</html>
<%
edit.Close()
%>

⌨️ 快捷键说明

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