<% dim cls if session("admin")="" then Response.Redirect("index.asp?err=4") else if session("flag")<>"0" then cls = Instr(session("flag"), "down") if cls <= 0 then %> <% end if end if end if %> 管理中心--上传下载管理
当前位置:网站管理中心--下载管理 文件管理 | 类别管理  
<% if request("gb")<>"" then gb=request("gb") end if action=request("action") 'if request("id")<>"" then 'response.Write request("id") 'response.Write request("action") 'response.End() 'end if if action="" then %> <% if v<>1 then %> ';" value="<%= lang_1 %>"> ';" value="<%= lang_2 %>"> <% end if %>
 
<% dim rs,msg_per_page dim sql msg_per_page = 20 '定义每页显示记录条数 Set rs = Server.CreateObject("ADODB.Recordset") if Trim(Request("keyword")) <> "" then Sql = "Select * from download where title like '%"& Trim(Request("keyword")) &"%' and gb='"&gb&"' order by Unid desc" else Sql = "Select * from download where gb='"&gb&"' order by Unid desc" end if set rs=Server.CreateObject("ADODB.RecordSet") rs.cursorlocation = 3 '使用客户端游标,可以使效率提高 rs.pagesize = msg_per_page '定义分页记录集每页显示记录数 rs.open sql,conn,1,1 if err.number<>0 then '错误处理 response.write "数据库操作失败:" & err.description err.clear else if not (rs.eof and rs.bof) then '检测记录集是否为空 '--------------------分页代码开始------------------------------------- totalrec = RS.RecordCount 'totalrec:总记录条数 if rs.recordcount mod msg_per_page = 0 then '计算总页数,recordcount:数据的总记录数 n = rs.recordcount\msg_per_page 'n:总页数 else n = rs.recordcount\msg_per_page+1 end if currentpage = request("page") 'currentpage:当前页 If currentpage <> "" then currentpage = cint(currentpage) if currentpage < 1 then currentpage = 1 end if if err.number <> 0 then err.clear currentpage = 1 end if else currentpage = 1 End if if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then currentPage=1 end if rs.absolutepage = currentpage 'absolutepage:设置指针指向某页开头 rowcount = rs.pagesize 'pagesize:设置每一页的数据记录数 '----------------------------------分页代码结束----------------------------------------- dim i dim k do while not rs.eof and rowcount>0 %> <% rowcount=rowcount-1 rs.movenext loop end if end if rs.close conn.close set rs=nothing set coon=nothing %>
ID号 标题(编辑) 文件大小 分类 发布时间
<%=rs("unid")%> " ><%=rs("title")%> <% if rs("Size")<>"" then %> <%=rs("Size")/1000%> kb <% end if %> <%=rs("classid")%> <%=rs("intime")%>
全选
<% call listPages() end if %> <% '类别管理 if action="cls" then call manageclass() end if '编辑类别名字 if action="editclass" then call editclass() end if '增加类别 if action="addLarclass" then call addlarclass() end if '删除类别 if action="delLarclass" then call dellarclass() end if if action="删除" then delid=replace(request("id")," ","") call proddel() end if if action="newadd" then call downadd() end if if action="modify" then id=replace(request("id")," ","") call modify() end if%>
<% '-------------------------------页码子程序------------------------------- sub listPages() if n <= 1 then exit sub if currentpage = 1 then %> 首页 <%else%> ?page=1">首页 ?page=<%=currentpage-1%>"> 前页 <%end if%> <%if currentpage = n then%> 后页 <%else%> ?page=<%=currentpage+1%>">下页 ?page=<%=n%>">末页 <%end if%> 总:<%=currentpage%>/<%=n%>页 <%=msg_per_page%>条资料/页 共:<%=totalrec%>条资料 <%end sub '---------------------------------分页子程序结束------------------------------------ %> <% '------------------------------删除资料开始----------------------------------------- sub proddel() if delid="" or isnull(delid) then Response.write "


操作失败,没有选择合适参数!点击返回

