?? news_save.asp
字號(hào):
<!--#include file="conn.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="../Inc/Config.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
ID=Request.Form("ID")
Title=Trim(request.form("Title"))
BigClassName=trim(request.form("BigClassName"))
SmallClassName=trim(request.form("SmallClassName"))
Content=trim(request.form("Content"))
User=Trim(request.form("User"))
FirstImageName=trim(request.form("DefaultPicUrl"))
Ok=Trim(request.form("Ok"))
Infotime=trim(request.form("Infotime"))
Hits=trim(request.form("Hits"))
Action=trim(request("Action"))
if BigClassName="" then
founderr=true
errmsg=errmsg+"<li>未指定新聞所屬大類</li>"
end if
if Title="" then
founderr=true
errmsg="<li>新聞標(biāo)題不能為空</li>"
end if
if Content="" then
founderr=true
errmsg=errmsg+"<li>新聞內(nèi)容不能為空</li>"
end if
if founderr=false then
Title=dvhtmlencode(Title)
if Infotime<>"" and IsDate(Infotime)=true then
Infotime=CDate(Infotime)
else
Infotime=now()
end if
if Hits<>"" then
Hits=CLng(Hits)
else
Hits=0
end if
set rs=server.createobject("adodb.recordset")
select case Action
case "Add"
sql="select * from Newswygk where (id is null)"
rs.open sql,conn,1,3
rs.addnew
call SaveData()
rs.update
rs.close
set rs=nothing
response.redirect "News_Manage.asp"
case "Modify"
if ID<>"" then
sql="select * from Newswygk where id="&ID
rs.open sql,conn,1,3
if not (rs.bof and rs.eof) then
call SaveData()
rs.update
rs.close
set rs=nothing
response.redirect "News_Manage.asp"
else
founderr=true
errmsg=errmsg+"<li>找不到此新聞,可能已經(jīng)被刪除。</li>"
call WriteErrMsg()
end if
else
founderr=true
errmsg=errmsg+"<li>不能確定ID的值</li>"
call WriteErrMsg()
end if
Case else
founderr=true
errmsg=errmsg+"<li>沒有選定參數(shù)</li>"
call WriteErrMsg()
end select
call CloseConn()
else
WriteErrMsg
end if
%>
<%
sub SaveData()
rs("Title")=Title
rs("Content")=Content
rs("User")=User
rs("BigClassName")=BigClassName
rs("SmallClassName")=SmallClassName
rs("Infotime")=Infotime
rs("Hits")=Hits
if Ok="yes" then
rs("Ok")=True
else
rs("Ok")=False
end if
'***************************************
'刪除無用的上傳文件
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)<>FirstImageName then
strRubbishFile=server.MapPath("../" & arrUploadFiles(intTemp))
if fso.FileExists(strRubbishFile) then
fso.DeleteFile(strRubbishFile)
response.write "<br><li>" & arrUploadFiles(intTemp) & "在文章中沒有用到,也沒有被設(shè)為首頁圖片,所以已經(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<>FirstImageName then
strRubbishFile=server.MapPath("../" & UploadFiles)
if fso.FileExists(strRubbishFile) then
fso.DeleteFile(strRubbishFile)
response.write "<br><li>" & UploadFiles & "在文章中沒有用到,也沒有被設(shè)為首頁圖片,所以已經(jīng)被刪除!</li>"
end if
UploadFiles=""
end if
end if
set fso=nothing
end If
'結(jié)束
'***************************************
rs("FirstImageName")=FirstImageName
end sub
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -