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

📄 saveaddproinfo.asp

📁 ASP编写的一个公司网站的源程序
💻 ASP
字号:
<%Response.Buffer=true %>
<link rel="stylesheet" href="../Css/css.css" type="text/css">
<!--#include virtual="/include/DBConn.asp"-->
<!--#include virtual="/include/ChkSession.asp"-->
<!--#include virtual="/include/upload_5xsoft.inc"--> 
<!--#include virtual="/include/FuncPub.asp"-->
<!--#include virtual="/include/Const.asp"-->
<!--#include file="Menu.asp"-->
<%
Dim Pro_Name
Dim Type_ID
Dim Pro_Content
Dim Pro_simg
Dim Pro_bimg
Dim News_Content
Dim State
Dim Photo_Path
Dim Orderline
Dim Pro_ID

Dim fso
'创建文件上传对象
'Set fileup = Server.CreateObject("SoftArtisans.FileUp")
Dim fileup 
Set fileup = New upload_5xsoft
'创建文件操作对象
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Dim rs,StrSQL
Set rs=server.CreateObject ("ADODB.RecordSet")
	Type_ID = ModifyInput(fileup.form("Type_ID"))
	Pro_Name = ModifyInput(fileup.form("Pro_Name"))
	checkinput
	Pro_Content = Replace(fileup.form("body"),"'","''")
	State = ModifyInput(fileup.form("state"))
	Dim fileupsimg
	Set fileupsimg = fileup.file("Pro_simg")
	Pro_simg = trim(fileupsimg.filename)
	If Pro_simg<>"" then
		IF UCASE(GetFileNameExt(Pro_simg))<>"GIF" and UCASE(GetFileNameExt(Pro_simg))<>"JPG" then
			Response.Write "<script language='javascript'>"
			Response.Write "alert('对不起!你上传的图片格式只能是GIF或JPG!');"
			Response.Write "window.history.go(-1);"
			Response.Write "</script>"
			Response.End
		End IF
		If fileupsimg.filesize > UPLOAD_IMGMAXFILESIZE then
			Response.Write "<script language='javascript'>"
			Response.Write "alert('对不起!请将您的缩小图片控制在5M以下!');"
			Response.Write "window.history.go(-1);"
			Response.Write "</script>"
			Response.End
		End If
	Else
			'Response.Write "<script language='javascript'>"
			'Response.Write "alert('请上传小图片!');"
			'Response.Write "window.history.go(-1);"
			'Response.Write "</script>"
			'Response.End	
	End If
	Dim fileupbimg
	Set fileupbimg = fileup.file("Pro_bimg")
	Pro_bimg = trim(fileupbimg.filename)
	If Pro_bimg<>"" then
		IF UCASE(GetFileNameExt(Pro_bimg))<>"GIF" and UCASE(GetFileNameExt(Pro_bimg))<>"JPG" then
			Response.Write "<script language='javascript'>"
			Response.Write "alert('对不起!你上传的图片格式只能是GIF或JPG!');"
			Response.Write "window.history.go(-1);"
			Response.Write "</script>"
			Response.End
		End IF
		If fileupbimg.filesize > UPLOAD_IMGMAXFILESIZE then
			Response.Write "<script language='javascript'>"
			Response.Write "alert('对不起!请将您的缩小图片控制在5M以下!');"
			Response.Write "window.history.go(-1);"
			Response.Write "</script>"
			Response.End
		End If
	Else
	End If
	'On Error Resume Next
	StrSQL = "Select * From ProInfo Where Pro_ID=0"
	rs.CursorLocation = 3
	rs.Open StrSQL,conn,1,3 
	rs.AddNew 
		rs("Type_ID") = Type_ID
		rs("Pro_Name") = Pro_Name
		rs("Pro_Content") = Pro_Content
		rs("state") = state
	rs.Update 
		Pro_ID = rs("Pro_ID")
	rs.Close
	Conn.Execute "Update ProInfo Set Orderline="&Pro_ID&" where Pro_ID="&Pro_ID	
	Dim strFullPath
	strFullPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
	if Right(strFullPath,1) = "\" then
		strFullPath = left(strFullPath,len(strFullPath)-1)
	end if
If Pro_simg<>"" then
	if fso.FolderExists(strFullPath & UPLOAD_PROPATH & Session("CatID") )=False then
		fso.CreateFolder strFullPath & UPLOAD_PROPATH & Session("CatID")
	end if
	if fso.FolderExists(strFullPath & UPLOAD_PROPATH & Session("CatID") & "\" & Pro_ID )=False then
		fso.CreateFolder strFullPath & UPLOAD_PROPATH & Session("CatID") & "\" & Pro_ID 
	end if
	
	fileupsimg.SaveAs strFullPath & UPLOAD_PROPATH & Session("CatID") & "\" & Pro_ID & "\" & Pro_simg
	
	Pro_simg = Replace(UPLOAD_PROPATH & Session("CatID") & "\" & Pro_ID & "\" & Pro_simg,"\","/")
	Conn.Execute "Update ProInfo Set Pro_simg='"&Pro_simg&"' where Pro_ID="&Pro_ID&""
End IF	
If Pro_bimg<>"" then
	if fso.FolderExists(strFullPath & UPLOAD_PROPATH & Session("CatID") )=False then
		fso.CreateFolder strFullPath & UPLOAD_PROPATH & Session("CatID")
	end if
	if fso.FolderExists(strFullPath & UPLOAD_PROPATH & Session("CatID") & "\" & Pro_ID )=False then
		fso.CreateFolder strFullPath & UPLOAD_PROPATH & Session("CatID") & "\" & Pro_ID 
	end if
	
	fileupsimg.SaveAs strFullPath & UPLOAD_PROPATH & Session("CatID") & "\" & Pro_ID & "\" & Pro_bimg
	
	Pro_simg = Replace(UPLOAD_PROPATH & Session("CatID") & "\" & Pro_ID & "\" & Pro_bimg,"\","/")
	Conn.Execute "Update ProInfo Set Pro_bimg='"&Pro_bimg&"' where Pro_ID="&Pro_ID&""
End IF	
	
	Set rs = Nothing
	Set fileup = Nothing
	Set fso = Nothing
	If Err.number<>0 then
		Call MsgBack("数据库操作错误!","4")
	Else
		Response.Redirect "ProInfoManage.asp"
		Response.End	
	End IF 
	
Sub Checkinput
	Dim Rs,StrSQL
	StrSQL="select count(*) as cou from ProInfo where Pro_Name='"&Pro_Name&"' and type_ID="&Type_ID&""
	set Rs = conn.execute(StrSQL)
	If cint(Rs("cou"))<>0 then
		Rs.close 
		Call MsgBack("标题重复,请重新输入!","4")
		exit Sub
	End If
	Rs.Close
End Sub	
%>

⌨️ 快捷键说明

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