yns_mup.asp
上传用户:yjkj1008
上传日期:2020-10-17
资源大小:1496k
文件大小:6k
源码类别:

电子政务应用

开发平台:

HTML/CSS

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <!--#include file="Connections/conn_news.asp" --> <% '请尊重作者劳动成果不要删除以上信息 '业一新闻系统3.0正式版 '主页:http://yeyi.net '论坛:http://bbs.yeyi.net '业一网络 承接各种网站制作 '程序开发 软件开发业务 '业务联系 '电话: 13007310512 '联系人:郝亚平 'QQ:24344842 (只谈业务,技术问题请访问论坛) '请尊重作者劳动成果不要删除以上信息 %>
  3. <%
  4. ' *** Restrict Access To Page: Grant or deny access to this page
  5. MM_authorizedUsers="3"
  6. MM_authFailedURL="default.asp"
  7. MM_grantAccess=false
  8. If Session("MM_Username") <> "" Then
  9.   If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
  10.          (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
  11.     MM_grantAccess = true
  12.   End If
  13. End If
  14. If Not MM_grantAccess Then
  15.   MM_qsChar = "?"
  16.   If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  17.   MM_referrer = Request.ServerVariables("URL")
  18.   if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  19.   MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  20.   Response.Redirect(MM_authFailedURL)
  21. End If
  22. %>
  23. <%
  24. ' *** Edit Operations: declare variables
  25. Dim MM_editAction
  26. Dim MM_abortEdit
  27. Dim MM_editQuery
  28. Dim MM_editCmd
  29. Dim MM_editConnection
  30. Dim MM_editTable
  31. Dim MM_editRedirectUrl
  32. Dim MM_editColumn
  33. Dim MM_recordId
  34. Dim MM_fieldsStr
  35. Dim MM_columnsStr
  36. Dim MM_fields
  37. Dim MM_columns
  38. Dim MM_typeArray
  39. Dim MM_formVal
  40. Dim MM_delim
  41. Dim MM_altVal
  42. Dim MM_emptyVal
  43. Dim MM_i
  44. MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
  45. If (Request.QueryString <> "") Then
  46.   MM_editAction = MM_editAction & "?" & Request.QueryString
  47. End If
  48. ' boolean to abort record edit
  49. MM_abortEdit = false
  50. ' query string to execute
  51. MM_editQuery = ""
  52. %>
  53. <%
  54. ' *** Update Record: set variables
  55. If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
  56.   MM_editConnection = MM_conn_news_STRING
  57.   MM_editTable = "t_mob"
  58.   MM_editColumn = "m_id"
  59.   MM_recordId = "" + Request.Form("MM_recordId") + ""
  60.   MM_editRedirectUrl = "yns_mlist.asp"
  61.   MM_fieldsStr  = "m_name|value|m_content|value"
  62.   MM_columnsStr = "m_name|',none,''|m_content|',none,''"
  63.   ' create the MM_fields and MM_columns arrays
  64.   MM_fields = Split(MM_fieldsStr, "|")
  65.   MM_columns = Split(MM_columnsStr, "|")
  66.   
  67.   ' set the form values
  68.   For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
  69.     MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  70.   Next
  71.   ' append the query string to the redirect URL
  72.   If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
  73.     If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
  74.       MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
  75.     Else
  76.       MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
  77.     End If
  78.   End If
  79. End If
  80. %>
  81. <%
  82. ' *** Update Record: construct a sql update statement and execute it
  83. If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
  84.   ' create the sql update statement
  85.   MM_editQuery = "update " & MM_editTable & " set "
  86.   For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
  87.     MM_formVal = MM_fields(MM_i+1)
  88.     MM_typeArray = Split(MM_columns(MM_i+1),",")
  89.     MM_delim = MM_typeArray(0)
  90.     If (MM_delim = "none") Then MM_delim = ""
  91.     MM_altVal = MM_typeArray(1)
  92.     If (MM_altVal = "none") Then MM_altVal = ""
  93.     MM_emptyVal = MM_typeArray(2)
  94.     If (MM_emptyVal = "none") Then MM_emptyVal = ""
  95.     If (MM_formVal = "") Then
  96.       MM_formVal = MM_emptyVal
  97.     Else
  98.       If (MM_altVal <> "") Then
  99.         MM_formVal = MM_altVal
  100.       ElseIf (MM_delim = "'") Then  ' escape quotes
  101.         MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
  102.       Else
  103.         MM_formVal = MM_delim + MM_formVal + MM_delim
  104.       End If
  105.     End If
  106.     If (MM_i <> LBound(MM_fields)) Then
  107.       MM_editQuery = MM_editQuery & ","
  108.     End If
  109.     MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
  110.   Next
  111.   MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
  112.   If (Not MM_abortEdit) Then
  113.     ' execute the update
  114.     Set MM_editCmd = Server.CreateObject("ADODB.Command")
  115.     MM_editCmd.ActiveConnection = MM_editConnection
  116.     MM_editCmd.CommandText = MM_editQuery
  117.     MM_editCmd.Execute
  118.     MM_editCmd.ActiveConnection.Close
  119.     If (MM_editRedirectUrl <> "") Then
  120.       Response.Redirect(MM_editRedirectUrl)
  121.     End If
  122.   End If
  123. End If
  124. %>
  125. <%
  126. Dim rsm__MMColParam
  127. rsm__MMColParam = "1"
  128. If (Request.QueryString("m_id") <> "") Then 
  129.   rsm__MMColParam = Request.QueryString("m_id")
  130. End If
  131. %>
  132. <%
  133. Dim rsm
  134. Dim rsm_numRows
  135. Set rsm = Server.CreateObject("ADODB.Recordset")
  136. rsm.ActiveConnection = MM_conn_news_STRING
  137. rsm.Source = "SELECT * FROM t_mob WHERE m_id = " + Replace(rsm__MMColParam, "'", "''") + ""
  138. rsm.CursorType = 0
  139. rsm.CursorLocation = 2
  140. rsm.LockType = 1
  141. rsm.Open()
  142. rsm_numRows = 0
  143. %>
  144. <html>
  145. <head>
  146. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  147. <title>业一新闻系统3.0正式版-------业一网络Yeyi.net制作</title>
  148. <link href="style/css.css" rel="stylesheet" type="text/css">
  149. </head>
  150. <body>
  151. <form method="POST" action="<%=MM_editAction%>" name="form1">
  152.   <table width="500" align="center">
  153.     <tr valign="baseline"> 
  154.       <td width="30%" align="right" nowrap>模板名称:</td>
  155.       <td> <input type="text" name="m_name" value="<%=(rsm.Fields.Item("m_name").Value)%>" size="32"> 
  156.       </td>
  157.     </tr>
  158.     <tr> 
  159.       <td width="30%" align="right" valign="top" nowrap>内容:</td>
  160.       <td valign="baseline"> <textarea name="m_content" cols="50" rows="10"><%=(rsm.Fields.Item("m_content").Value)%></textarea> 
  161.       </td>
  162.     </tr>
  163.     <tr valign="baseline"> 
  164.       <td width="30%" align="right" nowrap>&nbsp;</td>
  165.       <td> <input type="submit" value="更新记录"> </td>
  166.     </tr>
  167.   </table>
  168.   <input type="hidden" name="MM_update" value="form1">
  169.   <input type="hidden" name="MM_recordId" value="<%= rsm.Fields.Item("m_id").Value %>">
  170. </form>
  171. <p>&nbsp;</p>
  172. </body>
  173. </html>
  174. <%
  175. rsm.Close()
  176. Set rsm = Nothing
  177. %>