admin_works.asp

来自「本人仅业余学习一些基础的ASP知识以供系统设计之用,并非专业人员,相关服务器设置」· ASP 代码 · 共 1,895 行 · 第 1/5 页

ASP
1,895
字号
	list_Adminid=0
Elseif list_Adminid=0 then
Else
	if IsNumeric(list_Adminid)=false then
		ErrCodes = ErrCodes & "<li>您输入的作品管理员ID无效,请查询后输入或留空!</li><br>"
		FoundErr=True
	end if
	set rs_a=server.createobject("adodb.recordset")
	sql_a="select Author_ID from author where Author_ID="&list_Adminid
	rs_a.open sql_a,conn,1,1
	if rs_a.bof and rs_a.eof then
		ErrCodes = ErrCodes & "<li>您输入的作品管理员ID无效,请查询后输入或留空!</li><br>"
		FoundErr=True 
	else
		list_Adminid=int(list_Adminid)
	end if
	rs_a.close
	set rs_a=nothing
end if
if request.Form("pic")="" then
	pic="images/0.jpg"
Else
	pic=trim(request.Form("pic"))
	if len(pic) > 255 then
		ErrCodes = ErrCodes & "<li>最新图片中输入字符超限,请简短后重新输入仅(允许255字符,且不要输入中文)!</li><br>"
		FoundErr=True
	end if
	picload=False
	if request.Form("list_loadpic")="True" then
		If Left(Lcase(pic),7)="http://" Then
			fileExt=split(pic,".")
			imgsExt=fileExt(ubound(fileExt))													'获取图片后缀
			randomize
			ranNum=int(90000*rnd)+10000
			Filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&imgsExt
			If SaveRemoteFile(SiteSystemPath &"BookFace/"& FileName,pic,pic)=True Then
				If not CheckFileType(Server.mappath(SiteSystemPath &"BookFace/"& FileName)) then
					file1=SiteSystemPath &"BookFace/"& FileName
					FSOFiledel(file1)
					pic="images/0.jpg"
				else
					set rsfile=server.createobject("adodb.recordset") 
					strSQL ="select id,fileurl_info,fileurl_name,fileurl_user,fileurl_size,fileurl_path,fileurl_class,fileurl_Types from filetest where fileurl_class=3 and fileurl_name='"&FileName&"' order by id desc"
					rsfile.open strSQL,conn,1,3
						rsfile.addnew
						rsfile("fileurl_name")=FileName
						rsfile("fileurl_info")=pic
						rsfile("fileurl_user")="管理员:"&request.cookies("CnendWeb")("admininfo_loginname")
						rsfile("fileurl_size")=Getfilesize(SiteSystemPath &"BookFace/"& FileName)
						rsfile("fileurl_path")=SiteSystemPath &"BookFace/"
						rsfile("fileurl_class")=3
						rsfile("fileurl_Types")=imgsExt
						rsfile.update
						rsfile.close
						rsfile.open strSQL,conn,1,1
							attachid=rsfile("id")
						rsfile.close
					set rsfile=nothing 
					picload=True
					pic=SiteSystemPath &"BookFace/"& FileName
				End If
			End If
		End If
	End If
End If

if request.form("list_abc")="9" or request.form("list_abc")="" then
	list_abc=GetSpellChar(trim(request.form("list_name")))
else
	list_abc=trim(request.form("list_abc"))
end if

list_wordnum=Getwordnum(trim(request.form("list_name")))

if request.form("list_lei")="" then
	ErrCodes = ErrCodes & "<li>二级分类不能为空,请先添加二级分类!</li><br>"
	FoundErr=True
end if
if request.form("list_name")="" then
	ErrCodes = ErrCodes & "<li> 作品名称不能为空!</li><br>"
	FoundErr=True
end if
if list_user="" then
	ErrCodes = ErrCodes & "<li> 作品作者不能为空!</li><br>"
	FoundErr=True
end if
if key="" then
	ErrCodes = ErrCodes & "<li>搜索关键字不能为空!</li><br>"
	FoundErr=True
end if
if list_all="" then
	ErrCodes = ErrCodes & "<li>  介绍不能为空!</li><br>"
	FoundErr=True
end if

if len(list_all) > 1500 then
	ErrCodes = ErrCodes & "<li>作品介绍内容不能超过1500字!</li><br>"
	FoundErr=True
end if
if FoundErr=True then
	Call ShowAdminErrMsg(ErrCodes,"javascript:history.go(-1)")
else
	set rs=server.createobject("adodb.recordset")
	sql="select list_pic from list_book where id="&id
	rs.open sql,conn,1,1
		oldpic=rs("list_pic")
	rs.close
	set rs=nothing
	B_Name=GetTextFromHtml(request.form("list_name"))
	conn.execute ("update list_book set list_pic='"&Pic&"',list_name='"&B_Name&"',list_lei="&request.form("list_lei")&",list_tai="&request.form("list_tai")&",laiyuan='"&request.form("laiyuan")&"',list_key='"&key&"',list_user='"&list_user&"',list_all='"&list_all&"',list_news='"&list_news&"',list_sftai="&request.form("list_sftai")&",list_qianyue='"&request.form("list_qianyue")&"',list_gxdate=now(),IsGood="&request.form("IsGood")&",Islist_good="&request.form("Islist_good")&",Isweb_good="&request.form("Isweb_good")&",Lock_book="&request.form("Lock_book")&",Lock_lun="&request.form("Lock_lun")&",IsVip="&request.form("IsVip")&",list_userid="&list_userid&",list_Adminid="&list_Adminid&",isuserread="&request.form("isuserread")&",list_abc='"&list_abc&"',listvv_good="&request.form("listvv_good")&" where id="&id)
end if

if oldpic<>"" and oldpic<>"images/0.jpg" and oldpic<>pic then
	If Left(Lcase(oldpic),7)<>"http://" Then
		set rs=server.createobject("adodb.recordset")
		sql="select fileurl_name,fileurl_fileID from filetest where fileurl_fileID="&ID&" and fileurl_class=3 order by id desc"
		rs.open sql,conn,1,2
		if not(rs.eof and rs.bof) then
			if Instr(oldpic,rs("fileurl_name"))> 0 then
				rs("fileurl_fileID")=0
				rs.update
			end if
		end if
		Rs.Close
		Set Rs=Nothing
	end if
end if

if picload=True and attachid<>"" then
	conn.execute ("update filetest set fileurl_fileID="&ID&" where id="&attachid)
end if

if request.form("attach")<>"" then
	attachArray=Split(request.form("attach"),";")
	For i1=0 To Ubound(attachArray)-1
		attachid=CheckSql(Replace(Replace(attachArray(i1),"[attach]",""),"[/attach]",""))
		CheckSqlnum(attachid)
		set rs=server.createobject("adodb.recordset")
		sql="select fileurl_name from filetest where id="&attachid&" order by id desc"
		rs.open sql,conn,1,1
		if rs.eof and rs.bof then
		else
			if Instr(pic,rs("fileurl_name"))> 0 then
				conn.execute ("update filetest set fileurl_fileID="&ID&" where id="&attachid)
			end if
		end if
		Rs.Close
		Set Rs=Nothing
	Next
end if

if makehtml=1 then
	MakelookHtml(id)
end if
if makeJS=1 then
	temzxgx(zxgxNum)
end if
call connclose() 
if urltype="list" then
	cndb=request.querystring("cndb")
	clid=request.querystring("clid")
	if cndb="" then
		cndb="all"
	end if
	Call ShowAdminSuccessMsg("<li>作品修改成功!</li><br>","admin_book.asp?info=booklist&cndb="&cndb&"&clid="&clid&"&page="&page&"")
elseif urltype="search" then
	key_keyword=request.querystring("key_keyword")
	key_type=request.querystring("key_type")
	Call ShowAdminSuccessMsg("<li>作品修改成功!</li><br>","admin_booksearch.asp?key_type="&key_type&"&key_keyword="&key_keyword&"&page="&page&"")
elseif urltype="listjian" then
	cndb=request.querystring("cndb")
	if cndb="" then
		cndb="jingpin"
	end if
	Call ShowAdminSuccessMsg("<li>作品修改成功!</li><br>","admin_bookjian.asp?info="&cndb&"&page="&page&"")
else
	Call ShowAdminSuccessMsg("<li>作品修改成功!</li><br>","admin_book.asp?info=booklist&cndb=all&clid="&clid&"&page="&page&"")
end if
'end if
end sub
'——————————
sub book_del()
id=CheckSql(request.querystring("id"))
CheckSqlnum(id)
id=int(id)
urltype=request.querystring("urltype")
page=request.querystring("page")

	set rsfile=server.createobject("adodb.recordset") 
	strSQL ="select fileurl_name,fileurl_path from filetest where fileurl_class=3 and fileurl_fileID ="&id&""
	rsfile.open strSQL,conn,1,1
	if not(rsfile.eof and rsfile.bof) then
	do while not rsfile.eof
		file1=rsfile("fileurl_path")&rsfile("fileurl_name")
		FSOFiledel(file1)
	rsfile.movenext
    loop
	end if
	rsfile.close
	set rsfile=nothing
	conn.execute"delete from filetest where ID ="&id&""
		
	viewFolder = SiteSystemPath&"HTML/"&id&"/"
set rsco=server.createobject("adodb.recordset")
sql="select id,list_cookid from list_view where view_id="&id&""
rsco.open sql,conn,1,1
if rsco.eof and rsco.bof then
else
do while not rsco.eof
id1=rsco("id")
cook_id=rsco("list_cookid")

	set rsfile=server.createobject("adodb.recordset") 
	strSQL ="select fileurl_name,fileurl_path from filetest where fileurl_class=1 and fileurl_fileID ="&id1&""
	rsfile.open strSQL,conn,1,1
	if not(rsfile.eof and rsfile.bof) then
	do while not rsfile.eof
		file1=rsfile("fileurl_path")&rsfile("fileurl_name")
		FSOFiledel(file1)
	rsfile.movenext
    loop
	end if
	rsfile.close
	set rsfile=nothing
	conn.execute"delete from filetest where ID ="&id1&""

		file3=viewFolder&"Z"&cook_id&"."&htmlphe&""
		file2=viewFolder&id1&"."&htmlphe&""
		file1=viewFolder&id1&".TXT"
		FSOFiledel(file3)
		FSOFiledel(file2)
		FSOFiledel(file1)
	rsco.movenext
    loop
end if
rsco.close
set rsco=nothing
		Success = Success & "<li> 作品章节附件已全部清理!</li><br>"
		Success = Success & "<li> 作品章节静态页面已全部清理!</li><br>"
		Success = Success & "<li> 作品分卷静态页面已全部清理!</li><br>"

file4=viewFolder&"Allbook"&id&"."&htmlphe&""
file5=SiteSystemPath&id&"."&htmlphe&""
file6=viewFolder&"index."&htmlphe&""
FSOFiledel(file4)
FSOFiledel(file5)
FSOFiledel(file6)
		Success = Success & "<li> 作品资料静态页面已清理!</li><br>"
		Success = Success & "<li> 作品全文静态页面已清理!</li><br>"
		Success = Success & "<li> 作品目录静态页面已清理!</li><br>"

if IsSqlDataBase = 2 then
	conn.execute "delete from list_view where view_id = "&id&""
	conn.execute "delete from list_cook where list_bookid = "&id&""
	conn.execute "delete from Comment where commenttype=1 and type_id = "&id&""
	conn.execute "delete from list_book where id = "&id&""
else
	conn.execute "delete from [list_view] where view_id in ("&id&") "
	conn.execute "delete from [list_cook] where list_bookid in ("&id&") "
	conn.execute "delete from [Comment] where commenttype=1 and type_id in ("&id&") "
	conn.execute "delete from [list_book] where id in ("&id&") "
end if
call connclose() 
if urltype="list" then
	cndb=request.querystring("cndb")
	clid=request.querystring("clid")
	if cndb="" then
		cndb="all"
	end if
	Call ShowAdminSuccessMsg(Success & "<li> 作品删除成功!</li><br>","admin_book.asp?info=booklist&cndb="&cndb&"&clid="&clid&"&page="&page&"")
elseif urltype="search" then
	key_keyword=request.querystring("key_keyword")
	key_type=request.querystring("key_type")
	Call ShowAdminSuccessMsg(Success & "<li> 作品删除成功!</li><br>","admin_booksearch.asp?key_type="&key_type&"&key_keyword="&key_keyword&"&page="&page&"")
elseif urltype="listjian" then
	cndb=request.querystring("cndb")
	if cndb="" then
		cndb="jingpin"
	end if
	Call ShowAdminSuccessMsg(Success & "<li> 作品删除成功!</li><br>","admin_bookjian.asp?info="&cndb&"&page="&page&"")
