%
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 %>
<%
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
%>
<%
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
%>
<%
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 "
"
else
end if
rs.movenext
if rs.eof then
exit do
end if
b=rs("downclass")
Loop
end if
response.write "
"
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 ""
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
%>