⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_pic.asp

📁 后台登陆admin.asp
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<!--#include file="mdb.asp"-->
<%Admin="pic"%>
<!--#include file="check.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/FORMAT.asp"-->
<HTML>
<HEAD>
<TITLE>管理中心——图片管理</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="inc/admin.css" type=text/css rel=StyleSheet>
<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
</HEAD>
<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey))>
<%

'****************************************************
if session("adminlogin")<>sessionvar then
  Response.Write("<script language=javascript>alert('你尚未登录,或者超时了!请重新登录');this.top.location.href='admin.asp';</script>")
  response.end
else
if request.form("MM_insert") then
if request.form("action")="newpiccat" then
  dim piccatname,sid
  sid=clng(request.form("id"))
  piccatname=trim(replace(request.form("piccat_name"),"'",""))
  if piccatname="" then
     Response.Write("<script language=javascript>alert('你必须填写分类名称!');history.back(1);</script>")
     response.end
  end if
  conn.Execute ("Insert Into piccat(piccat_name,sid) Values('"&piccatname&"',"&sid&")")
  response.redirect "admin_pic.asp?action=piccat"
elseif request.form("action")="newpic" then
dim piccatid,picname,picurl,picpic,picspic,picdesc,picisbest,tjuser,upcount,picpic1,pic1
piccatid=request.form("piccatid")
picname=trim(replace(request.form("name"),"'",""))
picurl=trim(replace(request.form("url"),"'",""))
picpic=trim(replace(request.form("pic"),"'",""))
picspic=trim(replace(request.form("spic"),"'",""))
picdesc=trim(replace(request.form("desc"),"'",""))
picisbest=request.form("isbest")
tjuser=request.form("tjuser")
upcount=request.form("upcount")
pic1=request.form("pic1")
for i=1 to upcount
picpic1=picpic1&"|"&Replace(Request.Form("pic"&i&""),"|","│")
next
if picname="" then
  Response.Write("<script language=javascript>alert('你必须填写图片标题!');history.back(1);</script>")
  response.end
end if
if not isInteger(piccatid) then
  Response.Write("<script language=javascript>alert('你必须选择图片所属分类!');history.back(1);</script>")
  response.end
end if
if picurl="" then
  Response.Write("<script language=javascript>alert('你必须填写文件大小!');history.back(1);</script>")
  response.end
end if
if picspic="" then
  Response.Write("<script language=javascript>alert('你必须填写缩图地址!');history.back(1);</script>")
  response.end
end if
if picpic="" then
  Response.Write("<script language=javascript>alert('你必须填写图片地址!');history.back(1);</script>")
  response.end
end if
if picdesc="" then
  Response.Write("<script language=javascript>alert('你必须填写图片的简要说明!');history.back(1);</script>")
  response.end
end if
  sql="select * from pic"
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,1,3
  rs.addnew
  rs("pic_name")=picname
  rs("piccat_id")=piccatid
  rs("pic_url")=picurl
  rs("pic_spic")=picspic
  rs("pic_pic")=picpic
  rs("pic_desc")=picdesc
if cint(picisbest)=1 then
  rs("isbest")=cint(picisbest)
end if
  rs("tjuser")=tjuser
if pic1<>"" then
  rs("pic_pic1")=picpic1
end if
  rs.update
  rs.close
  set rs=nothing
  sql="update allcount set piccount = piccount + 1"
  conn.execute(sql)
  response.redirect "admin_pic.asp?action=pic"
elseif request.form("action")="editpic" then
if request.Form("id")="" then
  Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
  response.End
else
  if not isInteger(request.form("id")) then
    Response.Write("<script language=javascript>alert('非法的id参数。');history.back(1);</script>")
    response.End
  end if