else
	Call ShowAdminSuccessMsg(Success & "<li> 作品删除成功!</li><br>","admin_book.asp?info=booklist&cndb=all&clid="&clid&"&page="&page&"")
end if
end sub
'——————————
sub book_zhang_add()
if request.form("list_cookname")="" then
	ErrCodes = ErrCodes & "<li> 分卷名称不能为空!</li><br>"
	FoundErr=True
end if
if FoundErr=True then
	Call ShowAdminErrMsg(ErrCodes,"javascript:history.go(-1)")
else
	dim b_id,classid
	b_id=request.form("b_id")
	set rs=server.CreateObject("adodb.recordset")
	sql="select list_class from list_book where id="&b_id
	rs.open sql,conn,1,1
		classid=rs("list_class")
	rs.close
	set rs=nothing
	set rsc1=server.createobject("adodb.recordset")
	sqlc1="select cook_viewid from list_cook where list_bookid="&b_id&" order by cook_viewid desc limit 1"
	rsc1.open sqlc1,conn,1,1
		if rsc1.bof and rsc1.eof then
			c_viewid=1
		else
			c_viewid=rsc1("cook_viewid") + 1
		end if
	rsc1.close
	set rsc1=nothing
	set rs=server.createobject("adodb.recordset")
	sql="select * from list_cook order by list_cookid desc limit 1"
	rs.open sql,conn,1,3
		rs.addnew
		rs("list_cookname")=GetTextFromHtml(trim(request.form("list_cookname")))
		rs("list_cookinfo")=GetTextFrHtml(htmlencode(request.form("list_cookinfo")))
		rs("list_bookid")=b_id
		rs("classid")=classid
		rs("cook_viewid")=c_viewid
		rs.update
	rs.close
	set rs=nothing
call connclose() 
Call ShowAdminSuccessMsg("<li>分卷添加成功!</li><br>","admin_book.asp?info=zhanglist&b_id="&b_id&"")
end if
end sub
'——————————
sub book_zhang_edit()
if request.form("list_cookname")="" then
	ErrCodes = ErrCodes & "<li> 分卷名称不能为空!</li><br>"
	FoundErr=True
end if
if FoundErr=True then
	Call ShowAdminErrMsg(ErrCodes,"javascript:history.go(-1)")
else
	dim b_id,c_id
	b_id=CheckSql(request.form("b_id"))
	CheckSqlnum(b_id)
	b_id=int(b_id)
	c_id=CheckSql(request.form("c_id"))
	CheckSqlnum(c_id)
	c_id=int(c_id)
	list_cookname=GetTextFromHtml(trim(request.form("list_cookname")))
	list_cookinfo=GetTextFrHtml(htmlencode(request.form("list_cookinfo")))
	conn.execute ("update list_cook set list_cookname='"&list_cookname&"',list_cookinfo='"&list_cookinfo&"' where list_cookid="&c_id)

call connclose() 
Call ShowAdminSuccessMsg("<li>分卷名称修改成功!</li><br>","admin_book.asp?info=zhanglist&b_id="&b_id&"")
end if
end sub
'——————————
sub book_zhang_del()
b_id=CheckSql(request.querystring("b_id"))
CheckSqlnum(b_id)
b_id=int(b_id)
c_id=CheckSql(request.querystring("c_id"))
CheckSqlnum(c_id)
c_id=int(c_id)
page=replace(trim(request("page")),"'","")

conn.execute "delete from list_cook where list_cookid = "&c_id&""
viewFolder = SiteSystemPath&"HTML/"&b_id&"/"
file1=viewFolder&"Z"&c_id&"."&htmlphe&""
FSOFiledel(file1)

set rsco=server.createobject("adodb.recordset")
sql="select id,view_size from list_view where list_cookid="&c_id&""
rsco.open sql,conn,1,1
if rsco.eof and rsco.bof then
else
do while not rsco.eof
	id=rsco("id")
	view_size=rsco("view_size")

	set rsfile=server.createobject("adodb.recordset") 
	strSQL ="select fileurl_name,fileurl_path from filetest where fileurl_class=1 and fileurl_fileID ="&id&""
	rsfile.open strSQL,conn,1,1
	if not(rsfile.eof and rsfile.bof) then

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?