?? bs_article_save.asp
字號(hào):
<!--#include file="bsconfig.asp"-->
<!--#include file="../Inc/Config.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
'=========================================================
'
' 中聯(lián)企業(yè)網(wǎng)站管理系統(tǒng)
' www.xpcode.cn,QQ:275084681
' www.*****.net
'
' copyright(c)2006
'
'=========================================================
%>
<%
Dim SERVER_NAME
SERVER_NAME=trim(Request.ServerVariables("SERVER_NAME"))
if SERVER_NAME= ""&chr(119)&chr(119)&chr(119)&chr(46)&chr(106)&chr(109)&chr(107)&chr(46)&chr(99)&chr(111)&chr(109)&chr(46)&chr(99)&chr(110)&"" or ""&chr(46)&chr(106)&chr(109)&chr(107)&chr(46)&chr(99)&chr(111)&chr(109)&chr(46)&chr(99)&chr(110)&"" or ""&chr(108)&chr(111)&chr(99)&chr(97)&chr(108)&chr(104)&chr(111)&chr(115)&chr(116)&"" or ""&chr(49)&chr(50)&chr(55)&chr(46)&chr(48)&chr(46)&chr(48)&chr(46)&chr(49)&"" then
dim rs,sql,ErrMsg,FoundErr
dim ArticleID,Product_Id,BigClassName,EnBigClassName,SmallClassName,EnSmallClassName,Title,EnTitle,Spec,EnSpec,Size,Memo,EnMemo,Content,EnContent,key,UpdateTime,Hits
dim IncludePic,DefaultPicUrl,UploadFiles,Elite,Enelite,Passed,arrUploadFiles
dim ObjInstalled
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
FoundErr=false
ArticleID=Trim(Request.Form("ArticleID"))
Product_Id=trim(request.form("Product_Id"))
BigClassName=trim(request.form("BigClassName"))
SmallClassName=trim(request.form("SmallClassName"))
Title=trim(request.form("Title"))
EnTitle=trim(request.form("EnTitle"))
Spec=trim(request.form("Spec"))
EnSpec=trim(request.form("EnSpec"))
Size=trim(request.form("Size"))
Memo=trim(request.form("Memo"))
EnMemo=trim(request.form("EnMemo"))
Key=trim(request.form("Key"))
Content=trim(request.form("Content"))
EnContent=trim(request.form("EnContent"))
UpdateTime=trim(request.form("UpdateTime"))
IncludePic=trim(request.form("IncludePic"))
DefaultPicUrl=trim(request.form("DefaultPicUrl"))
UploadFiles=trim(request.form("UploadFiles"))
Passed=trim(request.form("Passed"))
Elite=trim(request.form("Elite"))
EnElite=trim(request.form("EnElite"))
Hits=trim(request.form("Hits"))
sqlBig="select * from Bs_PrBigClass where BigClassName='" & BigClassName & "'"
Set rsBig= Server.CreateObject("ADODB.Recordset")
rsBig.open sqlBig,conn,1,1
EnBigClassName=rsBig("EnBigClassName")
rsBig.close
sqlSmall="select * from Bs_PrSmallClass where SmallClassName='" & SmallClassName & "' and BigClassName='" & BigClassName & "'"
Set rsSmall= Server.CreateObject("ADODB.Recordset")
rsSmall.open sqlSmall,conn,1,1
EnSmallClassName=rsSmall("EnSmallClassName")
rsSmall.close
if BigClassName="" then
founderr=true
errmsg=errmsg+"<li>未指定文章所屬大類</li>"
end if
if Title="" then
founderr=true
errmsg="<li>文章標(biāo)題不能為空</li>"
end if
if Key="" then
founderr=true
errmsg=errmsg+"<li>請(qǐng)輸入文章關(guān)鍵字</li>"
end if
if Content="" then
founderr=true
errmsg=errmsg+"<li>文章內(nèi)容不能為空</li>"
end if
if founderr=false then
Title=dvhtmlencode(Title)
Key=replace(replace(replace(replace(replace(replace(replace(Key,"'",""),"*",""),"?",""),"(",""),")",""),",",""),".","")
Key=Key & " "
Content=ubbcode(Content)
if UpdateTime<>"" and IsDate(UpdateTime)=true then
UpdateTime=CDate(UpdateTime)
else
UpdateTime=now()
end if
if Hits<>"" then
Hits=CLng(Hits)
else
Hits=0
end if
set rs=server.createobject("adodb.recordset")
if request("action")="add" then
sql="select top 1 * from Bs_Product"
rs.open sql,conn,1,3
rs.addnew
call SaveData()
'rs("Editor")=Editor
rs.update
ArticleID=rs("ArticleID")
rs.close
set rs=nothing
elseif request("action")="Modify" then
if ArticleID<>"" then
sql="select * from Bs_Product where articleid=" & ArticleID
rs.open sql,conn,1,3
if not (rs.bof and rs.eof) then
call SaveData()
rs.update
rs.close
set rs=nothing
else
founderr=true
errmsg=errmsg+"<li>找不到此文章,可能已經(jīng)被其他人刪除。</li>"
call WriteErrMsg()
end if
else
founderr=true
errmsg=errmsg+"<li>不能確定ArticleID的值</li>"
call WriteErrMsg()
end if
else
founderr=true
errmsg=errmsg+"<li>沒(méi)有選定參數(shù)</li>"
call WriteErrMsg()
end if
call CloseConn()
%>
<!-- #include file="Inc/Head.asp" -->
<BR>
<table cellpadding="2" cellspacing="1" border="0" width="90%" align="center" class="a2">
<tr>
<td class="a1" height="25" align="center"><strong>添加 修改 產(chǎn)品</strong></td>
</tr>
<tr class="a4">
<td align="center">
<table align=center width="100%" border="0" cellpadding="2" cellspacing="1" bordercolor="#CCCCCC">
<tr align=center bgcolor="#CCCCCC">
<td height="25" colspan="2" bgcolor="#F0F0F0" class="title"><b>
<%if request("action")="add" then%>
添加
<%else%>
修改
<%end if%>
產(chǎn)品成功</b></td>
</tr>
<tr>
<td width="19%" height="22" bgcolor="#F0F0F0" > <p align="right">產(chǎn)品序號(hào):</p></td>
<td width="81%" bgcolor="#F0F0F0" ><%=ArticleID%></td>
</tr>
<tr>
<td height="22" bgcolor="#F0F0F0" ><div align="right">產(chǎn)品編號(hào):</div></td>
<td bgcolor="#F0F0F0" ><%=Product_Id%></td>
</tr>
<tr>
<td height="22" bgcolor="#F0F0F0" ><div align="right">產(chǎn)品名稱:</div></td>
<td bgcolor="#F0F0F0" ><%=Title%></td>
</tr>
<tr>
<td height="22" bgcolor="#F0F0F0" ><div align="right">English名稱:</div></td>
<td bgcolor="#F0F0F0" ><%=EnTitle%></td>
</tr>
<tr>
<td height="22" bgcolor="#F0F0F0" ><div align="right">產(chǎn)品規(guī)格:</div></td>
<td bgcolor="#F0F0F0" ><%=Spec%></td>
</tr>
<tr>
<td height="22" bgcolor="#F0F0F0" ><div align="right">English規(guī)格:</div></td>
<td bgcolor="#F0F0F0" ><%=EnSpec%></td>
</tr>
<tr>
<td height="22" bgcolor="#F0F0F0" ><div align="right">所屬類別:</div></td>
<td bgcolor="#F0F0F0" >
<%
response.write BigClassName
if SmallClassName<>"" then response.write " >> " & SmallClassName
if SpecialName<>"" then response.write "<br>所屬專題:" & SpecialName
%>
</td>
</tr>
<tr>
<td height="22" bgcolor="#F0F0F0" ><div align="right">關(guān)
鍵 字:</div></td>
<td bgcolor="#F0F0F0" ><%=Key%></td>
</tr>
<tr>
<td height="22" colspan="2" bgcolor="#F0F0F0" >
<p align="center"> 【<a href="Bs_Article_edit.asp?ArticleID=<%=ArticleID%>">修改產(chǎn)品</a>】 【<a href="Bs_Article_Add.asp">繼續(xù)添加產(chǎn)品</a>】 【<a href="Bs_Article.asp">產(chǎn)品管理</a>】 【<a href="../Chinese/Bs_ProductShow.asp?ArticleID=<%=ArticleID%>" target="_blank">中文預(yù)覽產(chǎn)品</a>】【<a href="../English/En_ProductShow.asp?ArticleID=<%=ArticleID%>" target="_blank">英文預(yù)覽產(chǎn)品</a>】</p></td>
</tr>
</table>
</td>
</tr>
</table>
<BR>
<%htmlend%>
<%
else
WriteErrMsg
end if
sub SaveData()
rs("Product_Id")=Product_Id
rs("BigClassName")=BigClassName
rs("EnBigClassName")=EnBigClassName
rs("SmallClassName")=SmallClassName
rs("EnSmallClassName")=EnSmallClassName
'rs("SpecialName")=SpecialName
rs("Title")=Title
rs("EnTitle")=EnTitle
rs("Spec")=Spec
rs("EnSpec")=EnSpec
rs("Size")=Size
rs("Memo")=Memo
rs("EnMemo")=EnMemo
rs("Content")=Content
rs("EnContent")=EnContent
rs("Key")=Key
rs("Hits")=Hits
'rs("Author")=Author
'rs("CopyFrom")=CopyFrom
if IncludePic="yes" then
rs("IncludePic")=True
else
rs("IncludePic")=False
end if
if Passed="yes" then
rs("Passed")=True
else
if EnableArticleCheck="No" then
rs("Passed")=True
else
rs("Passed")=False
end if
end if
'if OnTop="yes" then
'rs("OnTop")=True
'else
'rs("OnTop")=False
'end if
'if Hot="yes" then
'rs("Hot")=True
'else
'rs("Hot")=False
'end if
if Elite="yes" then
rs("Elite")=True
else
rs("Elite")=False
end if
if EnElite="yes" then
rs("EnElite")=True
else
rs("EnElite")=False
end if
rs("UpdateTime")=UpdateTime
'***************************************
'刪除無(wú)用的上傳文件
if ObjInstalled=True and UploadFiles<>"" then
dim fso,strRubbishFile
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if instr(UploadFiles,"|")>1 then
dim arrUploadFiles,intTemp
arrUploadFiles=split(UploadFiles,"|")
UploadFiles=""
for intTemp=0 to ubound(arrUploadFiles)
if instr(Content,arrUploadFiles(intTemp))<=0 and arrUploadFiles(intTemp)<>DefaultPicUrl then
strRubbishFile=server.MapPath("../" & arrUploadFiles(intTemp))
if fso.FileExists(strRubbishFile) then
fso.DeleteFile(strRubbishFile)
response.write "<br><li>" & arrUploadFiles(intTemp) & "在文章中沒(méi)有用到,也沒(méi)有被設(shè)為首頁(yè)圖片,所以已經(jīng)被刪除!</li>"
end if
else
if intTemp=0 then
UploadFiles=arrUploadFiles(intTemp)
else
UploadFiles=UploadFiles & "|" & arrUploadFiles(intTemp)
end if
end if
next
else
if instr(Content,UploadFiles)<=0 and UploadFiles<>DefaultPicUrl then
strRubbishFile=server.MapPath("../" & UploadFiles)
if fso.FileExists(strRubbishFile) then
fso.DeleteFile(strRubbishFile)
response.write "<br><li>" & UploadFiles & "在文章中沒(méi)有用到,也沒(méi)有被設(shè)為首頁(yè)圖片,所以已經(jīng)被刪除!</li>"
end if
UploadFiles=""
end if
end if
set fso=nothing
end If
'結(jié)束
'***************************************
rs("DefaultPicUrl")=DefaultPicUrl
rs("UploadFiles")=UploadFiles
end sub
else
response.write "<br>"
response.write ""&chr(-19508)&chr(-12046)&chr(-12620)&chr(-10334)&chr(-19743)&chr(-23636)&chr(60)&chr(97)&chr(32)&chr(104)&chr(114)&chr(101)&chr(102)&chr(61)&chr(34)&chr(46)&chr(46)&chr(47)&chr(97)&chr(100)&chr(109)&chr(105)&chr(110)&chr(47)&chr(114)&chr(101)&chr(103)&chr(46)&chr(97)&chr(115)&chr(112)&chr(34)&chr(62)&chr(-14357)&chr(-10334)&chr(-19743)&chr(60)&chr(47)&chr(97)&chr(62)&""
response.end%>
<%end if%>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -