%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true
%>
<%
if CheckUserLogined()=False then
response.Redirect "User_Login.asp"
end if
dim Action,rs,sql,ErrMsg,FoundErr,ObjInstalled
dim SoftID,ClassID,SoftName,SoftVersion,SoftType,SoftLanguage,CopyrightType,OperatingSystem,Author,AuthorEmail,AuthorHomepage
dim DemoUrl,RegUrl,SoftPicUrl,SoftIntro,Keyword,UpdateTime,Editor
dim Passed,DecompressPassword,SoftSize,DownloadUrl1,DownloadUrl2,DownloadUrl3,DownloadUrl4
dim tClass,ClassName,Depth,ParentPath,Child,i
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
FoundErr=false
Action=trim(request("Action"))
SoftID=Trim(Request.Form("SoftID"))
ClassID=trim(request.form("ClassID"))
SoftName=trim(request.form("SoftName"))
SoftVersion=trim(request.form("SoftVersion"))
SoftType=trim(request.form("SoftType"))
SoftLanguage=trim(request.form("SoftLanguage"))
CopyrightType=trim(request.form("CopyrightType"))
OperatingSystem=trim(request.form("OperatingSystem"))
Author=trim(request.form("Author"))
AuthorEmail=trim(request.form("AuthorEmail"))
AuthorHomepage=trim(request.form("AuthorHomePage"))
DemoUrl=trim(request.form("DemoUrl"))
RegUrl=trim(request.form("RegUrl"))
SoftPicUrl=trim(request.form("SoftPicUrl"))
SoftIntro=trim(request.form("SoftIntro"))
Keyword=trim(request.form("Keyword"))
Editor=trim(Request.Cookies("asp163")("UserName"))
DecompressPassword=trim(request.form("DecompressPassword"))
SoftSize=trim(request.form("SoftSize"))
DownloadUrl1=trim(request.form("DownloadUrl1"))
DownloadUrl2=trim(request.form("DownloadUrl2"))
DownloadUrl3=trim(request.form("DownloadUrl3"))
DownloadUrl4=trim(request.form("DownloadUrl4"))
if Action="" then
FoundErr=True
ErrMsg=ErrMsg & "
参数不足
"
else
call SaveSoft()
end if
if founderr=true then
call WriteErrMsg()
else
call SaveSuccess()
end if
call CloseConn()
sub SaveSoft()
if ClassID="" then
founderr=true
errmsg=errmsg & "
未指定软件所属栏目或者指定的栏目有下属子栏目
"
else
ClassID=CLng(ClassID)
if ClassID=0 then
FoundErr=True
ErrMsg=ErrMsg & "
软件所属栏目不能指定为外部栏目
"
elseif ClassID=-1 then
FoundErr=True
ErrMsg=ErrMsg & "
你没有在你指定的栏目添加软件的权限
"
else
set tClass=conn.execute("select ClassName,Depth,ParentPath,Child,LinkUrl,AddPurview From SoftClass where ClassID=" & ClassID)
if tClass.bof and tClass.eof then
founderr=True
ErrMsg=ErrMsg & "
找不到指定的栏目
"
else
ClassName=tClass(0)
Depth=tClass(1)
ParentPath=tClass(2)
Child=tClass(3)
if Child>0 then
FoundErr=True
ErrMsg=ErrMsg & "
指定的栏目有下属子栏目
"
end if
if tClass(4)<>"" then
FoundErr=True
ErrMsg=ErrMsg & "
不能指定外部栏目
"
end if
if Clng(tClass(5))
你没有在你指定的栏目添加软件的权限
"
end if
end if
end if
end if
if SoftName="" then
founderr=true
errmsg=ErrMsg & "
软件名称不能为空
"
end if
if SoftVersion="" then
founderr=true
errmsg=ErrMsg & "
软件版本不能为空
"
end if
if Author="" then
founderr=true
errmsg=errmsg & "
请输入软件作者/开发商
"
end if
if Keyword="" then
founderr=true
errmsg=errmsg & "
请输入软件关键字
"
end if
if SoftIntro="" then
founderr=true
errmsg=errmsg & "
软件简介不能为空
"
end if
if DownloadUrl1="" then
founderr=true
errmsg=errmsg & "
软件下载地址1不能为空
"
end if
if FoundErr=True then
exit sub
end if
if SoftType<>"" then
SoftType=CLng(SoftType)
else
SoftType=0
end if
if SoftLanguage<>"" then
SoftLanguage=CLng(SoftLanguage)
else
SoftLanguage=0
end if
if CopyrightType<>"" then
CopyrightType=CLng(CopyrightType)
else
CopyrightType=0
end if
Keyword="|" & ReplaceBadChar(Keyword) & "|"
UpdateTime=now()
if SoftSize="" then
SoftSize=0
else
SoftSize=Clng(SoftSize)
end if
set rs=server.createobject("adodb.recordset")
if Action="Add" then
sql="select top 1 * from Soft"
rs.open sql,conn,1,3
rs.addnew
call SaveData()
rs.update
SoftID=rs("SoftID")
Passed=rs("Passed")
rs.close
elseif Action="Modify" then
if SoftID="" then
founderr=true
errmsg=errmsg & "
不能确定SoftID的值
"
else
SoftID=Clng(SoftID)
sql="select * from Soft where Softid=" & SoftID
rs.open sql,conn,1,3
if rs.bof and rs.eof then
founderr=true
errmsg=errmsg & "
找不到此软件,可能已经被其他人删除。
"
else
call SaveData()
rs.update
Passed=rs("Passed")
rs.close
end if
end if
else
FoundErr=True
ErrMsg="
参数错误!
"
end if
set rs=nothing
end sub
sub SaveData()
rs("ClassID")=ClassID
rs("SoftName")=SoftName
rs("SoftVersion")=SoftVersion
rs("SoftType")=SoftType
rs("SoftLanguage")=SoftLanguage
rs("CopyrightType")=CopyrightType
rs("OperatingSystem")=OperatingSystem
rs("Author")=Author
rs("AuthorEmail")=AuthorEmail
rs("AuthorHomepage")=AuthorHomepage
rs("DemoUrl")=DemoUrl
rs("RegUrl")=RegUrl
rs("SoftPicUrl")=SoftPicUrl
rs("SoftIntro")=SoftIntro
rs("Keyword")=Keyword
rs("Hits")=0
rs("DayHits")=0
rs("WeekHits")=0
rs("MonthHits")=0
rs("SoftLevel")=9999
rs("SoftPoint")=0
rs("Stars")=0
rs("UpdateTime")=UpdateTime
rs("Passed")=False
rs("OnTop")=False
rs("Elite")=False
rs("DecompressPassword")=DecompressPassword
rs("SoftSize")=SoftSize
rs("DownloadUrl1")=DownloadUrl1
rs("DownloadUrl2")=DownloadUrl2
rs("DownloadUrl3")=DownloadUrl3
rs("DownloadUrl4")=DownloadUrl4
rs("Editor")=Editor
end sub
sub SaveSuccess()
%>