end if
piccatid=request.form("piccatid")
picname=trim(replace(request.form("name"),"'",""))
picurl=trim(replace(request.form("url"),"'",""))
picpic=trim(replace(request.form("pic"),"'",""))
picspic=trim(replace(request.form("spic"),"'",""))
picdesc=trim(replace(request.form("desc"),"'",""))
picisbest=request.form("isbest")
tjuser=request.form("tjuser")
picpic1=trim(replace(request.form("pic_pic1"),"'",""))
if picname="" then
  Response.Write("<script language=javascript>alert('你必须填写图片标题!');history.back(1);</script>")
  response.end
end if
if not isInteger(piccatid) then
  Response.Write("<script language=javascript>alert('你必须选择图片所属分类!');history.back(1);</script>")
  response.end
end if
if picurl="" then
  Response.Write("<script language=javascript>alert('你必须填写图片大小!');history.back(1);</script>")
  response.end
end if
if picspic="" then
  Response.Write("<script language=javascript>alert('你必须填写缩图地址!');history.back(1);</script>")
  response.end
end if
if picpic="" then
  Response.Write("<script language=javascript>alert('你必须填写图片地址!');history.back(1);</script>")
  response.end
end if
if picdesc="" then
  Response.Write("<script language=javascript>alert('你必须填写图片的简要说明!');history.back(1);</script>")
  response.end
end if
  sql="select * from pic where pic_id="&cint(request.form("id"))
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,1,3
  rs("pic_name")=picname
  rs("piccat_id")=piccatid
  rs("pic_url")=picurl
  rs("pic_spic")=picspic
  rs("pic_pic")=picpic
  rs("pic_desc")=picdesc
  rs("isbest")=cint(picisbest)
  rs("tjuser")=tjuser
  rs("pic_pic1")=picpic1
  if cint(picisbest)=1 then
     sql="UPDATE [user] SET points = points + "&bestpoints&" where username='"&tjuser&"'"
     conn.execute (sql)
  end if
  rs.update
  rs.close
  set rs=nothing
  response.redirect "admin_pic.asp?action=pic"
elseif request.form("action")="delpic" then
if request.Form("id")="" then
  Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
  response.End
else
  if not isInteger(request.form("id")) then
    Response.Write("<script language=javascript>alert('非法的id参数。');history.back(1);</script>")
    response.End
  end if
end if
  Conn.Execute "DELETE * FROM [pic] WHERE pic_id="&clng(request.form("id"))
  conn.execute("update allcount set piccount = piccount - 1")
  response.redirect "admin_pic.asp?action=pic"

elseif request.form("action")="editpiccat" then
if request.Form("id")="" then
  Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
  response.End
else
  if not isInteger(request.form("id")) then
    Response.Write("<script language=javascript>alert('非法的分类id参数。');history.back(1);</script>")
    response.End
  end if
end if
piccatname=trim(replace(request.form("piccat_name"),"'",""))
if piccatname="" then
  Response.Write("<script language=javascript>alert('你必须填写分类名称!');history.back(1);</script>")
  response.End
end if
  conn.Execute ("Update piccat Set piccat_name='"&piccatname&"',sid="&clng(request.form("lid"))&" where piccat_id="&cint(request.form("id"))&"")
  response.redirect "admin_pic.asp?action=piccat"

elseif request.form("action")="delpiccat" then
if request.Form("id")="" then
  Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
  response.End
else
  if not isInteger(request.form("id")) then
    Response.Write("<script language=javascript>alert('非法的分类id参数。');history.back(1);</script>")
    response.End
  end if
end if
set rs=server.createobject("adodb.recordset")
if request.Form("sid")="0" then
sql="select piccat_id from piccat where sid="&clng(request.form("id"))
set rsd=conn.execute(sql)
do while not rsd.eof
   Conn.Execute "DELETE * FROM [pic] WHERE piccat_id="&rsd("piccat_id")
rsd.movenext
loop
rsd.close
set rsd=nothing
   Conn.Execute "DELETE * FROM piccat WHERE sid="&clng(request.form("id"))
   Conn.Execute "DELETE * FROM piccat WHERE piccat_id="&clng(request.form("id"))
