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

📄 class_edit.asp

📁 图利文章管理系统。毕业设计郑州科技学院2006级计算机系计算机信息管理专业
💻 ASP
字号:
<!--#include file="conn.asp"-->
<%
  if session("admin")="" then
  response.redirect "login.asp"
  else
	if session("flag")>2 then
		response.write"<SCRIPT language=JavaScript>alert('您没有操作的权限!');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
	end if
  end if
  
%>
<%
'开始添加操作
if request("action")="adda" then

addtype=trim(request("addtype"))
photo=trim(request("photo"))


'检验此一级分类是否唯一
sql="select * from sort where sort='"&addtype&"' order by sortid desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,2
if not(rs.eof or rs.bof) then
response.write"<SCRIPT language=JavaScript>alert('对不起,此分类名不唯一,请核实!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
else
rs.addnew
rs("sort")=addtype
rs("sort_pic")=photo
rs.update

end if
rs.close
set rs=nothing

response.redirect "class_main.asp"
response.end
end if
%>
<%
'开始删除操作
if request("action")="del" then
conn.execute "delete * from sort where sort='"&request("delsort")&"'"
response.redirect "class_main.asp"
response.end
end if
%>
<%
'开始修改操作
if request("action")="modi" then
if request("mtype")="" then
response.write"<SCRIPT language=JavaScript>alert('对不起,请合适您的分类修改项!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
'检验此一级分类是否唯一
sql="select * from sort where sort='"&request("mtype")&"' order by sortid desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
response.write"<SCRIPT language=JavaScript>alert('对不起,此分类名]不唯一,请核实!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
rs.close
set rs=nothing

conn.execute "update sort set sort='"&request("mtype")&"',sort_pic='"&request("type_pic")&"' where sort='"&request("modiclass")&"'"
conn.execute "update learning set sort='"&request("mtype")&"' where sort='"&request("modiclass")&"'"
response.redirect "class_main.asp"
response.end
end if
%>
<%
'开始合并操作
if request("action")="unite" then
uniteclass1=trim(request("uniteclass1"))
uniteclass2=request("uniteclass2")
uniteclassto=trim(request("uniteclassto"))

if uniteclass1="" or uniteclass2="" or uniteclass1=uniteclass2 or uniteclassto="" then
response.write"<SCRIPT language=JavaScript>alert('对不起,您在合并分类时有错误操作,请核实!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if

conn.execute "update sort set sort='"&uniteclassto&"' where sort='"&uniteclass1&"'"
conn.execute "delete * from sort where sort='"&uniteclass2&"'"
conn.execute "update learning set sort='"&uniteclassto&"' where sort='"&uniteclass1&"' or sort='"&uniteclass2&"'"
response.redirect "class_main.asp"
response.end
end if
%>
<html>
<head>
<title>栏 目 管 理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="STYLE.CSS" type="text/css">
</head>
<body bgcolor="#FFFFCC" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr background="images/bg.gif"> 
    <td class="topbg" height="22" colspan="2" align="center"><b>栏 目 管 理</b></td>
  </tr>
  <tr> 
    <td class="tdbg" width="70" height="30"><b>管理导航:</b></td>
    <td class="tdbg" height="30"><a href="class_main.asp">栏目管理首页</a>&nbsp;|&nbsp;<a href="class_edit.asp?a=add">添加一个分类</a></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="50">&nbsp;</td>
  </tr>
</table>
<br>
<%if request("a")="add" then%>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#999999" align="center" width="60%" class="border">
  <tr bgcolor="#6699CC"> 
    <td colspan="2" height="25" class="title">添加分类</td>
  </tr>
  <form name="addsort" method="post" action="class_edit.asp">
    <tr bgcolor="#B0CBE6"> 
      <td align="right" width="25%" class="tdbg">分类名:</td>
      <td class="tdbg"> 
        <input type="text" name="addtype">
          </td>
    </tr>
    <tr bgcolor="#B0CBE6"> 
      <td align="right" class="tdbg">选择类:</td>
      <td class="tdbg"><select name="photo" id="photo">
        <option value="1">图片类</option>
        <option value="0">文章类</option>
      </select>
      </td>
    </tr>
    <tr bgcolor="#FFFF99"> 
      <td colspan="2" align="center" bgcolor="#B0CBE6" class="tdbg"> 
        <input type="submit" name="Submit" value="添 加"> <input type="hidden" name="action" value="adda">
      </td>
    </tr>
  </form>
