%
stats="个人上传管理"
call nav()
Dim TopicCount
Dim Pcount,endpage,star,page_count
if request("star")="" or not isnumeric(request("star")) then
star=1
else
star=clng(request("star"))
end if
if not founduser then
errmsg=errmsg+"
"+"
您没有登录。"
founderr=true
end if
if founderr=true then
call head_var(2,0,"","")
call dvbbs_error()
else
call head_var(0,0,membername & "的控制面板","usermanager.asp")
select case request("action")
case "edit"
call edit()
case "fsave"
call filesave()
case "fadd"
call addnew()
case "fsnew"
call savenew()
case "fdel"
call fdel()
case "alldel"
call alldel()
case else
call main()
end select
if founderr then call dvbbs_error()
end if
call activeonline()
call footer()
sub main()
dim sname
dim stype
dim searchsql
stype=request("Stype")
TopicCount=filenum("")
if stype="" or not isnumeric(stype) then
sname="所有文件"
searchsql=""
TopicCount=filenum("")
else
select case stype
case 1
sname="图片集"
searchsql="F_Type=1 and"
case 2
sname="FLASH集"
searchsql="F_Type=2 and"
case 3
sname="音乐集"
searchsql="F_Type=3 and"
case 4
sname="电影集"
searchsql="F_Type=4 and"
case 0
sname="文件集"
searchsql="F_Type=0 and"
case else
sname="所有文件"
searchsql=""
end select
TopicCount=filenum(clng(stype))
end if
%>
<%
dim F_Type,F_typename
'---------------------
response.write""
call list()
end sub
'分页代码
sub list()
response.write ""
end sub
'编辑文件
sub edit()
dim editid
dim F_Type,F_typename,filename,chefile,con,body
dim F_Username,postid,F_rootid,F_bbsid
dim myurl
myurl=false
editid=trim(request("editid"))
if not isnumeric(editid) or isnull(editid) then
errmsg=errmsg+"
"+"执行的数据不存在。"
founderr=true
exit sub
end if
set rs=conn.execute("select * from [DV_Upfile] where F_ID="&editid)
if rs.eof and rs.bof then
errmsg=errmsg+"
"+"编辑的文件已不存在。"
founderr=true
exit sub
else
F_Username=rs("F_Username")
F_Type=rs("F_Type")
filename=rs("F_Filename")
con=rs("F_Readme")
if instr(filename,"/")=0 then
myurl=true
filename="UploadFile/"&filename
end if
if F_Type=1 then
F_typename="
"
else
F_typename=rs("F_FileType")&"文件"
end if
if con<>"" then
body=replace(con,"
",chr(13))
body=replace(body," ","")
body=body+chr(13)
end if
%>
<%
end if
rs.close
set rs=nothing
end sub
'保存修改
sub filesave()
if GroupSetting(48)=0 then
errmsg=errmsg+"
"+"您没有论坛文件管理的权限,请与管理员联系。"
founderr=true
exit sub
end if
dim saveid,F_Readme,Fflag,fileurl
dim F_BoardID,F_AnnounceID
F_BoardID=checkStr(trim(request.form("F_BoardID")))
F_AnnounceID=checkStr(trim(request.form("F_AnnounceID")))
F_Readme=checkStr(trim(request.form("F_Readme")))
saveid=trim(request.form("saveid"))
Fflag=trim(request.form("Fflag"))
if not isnumeric(Fflag) or not isnumeric(F_BoardID) then
errmsg=errmsg+"
"+"执行的数据不存在,或不合符要求。"
founderr=true
exit sub
end if
if not isnumeric(saveid) or isnull(saveid) then
errmsg=errmsg+"
"+"执行的数据不存在。"
founderr=true
exit sub
end if
if F_Readme="" or isnull(F_Readme) then
errmsg=errmsg+"
"+"说明内容不能为空。"
founderr=true
exit sub
end if
if strLength(F_Readme)>250 then
ErrMsg=ErrMsg+"
"+"说明内容不得大于" & 250 & "bytes"
FoundErr=true
exit sub
end if
fileurl=checkStr(trim(request.form("fileurl")))
if fileurl<>"" then
if instr(fileurl,"/")=0 or instr(fileurl,"://")=0 or instr(fileurl,".")=0 then
ErrMsg=ErrMsg+"
"+"请填写完整的文件链接地址!"
FoundErr=true
exit sub
end if
conn.execute("update [DV_Upfile] set F_Filename='"&fileurl&"',F_Readme='"&F_Readme&"' ,F_Flag="&Fflag&" where F_ID="&saveid)
else
conn.execute("update [DV_Upfile] set F_BoardID="&F_BoardID&",F_AnnounceID='"&F_AnnounceID&"',F_Readme='"&F_Readme&"' ,F_Flag="&Fflag&" where F_ID="&saveid)
end if
sucmsg=sucmsg+"
"+"编辑成功。[返回管理页面]"
call dvbbs_suc()
end sub
'新增文件
sub addnew()
%>
<%
end sub
'保存新增文件
sub savenew()
if GroupSetting(48)=0 then
errmsg=errmsg+"
"+"您没有论坛文件管理的权限,请与管理员联系。"
founderr=true
exit sub
end if
dim F_Readme,fileurl,filetype,fileExt,fileExt_a,filename
dim F_Type,F_Flag
F_Readme=checkStr(trim(request.form("F_Readme")))
fileurl=checkStr(trim(request.form("fileurl")))
filetype=trim(request.form("filetype"))
F_Flag=trim(request.form("Fflag"))
if fileurl="" or isnull(fileurl) then
errmsg=errmsg+"
"+"文件链接不能为空。"
founderr=true
exit sub
else
if strLength(fileurl)>250 then
ErrMsg=ErrMsg+"
"+"文件链接不得大于" & 250 & "bytes"
FoundErr=true
exit sub
end if
end if
if F_Readme="" or isnull(F_Readme) then
errmsg=errmsg+"
"+"说明内容不能为空。"
founderr=true
exit sub
end if
if strLength(F_Readme)>250 then
ErrMsg=ErrMsg+"
"+"说明内容不得大于" & 250 & "bytes"
FoundErr=true
exit sub
end if
if not isnumeric(F_Flag) then
errmsg=errmsg+"
"+"执行的数据不存在。"
founderr=true
exit sub
end if
if instr(fileurl,"/")=0 or instr(fileurl,"://")=0 or instr(fileurl,".")=0 then
ErrMsg=ErrMsg+"
"+"请填写完整的文件链接地址!"
FoundErr=true
exit sub
else
filename=split(fileurl,"/")
fileExt=lcase(filename(ubound(filename)))
end if
fileExt_a=split(fileExt,".")
fileExt=lcase(fileExt_a(ubound(fileExt_a)))
if fileEXT="asp" and fileEXT="asa" and fileEXT="aspx" then
ErrMsg=ErrMsg+"
"+"文件格式不支持,请重新填写!"
FoundErr=true
exit sub
end if
if lcase(fileExt)="gif" or lcase(fileExt)="jpg" or lcase(fileExt)="jpeg" or lcase(fileExt)="bmp" or lcase(fileExt)="png" then
F_Type=1
elseif lcase(fileExt)="swf" or lcase(fileExt)="swi" then
F_Type=2
elseif lcase(fileExt)="mid" or lcase(fileExt)="wav" or lcase(fileExt)="mp3" or lcase(fileExt)="rmi" or lcase(fileExt)="cda" then
F_Type=3
elseif lcase(fileExt)="avi" or lcase(fileExt)="wov" or lcase(fileExt)="asf" or lcase(fileExt)="mpg" or lcase(fileExt)="mpeg" or lcase(fileExt)="ra" or lcase(fileExt)="ram" then
F_Type=4
else
F_Type=0
end if
BoardID=0
conn.execute("insert into dv_upfile (F_BoardID,F_UserID,F_Username,F_Filename,F_FileType,F_Type,F_Readme,F_Flag ) values ("&BoardID&","&UserID&",'"&membername&"','"&replace(fileurl,"|","")&"','"&replace(fileExt,".","")&"',"&F_Type&",'"&F_Readme&"',"&F_Flag&" )")
sucmsg=sucmsg+"
"+"编辑成功。[返回管理页面]"
call dvbbs_suc()
end sub
'删除文件
sub fdel()
dim delid
if GroupSetting(48)=0 then
errmsg=errmsg+"
"+"您没有论坛文件管理的权限,请与管理员联系。"
founderr=true
exit sub
end if
delid=replace(request("delid"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
if delid="" or isnull(delid) then
Errmsg=Errmsg+""+"请选择相关参数。"
founderr=true
exit sub
else
if master or superboardmaster or boardmaster then
conn.execute("delete from DV_Upfile where F_ID in ("&delid&")")
else
conn.execute("delete from DV_Upfile where F_Flag=1 and F_ID in ("&delid&")")
end if
sucmsg=sucmsg+"
"+"您已经删除选定的文件记录。"
call dvbbs_suc()
end if
end sub
'删除所有文件
sub alldel()
if GroupSetting(48)=0 then
errmsg=errmsg+"
"+"您没有论坛文件管理的权限,请与管理员联系。"
founderr=true
exit sub
end if
dim delid
delid=replace(request("delid"),"'","")
if delid="" or isnull(delid) then
Errmsg=Errmsg+""+"请选择相关参数。"
founderr=true
exit sub
end if
'conn.execute("delete from DV_Upfile where F_Flag=1 and F_UserID="&userid)
sucmsg=sucmsg+"
"+"您已经删除了所有文件记录。"
call dvbbs_suc()
end sub
function filenum(types)
dim stype
if isnumeric(types) then
select case types
case 0
stype="F_Type=0 and"
case 1
stype="F_Type=1 and"
case 2
stype="F_Type=2 and"
case 3
stype="F_Type=3 and"
case 4
stype="F_Type=4 and"
case else
stype=""
end select
else
stype=""
end if
rs=conn.execute("Select Count(F_ID) From DV_Upfile Where "&stype&" F_UserID="&userid&"")
filenum=rs(0)
set rs=nothing
if isnull(filenum) then filenum=0
end function
%>