else
   Conn.Execute "DELETE * FROM piccat WHERE piccat_id="&clng(request.form("id"))
   Conn.Execute "DELETE * FROM [pic] WHERE piccat_id="&clng(request.form("id"))
end if
set rs=nothing
  response.redirect "admin_pic.asp?action=piccat"
end if
end if

if request.querystring("action")="piccat" then
%> 
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=Hxcmsbk style="border-collapse: collapse">
<tr> 
<td colspan="4" class=Hxcmsss>图片移动、合并管理(请慎重操作,操作后不可还原!)</font></td>
</tr>
<form method="post" action="?action=moves">
<tr align="center"> 
<td height=22 align=center class=Hxcmsqs>将:
<select size="1" name="cat1">
<%
sql="select * from piccat where sid=0"
set rs1=conn.execute(sql)
do while not rs1.eof
response.write "<optgroup label='"&rs1("piccat_name")&"'>"
sql="select * from piccat where sid="&rs1("piccat_id") 
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof
%>
              <option value="<%=rs2("piccat_id")%>">├ <%=rs2("piccat_name")%></option>
<%
rs2.movenext
loop
rs1.movenext
loop
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing%>
</select> 分类图片,移动到: 
<select size="1" name="cat2">
<%
sql="select * from piccat where sid=0"
set rs1=conn.execute(sql)
do while not rs1.eof
response.write "<optgroup label='"&rs1("piccat_name")&"'>"
sql="select * from piccat where sid="&rs1("piccat_id") 
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof
%>
              <option value="<%=rs2("piccat_id")%>">├ <%=rs2("piccat_name")%></option>
<%
rs2.movenext
loop
rs1.movenext
loop
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing%>
</select>分类里。
<input type="submit" value="移动合并" name="B2">
</td></tr>
</form>
</table>
<%
sql="select * from piccat where sid=0 order by piccat_id DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=Hxcmsbk style="border-collapse: collapse">
        <tr class=Hxcmsss> 
          <td colspan="4">
          图片分类管理</td>
        </tr>
        <tr class=Hxcmsqs align="center"> 
          <td width="10%">编号</td>
          <td width="50%" class=Hxcmsqs>分类名称</td>
          <td width="20%" class=Hxcmsqs>子栏目</td>
          <td width="20%">操作</td>
        </tr>
        <%do while not rs.eof%>
        <tr class=Hxcmsds> 
          <td align="center"><%=rs("piccat_id")%> </td>
          <td><font color=#008000><%=rs("piccat_name")%></font> [<a href="admin_pic.asp?id=<%=rs("piccat_id")%>&action=newpiccat">添加子分类</a>]</td>
          <td class=Hxcmsds align="center"><%
           sql3 = "select * from piccat where sid="&rs("piccat_id")&""
           Set rs3 = Server.CreateObject("ADODB.RecordSet")
           rs3.Open sql3,conn,1,1
           response.write rs3.recordcount&"个"%></td>
         <td align="center"><a href="admin_pic.asp?id=<%=rs("piccat_id")%>&action=editpiccat">编辑</a> 
            <a href="admin_pic.asp?id=<%=rs("piccat_id")%>&sid=<%=rs("sid")%>&action=delpiccat">删除</a></td>
        </tr>
<%sql="select * from piccat where sid="&rs("piccat_id") 
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof%>
<tr class=Hxcmsds><td align="right"></td><td>├ <%=rs2("piccat_name")%></td>
<td align="left">图片:<%
		    sql4 = "select * from pic where piccat_id="&rs2("piccat_id")&" order by piccat_id desc"
		    Set rs4 = Server.CreateObject("ADODB.RecordSet")
		    rs4.Open sql4,conn,1,1
		    response.write rs4.recordcount%>张</td>

⌨️ 快捷键说明

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