" else conn.execute("delete from download where unId in ("&delid&")") if err.number<>0 then '错误处理 response.write "数据库操作失败:" & err.description err.clear else conn.close set conn=nothing Response.write "


删除成功!点击返回

" end if end if end sub '----------------------------删除资料结束--------------------------------------------- %> <% function changechr(str) changechr=replace(replace(replace(replace(str,"<","<"),">",">"),chr(13),"
")," "," ") changechr=replace(replace(replace(replace(changechr,"[starark]",""),"[red]",""),"[big]","") changechr=replace(replace(replace(replace(changechr,"[/starark]",">"),"[/b]",""),"[/red]",""),"[/big]","") end function %> <% '----------------------------增加下载资料信息--------------------------------- sub downadd() if request("add") ="ok" then if request("title")="" then response.Write "" response.end end if if request("down1")="" then response.Write "" response.end end if Set rs=Server.CreateObject("ADODB.Recordset") sql = "select * from download" rs.open sql,conn,1,3 if err.number<>0 then '错误处理 response.write "数据库操作失败:" & err.description err.clear else rs.Addnew 'rs("down2")=Trim(Request.Form("down2")) 'rs("LookUrl")=Trim(Request.Form("LookUrl")) 'rs("bar")=Trim(Request.Form("bar")) 'rs("warranty")=Trim(Request.Form("warranty")) 'rs("System")=checkreal(request.form("System")) 'rs("Star")=Trim(Request.Form("Star")) rs("title")=Trim(Request.Form("title")) rs("down1")=Trim(Request.Form("down1")) rs("content")=Request.Form("content") rs("Size")=request.form("Size") rs("classid")=Trim(Request.Form("classid")) if Request("Pic")="" then rs("Pic")="../gl/images/down.jpg" else rs("Pic")=Trim(Request.Form("Pic")) end if rs("Intime")=now() rs("gb")=request.form("gbL") rs.update rs.close conn.close set rs=nothing set conn=nothing response.write "" end if else %>
添 加 资 料
语言选择:
资料的类别:
资料名称: (100字节)
上传资料:
下载地址: *
文件大小: B
备注说明:
注意: 前面的"../"绝对不能少,如果是链接外部的资料,"http绝对不能少。"
[返回上一页]
<% end if end sub '---------------------------------增加资料结束-------------------------------- %> <% '-------------------------------- 修改资料开始----------------------- sub modify() if id="" then response.write "非法文章编号" response.write "" else if request("modify")="ok" then if request("title")="" then response.Write "" response.end end if if request("down1")="" then response.Write "" response.end end if set rs=server.createobject("adodb.recordset") sql = "select * from download where unId="&id rs.open sql,conn,1,3 if err.number<>0 then response.write "数据库操作失败:" & err.description '错误描述 err.clear else if not (rs.eof and rs.bof) then 'rs("down2")=Trim(request.form("down2")) 'rs("LookUrl")=Trim(request.form("LookUrl")) 'rs("warranty")=Trim(request.form("warranty")) 'rs("System")=checkreal(Trim(request.form("System"))) 'rs("Star")=Trim(request.form("Star")) rs("title")=Trim(request("title")) rs("down1")=Trim(request.form("down1")) rs("content")=request.form("content") rs("Size")=request.form("Size") rs("classid")=trim(request.form("classid")) if Request("Pic")="" then rs("Pic")="../gl/images/down.jpg" else rs("Pic")=Trim(Request.Form("Pic")) end if rs("gb")=request.form("gb") rs.update end if end if rs.close set rs=nothing response.write "资料已经修改" response.write "" response.end end if '显示详细资料 set rs = server.createobject("adodb.recordset") sql = "select * from download where unId="&id rs.open sql,conn,1,1 if err.number<>0 then '错误处理 response.write "数据库操作失败:" & err.description '错误描述 err.clear else if not (rs.eof and rs.bof) then %> " onSubmit="return check();">
修 改 资 料
语言选择:
资料的类别:
资料名称: ">(100字节)
上传资料: ">(必填)
下载地址一: "> (系统自动生成)
文件大小: "> K(系统自动生成)
备注说明:
">  [返回上一页]
<% else response.write "
无此序号资料!

