<!--#include file="conn.asp"-->
<!--#include file="chkadmin.asp"-->
<!--#include file="inc/char.asp"-->
<%dim id,ClassID,FileName,FileSize,RunSystem,Grade,FTP,FtpFile,URL,Chinese,Crack
dim Brief,LinkText,LinkURL,SmallImage,BigImage,Best,Hidden,Member,Keyword,Poster
id=CInt(Trim(Request.Form("id")))
ClassID=CInt(Trim(Request.Form("ClassID")))
FileName=Trim(Request.Form("FileName"))
Keyword=Trim(Request.Form("Keyword"))
FileSize=Trim(Request.Form("FileSize"))
RunSystem=Trim(Request.Form("RunSystem"))
Grade=CInt(Trim(Request.Form("Grade")))
FTP=Trim(Request.Form("FTP"))
FtpFile=Trim(Request.Form("FtpFile"))
URL=Trim(Request.Form("URL"))
Chinese=Trim(Request.Form("Chinese"))
Crack=Trim(Request.Form("Crack"))
Brief=RTrim(Request.Form("Brief"))
LinkText=Trim(Request.Form("LinkText"))
LinkURL=Trim(Request.Form("LinkURL"))
SmallImage=Trim(Request.Form("SmallImage"))
BigImage=Trim(Request.Form("BigImage"))
SmallImage=Trim(Request.Form("SmallImage"))
Best=Trim(Request.Form("Best"))
Hidden=Trim(Request.Form("Hidden"))
Member=Trim(Request.Form("Member"))
Poster=Trim(Request.Form("Poster"))

dim Info,Picture,FtpDown
Info=FileSize&"|"&RunSystem&"|"&LinkText&"|"&LinkURL
Picture=SmallImage&"|"&BigImage
if FtpFile<>"" then FtpDown=FTP&"|"&FtpFile else FtpDown="" end if
if SmallImage<>"" then Picture=SmallImage&"|"&BigImage else Picture="" end if
if Best="" then Best=false end if
if Hidden="" then Hidden=false end if
if Member="" then Member=false end if

dim errmsg,founderr
founderr=false

if chkadmin=false or power(2)="0" or (Poster<>session("adm_usr") and power(4)="0") then
	founderr=true
	errmsg=errmsg+"<li>您没有修改此软件的权限</li>"
end if

if FileName="" then
	founderr=true
	errmsg=errmsg+"<li>软件名称不能为空</li>"
elseif strlen(FileName)>80 then
	founderr=true
	errmsg=errmsg+"<li>软件名称不能大于80个字符</li>"
end if

if Keyword="" then
	founderr=true
	errmsg=errmsg+"<li>关键字不能为空</li>"
elseif strlen(Keyword)>40 then
	founderr=true
	errmsg=errmsg+"<li>关键字不能大于40个字符</li>"
end if

if FileSize="" then
	founderr=true
	errmsg=errmsg+"<li>软件大小不能为空</li>"
end if

'if URL="" and FtpFile="" then
	'founderr=true
	'errmsg=errmsg+"<li>下载地址不能为空</li>"
'end if

if founderr=false then
	conn.execute("update Software set FileName='"&FileName&"',Info='"&Info&"',Grade="&Grade&",Keyword='"&Keyword&"',URL='"&URL&"',Chinese='"&Chinese&"',Crack='"&Crack&"',FtpDown='"&FtpDown&"',Brief='"&Brief&"',Picture='"&Picture&"',Best="&Best&",Hidden="&Hidden&",Member="&Member&",ClassID="&ClassID&",LastUpdate=now() where ID="&id)
	dim gourl,msg
	gourl=Trim(Request.Form("gourl"))
	msg="软件修改成功！"
	call ok()
else
	call error()
end if

conn.close
set conn=nothing
%>