List_Save.asp
上传用户:xxtaishan
上传日期:2022-01-02
资源大小:4063k
文件大小:2k
源码类别:

IP电话/视频会议

开发平台:

ASP/ASPX

  1. <!--#include file="../../inc/conn.asp"-->
  2. <!--#include file="../../inc/FUNC.asp" -->
  3. <!--#include file="../../inc/upload_5xsoft.inc" -->
  4. <%
  5. '-----------------------------
  6. DIM UPLOAD
  7. SET UPLOAD=NEW UPLOAD_5XSOFT
  8. If UPLOAD.FORM("operation")="add" Then
  9. call Add
  10. elseif UPLOAD.FORM("operation")="edit" Then
  11. call Edit
  12. ELSE
  13. call showerr("系统提示:操作无效!")
  14. end if
  15. '-----------------------------
  16. Dim rs
  17. Dim sql
  18. '-----------------------------
  19. Function Add
  20. if UPLOAD.FORM("title")="" then
  21. call showerr("系统提示:标题不能为空!")
  22. end if
  23. if UPLOAD.FORM("content")="" then
  24. call showerr("系统提示:内容不能为空!")
  25. end if
  26. DIM FILE
  27. set file=upload.file("file")
  28. if file.FileSize<=0 then
  29. call showerr("系统提示:请上传产品图片!")
  30. end if
  31. set rs=server.createobject("adodb.recordset")
  32. rs.open "select * from product1",conn,1,3
  33. rs.addnew
  34. rs("hh")=UPLOAD.FORM("hh")
  35. rs("title")=UPLOAD.FORM("title")
  36. rs("content")=UPLOAD.FORM("content")
  37. rs("postdate")=DATE()
  38. rs("classid")=UPLOAD.FORM("classid")
  39. if UPLOAD.FORM("nclassid")<>"" then
  40. rs("nclassid")=UPLOAD.FORM("nclassid")
  41. end if
  42. if file.FileSize>0 then
  43. file.saveAs Server.mappath("../../upload2/"&rs("id")&getfilename(file.FileName))
  44. rs("pic")=rs("id")&getfilename(file.FileName)
  45. end if 
  46. rs.Update
  47. call showmsg("系统提示:信息添加成功!","list_add.asp")
  48. End Function
  49. '-----------------------------
  50. Function Edit
  51. if UPLOAD.FORM("title")="" then
  52. call showerr("系统提示:标题不能为空!")
  53. end if
  54. if UPLOAD.FORM("content")="" then
  55. call showerr("系统提示:内容不能为空!")
  56. end if
  57. set rs=server.createobject("adodb.recordset")
  58. rs.open "select * from product1 where id="&UPLOAD.FORM("id"),conn,1,3
  59. rs("hh")=UPLOAD.FORM("hh")
  60. rs("title")=UPLOAD.FORM("title")
  61. rs("content")=UPLOAD.FORM("content")
  62. rs("postdate")=DATE()
  63. rs("classid")=UPLOAD.FORM("classid")
  64. rs("nclassid")=UPLOAD.FORM("nclassid")
  65. DIM FILE
  66. set file=upload.file("file")
  67. if file.FileSize>0 then
  68. IF GETFILENAME(RS("pic"))<>GETFILENAME(FILE.FILENAME) THEN
  69. CALL DoDelFile("../../upload2/"&RS("pic"))
  70. END IF
  71. file.saveAs Server.mappath("../../upload2/"&rs("id")&getfilename(file.FileName))
  72. rs("pic")=rs("id")&getfilename(file.FileName)
  73. end if 
  74. rs.Update
  75. call showmsg("系统提示:信息修改成功!","list.asp")
  76. End Function
  77. '-----------------------------
  78. %>
  79. <%
  80. call COCLS
  81. %>