请检查!
" end if end if rs.close set rs=nothing end if end sub '---------------------------------------修改资料结束--------------------------------- %> <% '--------------------编辑资料类别开始---------------------------- sub manageclass() set rs=server.createobject("adodb.recordset") sql="select * from aclass where gb='"&gb&"' order by xuhao asc" rs.open sql,conn,1,3 if err.number<>0 then '错误处理 response.write "数据库操作失败:" & err.description '错误描述 err.clear else response.write "
请注意:如果已经是旧的类别,已经和资料关联了,修改,删除类别后,页面可能不能直接找到原类别资料,最好不要轻易修改。

增加类别
" if v<>1 then response.write "
"&lang_1&"  "&lang_2&" 
" end if response.Write"" Dim a,b,c if not (rs.eof and rs.bof) then a=rs("downclass") Do While Not rs.eof if (a<>b) then response.write "" else end if rs.movenext if rs.eof then exit do end if b=rs("downclass") Loop end if response.write "
"&rs("xuhao")&"  "&rs("downclass")&"删除类别 | "&rs("gb")&"
" end if rs.close set rs=nothing end sub '--------------------编辑资料类别结束---------------------------- '--------------------增加资料大类开始---------------------------- sub addlarclass() '增加大类 gb=request.form("gb") if request("add")="ok" then set rsadd=Server.CreateObject("ADODB.Recordset") sql="select * from aclass" application.lock rsadd.open sql,conn,3,3 rsadd.addnew rsadd("xuhao")=request.form("date3") rsadd("downclass")=request.form("newclass") rsadd("gb")=request.form("gb") rsadd.update application.unlock rsadd.close set rsadd=nothing response.write "

  新增类别:"&request("newclass")&"

" response.write "" else response.write "
 "&lang_1&"类别:" set rs=server.createobject("adodb.recordset") sql="select * from aclass where gb='"&session("gb")&"' order by id asc" rs.open sql,conn,1,1 if not (rs.eof and rs.bof) then do while not rs.eof response.write "  "&rs("xuhao")&"、"&rs("downclass")&"" rs.movenext loop end if if v<>1 then response.write "
 "&lang_2&"类别:" set rs=server.createobject("adodb.recordset") sql="select * from aclass where gb='"&session("gb1")&"' order by id asc" rs.open sql,conn,1,1 if not (rs.eof and rs.bof) then do while not rs.eof response.write "  "&rs("xuhao")&"、"&rs("downclass")&"" rs.movenext loop end if end if rs.close set rs=nothing response.write "
   新增大类:         
" end if end sub '--------------------增加资料大类结束---------------------------- '删除类别 sub delLarclass() sql= "delete from aclass where downclass='"&request("Reid")&"'" conn.execute sql conn.close response.write "

  删除大类:"&request("Reid")&"

" response.write "" end sub '编辑类别 sub editclass() if request("o")="ok" then set rs=server.createobject("adodb.recordset") sql = "select * from aclass where id="&request("id") rs.open sql,conn,1,3 if err.number<>0 then response.write "数据库操作失败:" & err.description '错误描述 err.clear else if not (rs.eof and rs.bof) then rs("downclass")=request.form("LarCode") rs("xuhao")=request.form("date3") rs.update end if end if conn.execute("update News set NewsClass='"&request("LarCode")&"' where NewsClass='"&request("old")&"'") rs.close response.write "资料类别已经修改
" response.write request.form("LarCode") response.write "" response.end else set rs = server.createobject("adodb.recordset") sql = "select * from aclass where downclass='"&request("LarCode")&"'" rs.open sql,conn,1,1 response.write "
序号:   " response.write "  
" end if end sub '-----------------------------编辑类别结束------------------------ %> <% '处理数组函数 function checkreal(v) dim w if not isnull(v) then w=replace(v,",","|") w=replace(w," ","") checkreal=w end if end function %>