<!--#include file="conn.asp"-->
<!--#include file="chkmember.asp"-->
<!--#include file="admin/inc/char.asp"-->
<%dim ClassID,FileName,FileSize,RunSystem,Grade,URL,Chinese,Crack
dim Brief,LinkText,LinkURL,SmallImage,BigImage,Best,Keyword
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")))
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"))

dim Info,Picture
Info=FileSize&"|"&RunSystem&"|"&LinkText&"|"&LinkURL
Picture=SmallImage&"|"&BigImage
if SmallImage<>"" then Picture=SmallImage&"|"&BigImage else Picture=""
if Best="" then Best=false

dim errmsg,founderr
founderr=false

if chkmember=false or power(0)="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="" then
	founderr=true
	errmsg=errmsg+"<li>下载地址不能为空</li>"
end if

if founderr=false then
	conn.execute("insert into Software (FileName,Info,Grade,Keyword,URL,Chinese,Crack,Brief,Picture,Best,ClassID,Poster,PostType,Point) values ('"&FileName&"','"&Info&"',"&Grade&",'"&Keyword&"','"&URL&"','"&Chinese&"','"&Crack&"','"&Brief&"','"&Picture&"',"&Best&","&ClassID&",'"&Request.Cookies("ydxz")("usr")&"',1,'0,0,0,0,0')")
	dim gourl,msg
	gourl="post_step1.asp"
	msg="软件已发布，请等待我们的审核！"
	call ok()
else
	call error()
end if

conn.close
set conn=nothing
%>