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

电子政务应用

开发平台:

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. ' *** Insert Record: set variables
  55. If (CStr(Request("MM_insert")) = "form1") Then
  56.   MM_editConnection = MM_conn_news_STRING
  57.   MM_editTable = "t_type"
  58.   MM_editRedirectUrl = ""
  59.   MM_fieldsStr  = "t_name|value"
  60.   MM_columnsStr = "t_name|',none,''"
  61.   ' create the MM_fields and MM_columns arrays
  62.   MM_fields = Split(MM_fieldsStr, "|")
  63.   MM_columns = Split(MM_columnsStr, "|")
  64.   
  65.   ' set the form values
  66.   For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
  67.     MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  68.   Next
  69.   ' append the query string to the redirect URL
  70.   If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
  71.     If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
  72.       MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
  73.     Else
  74.       MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
  75.     End If
  76.   End If
  77. End If
  78. %>
  79. <%
  80. ' *** Insert Record: construct a sql insert statement and execute it
  81. Dim MM_tableValues
  82. Dim MM_dbValues
  83. If (CStr(Request("MM_insert")) <> "") Then
  84.   ' create the sql insert statement
  85.   MM_tableValues = ""
  86.   MM_dbValues = ""
  87.   For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
  88.     MM_formVal = MM_fields(MM_i+1)
  89.     MM_typeArray = Split(MM_columns(MM_i+1),",")
  90.     MM_delim = MM_typeArray(0)
  91.     If (MM_delim = "none") Then MM_delim = ""
  92.     MM_altVal = MM_typeArray(1)
  93.     If (MM_altVal = "none") Then MM_altVal = ""
  94.     MM_emptyVal = MM_typeArray(2)
  95.     If (MM_emptyVal = "none") Then MM_emptyVal = ""
  96.     If (MM_formVal = "") Then
  97.       MM_formVal = MM_emptyVal
  98.     Else
  99.       If (MM_altVal <> "") Then
  100.         MM_formVal = MM_altVal
  101.       ElseIf (MM_delim = "'") Then  ' escape quotes
  102.         MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
  103.       Else
  104.         MM_formVal = MM_delim + MM_formVal + MM_delim
  105.       End If
  106.     End If
  107.     If (MM_i <> LBound(MM_fields)) Then
  108.       MM_tableValues = MM_tableValues & ","
  109.       MM_dbValues = MM_dbValues & ","
  110.     End If
  111.     MM_tableValues = MM_tableValues & MM_columns(MM_i)
  112.     MM_dbValues = MM_dbValues & MM_formVal
  113.   Next
  114.   MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
  115.   If (Not MM_abortEdit) Then
  116.     ' execute the insert
  117.     Set MM_editCmd = Server.CreateObject("ADODB.Command")
  118.     MM_editCmd.ActiveConnection = MM_editConnection
  119.     MM_editCmd.CommandText = MM_editQuery
  120.     MM_editCmd.Execute
  121.     MM_editCmd.ActiveConnection.Close
  122.     If (MM_editRedirectUrl <> "") Then
  123.       Response.Redirect(MM_editRedirectUrl)
  124.     End If
  125.   End If
  126. End If
  127. %>
  128. <%
  129. Dim rsid
  130. Dim rsid_numRows
  131. Set rsid = Server.CreateObject("ADODB.Recordset")
  132. rsid.ActiveConnection = MM_conn_news_STRING
  133. rsid.Source = "SELECT * FROM t_type ORDER BY t_id DESC"
  134. rsid.CursorType = 0
  135. rsid.CursorLocation = 2
  136. rsid.LockType = 1
  137. rsid.Open()
  138. rsid_numRows = 0
  139. %>
  140. <%
  141. dim f_path
  142. f_path=(rsid.Fields.Item("t_id").Value)
  143. Set fso = CreateObject("Scripting.FileSystemObject")
  144. Fso.Createfolder(server.mappath(f_path))
  145. Set fso = nothing
  146. %>
  147. <html>
  148. <head>
  149. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  150. <meta http-equiv="Refresh" content="1 url=yns_type.asp">
  151. <title>业一新闻系统3.0正式版-------业一网络Yeyi.net制作</title>
  152. </head>
  153. <body>
  154. 数据添加中... 
  155. </body>
  156. </html>
  157. <%
  158. rsid.Close()
  159. Set rsid = Nothing
  160. %>