</table>
<%end if%>
<br>
<%if request("a")="del" then%>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#FFFFFF" align="center" width="60%" class="border">
  <tr bgcolor="#6699CC"> 
    <td colspan="2" height="25" class="title">删除分类</td>
  </tr>
  <form name="delclass" method="post" action="class_edit.asp">
    <%
if request("delclass")<>"" then
%>
    <tr bgcolor="#B0CBE6"> 
      <td align="right" width="25%" class="tdbg">分类名:</td>
      <td class="tdbg"> 
        <input type="text" name="delsort" class="form" value=<%=request("delclass")%>>
      </td>
    </tr>
    <%else%>
    <%end if%>
    <tr bgcolor="#FFFF99"> 
      <td colspan="2" align="center" bgcolor="#B0CBE6" class="tdbg"> 
        <input type="submit" name="Submit2" value="删 除"> <input type="hidden" name="action" value="del">
      </td>
    </tr>
  </form>
</table>
<%end if%>
<br>
<%if request("a")="modi" then%>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#FFFFFF" align="center" width="60%" class="border">
  <tr bgcolor="#6699CC"> 
    <td colspan="2" height="25" class="title">修改分类</td>
  </tr>
  <form name="modisort" method="post" action="class_edit.asp">
    <%
if request("modiclass")<>"" then
%>
    <tr bgcolor="#B0CBE6"> 
      <td align="right" width="25%" class="tdbg">分类名:</td>
      <td class="tdbg"> 
        <input type="text" name="modiclass" class="form" value=<%=request("modiclass")%>>
      </td>
    </tr>
    <%else%>
    <%end if%>
    <tr bgcolor="#B0CBE6"> 
      <td align="right" class="tdbg">修改为:</td>
      <td class="tdbg"> 
        <input type="text" name="mtype" class="form">
      </td>
    </tr>
    <tr bgcolor="#B0CBE6"> 
      <td align="right" class="tdbg">选择类:</td>
      <td class="tdbg"><select name="photo" id="photo">
        <option value="1" <%if request("sortid")=1 then%> selected <%end if%>>图片类</option>
        <option value="0" <%if request("sortid")=0 then%> selected <%end if%>>文章类</option>
            </select></td>
    </tr>
    <tr bgcolor="#B0CBE6"> 
      <td colspan="2" align="center" class="tdbg"> 
        <input type="submit" name="Submit22" value="修 改">
        <input type="hidden" name="action" value="modi">
      </td>
    </tr>
  </form>
</table>
<%end if%>
<%if request("a")="unite" then%>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#FFFFFF" align="center" width="60%" class="border">
  <tr bgcolor="#6699CC"> 
    <td colspan="2" height="25" class="title">合并一级分类</td>
  </tr>
  <form name="uniteclass" method="post" action="class_edit.asp">
    <tr bgcolor="#FFFF99"> 
      <td align="right" width="25%" bgcolor="#B0CBE6" class="tdbg">分类名:</td>
      <td bgcolor="#B0CBE6" class="tdbg"> 
        <input type="text" name="uniteclass1" class="form" value=<%=request("uniteclass")%>>
      </td>
    </tr>
    <tr bgcolor="#FFFF99"> 
      <td align="right" bgcolor="#B0CBE6" class="tdbg">分类名:</td>
      <td bgcolor="#B0CBE6" class="tdbg"> 
        <select name="uniteclass2">
          <option value="" selected>请选择一级分类(2)</option>
          <%
sql="select * from sort where sort<>'"&request("uniteclass")&"'"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
while not rs.eof
%>
          <option value="<%=rs("sort")%>"><%=rs("sort")%></option>
          <%
rs.movenext
wend
rs.Close()
set rs=nothing
%>
        </select>
      </td>
    </tr>
    <tr bgcolor="#FFFF99"> 
      <td align="right" bgcolor="#B0CBE6" class="tdbg">合并为:</td>
      <td bgcolor="#B0CBE6" class="tdbg"> 
        <input type="text" name="uniteclassto" class="form">
      </td>
    </tr>
    <tr bgcolor="#B0CBE6"> 
      <td colspan="2" align="center" class="tdbg"> 
        <input type="submit" name="Submit222" value="合 并"> <input type="hidden" name="action" value="unite">
      </td>
    </tr>
  </form>
</table>
<%end if%>
</body>
</html>

⌨️ 快捷键说明

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