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

📄 chg.asp

📁 asp
💻 ASP
字号:
<%response.expires=0%>
<!--#include file="../inc/conn.asp"-->
<%
userid=Session("userid")
userlevel=Session("userlevel")
if userid="" or userlevel="" then
  call msgbox("请重新登陆!",3)
end if
if not isnumeric(userid) or not isnumeric(userlevel) then
  call msgbox("请重新登陆!",3)
end if
userlevel=CCur(userlevel)
if not userlevel=1 then
  call msgbox("管理员级别够!",1)
end if

categoryid=strFilter(request("categoryid"),10)
if categoryid="" then
  call msgbox("请正确指定分类!",1)
end if
if not isnumeric(categoryid) then
  call msgbox("请正确指定分类!",1)
end if

sql="select top 1 categoryname,categorypath,categoryindex,categorysort,categorymode,categorysave from category where categoryid="&categoryid
rs.open sql,conn,1,1
if not rs.eof then
  cname=rs(0)
  cpath=rs(1)
  cindex=rs(2)
  csort=rs(3)
  cmode=rs(4)
  csave=rs(5)
else
  rs.close
  call msgbox("该分类不存在!",1)
end if
rs.close

nindex	=split(cindex,".")
sql="select top 1 categoryname from category where categoryindex like '"&nindex(0)&"'"
rs.open sql,conn,1,1
if not rs.eof then
  nname=rs(0)
else
  rs.close
  call msgbox("该分类顶级不存在!",1)
end if
rs.close

categoryname =strFilter(request.form("categoryname"),30)
categorypath =strFilter(request.form("categorypath"),30)
categorysort =strFilter(request.form("categorysort"),30)
categorysave =len(strFilter(request.form("categorysort"),1))
categorymode =request.form("categorymode")

categorysort="article"
if categorysort="news" then
  if not nname="新闻频道" then
    categorysort="article"
  end if
end if
if nname="新闻频道" then
  categorysort="news"
end if

if categoryname><"" then
  rs.open "update category set categoryname='"&categoryname&"',categorypath='"&categorypath&"',categorysort='"&categorysort&"',categorysave='"&categorysave&"' where categoryid="&categoryid,conn,1,3
'SQL 语句
'  rs.open "update article set categoryid=replace(categoryid,'."&categoryid&"."&cname&".','."&categoryid&"."&categoryname&".') where categoryid like '%."&categoryid&".%'",conn,1,3
'ACCESS 语句
  if categorymode><"" then
    sql="select top 1 * from category where categoryid="&categoryid
    rs.open sql,conn,1,3
    if not rs.eof then
      rs("categorymode")=categorymode
      rs.update
    end if
    rs.close
  end if
  sql="select id,categoryid from article where categoryid like '%."&categoryid&".%'"
  rs.open sql,conn,1,1
  if not rs.eof then
    uparticle=rs.getrows
  end if
  rs.close
  if isarray(uparticle) then
    for i=0 to ubound(uparticle,2)
newarticleid=replace(uparticle(1,i),"."&categoryid&"."&cname&".","."&categoryid&"."&categoryname&".")
rs.open "update article set categoryid='"&newarticleid&"' where id="&uparticle(0,i),conn,1,3
    next
  end if

  call msgbox("分类名 ["&cname&"] 成功修改为 ["&categoryname&"] !",2)
end if

Set rs=nothing
Set conn=nothing
%>
<!--#include file="../inc/head.asp"-->

<table width="300" border="0" align="center" cellpadding="2" cellspacing="1" bordercolor="#FFFFFF">
<form name="form" method="post" action="../category/chg.asp?categoryid=<%=request("categoryid")%>">
  <tr class="menutitle"><th colspan="2">栏目资料修改</th></tr>
  <tr bgcolor="#ffffff"><td nowrap>栏目名  </td><td><input class="text" type="text" name="categoryname" value="<%=cname%>"></td></tr>
  <tr bgcolor="#ffffff"><td>目录名  </td><td><input class="text" type="text" name="categorypath" value="<%=cpath%>"><%if not instr(cindex,".")=0 then%>  <input type=checkbox name=save value=file<%if csave=true then%> checked<%end if%>>保存为文件<%end if%></td></tr>
<%if not instr(cindex,".")=0 then%>
  <tr bgcolor="#ffffff"><td>类型    </td><td>
<select name="categorysort">
  <option value="<%=csort%>"><%=csort%>
  <option value="news">新闻
  <option value="article">插图文章
</select>  以下为网页模版代码
  </td></tr>
  <tr bgcolor="#ffffff"><td colspan="2">
<textarea class="text" name="categorymode" cols="40" rows="15"><%=cmode%></textarea>
  </td></tr>
<%end if%>
  <tr bgcolor="#f0f0f0"><th colspan="2">
    <input class="button" type="submit" name="Submit" value="提 交">
    <input class="button" type="reset" name="reset" value="取 消">
    <input class="button" type="button" value="关 闭" onclick="window.close()">
  </th></tr>
</form>
</table>

<!--#include file="../inc/foot.asp"-->

⌨️ 快捷键说明

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