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

📄 admin_newscatafix.asp

📁 简单明晰的asp后台代码 新闻 产品
💻 ASP
字号:
<!--#include file = "../inc/dbclass.inc.asp" -->
<!--#include file = "../inc/syslogincheck.inc.asp" -->

<%
' =============================================================
' made by xiasp & 智多网络 http://www.cq18.com/ qq群:12403617
' =============================================================
%>

<%
sub getnewscata()
	dim crs, csql, i, tempcatastr
	set crs = server.createobject( "adodb.recordset" )
	csql = "select * from newscata order by c_rootid"
	crs.open csql, oconn, 1, 3
  
	do while not crs.eof	
	
		tempcatastr = "<option value='"&trim(crs("c_rootid"))&"'"
		
		if len(crs("c_rootid")) = 1 then tempcatastr = tempcatastr& " style='color:#ff0000'" 
		tempcatastr = tempcatastr&">&nbsp;|"
		
		for i=1 to int(len(trim(crs("c_rootid")))/4)
			tempcatastr = tempcatastr&"&nbsp;|"
		next

		tempcatastr = tempcatastr&"_"&trim(crs("c_title"))&"</option>"
		response.write tempcatastr
			
	crs.movenext
	loop 
  	crs.close
  	set crs = nothing
end sub
%>

<%
dim action , cata_1, cata_2, j
action = getsafestr(trim(request.form("action")))
cata_1 = getsafestr(trim(request.form("cata_1")))
cata_2 = getsafestr(trim(request.form("cata_2")))
	
if action="ok" then
	if cata_1 = "" or len(cata_1) < 5 or len(cata_2) < 5 then
		call alertmsg("请选择一个不是根目录的类别进行操作!")
	else
		if cata_1 = cata_2 then
			call alertmsg("要操作的栏目不能相同,请重新操作!")
		else
			'检测当前类别是否有子类别
			j = 0
			ssql = "select * from newscata where c_rootid like '"&cata_1&"%'  order by c_id desc"
			ors.open ssql,oconn,1,1
			do while not ors.eof
				'
				ors.movenext
				j = j+1
			loop
			ors.close
			set ors=nothing
				
			if j > 1 then
				call alertmsg("对不起,你要操作的类别包含有子类别,请先对子类别进行处理!")
			else
						
				'更新被操作类别的信息类别,更新为目标类别
				ssql="update newsdata set d_cataid = '"&trim(cata_2)&"' where d_cataid = '"&cata_1&"'"
				oconn.execute ssql		
				
				'删除被操作的信息类别
				ssql = "delete from newscata where c_rootid = '"&cata_1&"'"
				oconn.execute ssql
					
				call alertmsg("栏目已经合并成功!")
			end if
		end if
	end if
end if	
%>

<%
call header("信息类别合并")
call content()
call footer()

sub content()
%>
<!--#include file = "admin_index_top.asp" -->
<br>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <form name="form1" method="post" action="admin_newscatafix.asp">
    <tr> 
      <td width="55%" height="25"><b><%=homepage_title%> - <font color="#ff0000">新闻栏目合并</font></b></td>
    </tr>
    <tr> 
      <td width="45%" valign="top"> 
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
          <tr bgcolor="#f3f3f3"> 
            <td bgcolor="#799ae1" height="20"> 
              <div align="center"><font color="#ffffff">合并新闻栏目</font></div>
            </td>
          </tr>
          <tr bgcolor="#f3f3f3"> 
            <td bgcolor="#f3f3f3" height="30"> 
              <div align="center">把栏目: 
                <select name="cata_1">
                  <option value ="" selected>--请选择操作类别--</option>
                  <%call getnewscata()%>
                </select>
                合并到: 
                <select name="cata_2">
				<option value ="" selected>--请选择目标栏目--</option>
                <%call getnewscata()%>
                </select>
              </div>
            </td>
          </tr>
          <tr bgcolor="#f3f3f3"> 
            <td height="30"> 
              <div align="center"> 
                <input type="submit" name="submit3" value=" 合 并 " class="button2">
                <input type="hidden" name="action" value="ok">
              </div>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td valign="top"><p><font color="#ff0000">注意:</font><br>
        1、被操作的栏目不能为根类别,即红颜色的类别。<br>
        2、两个相同的类别不能进行合并,意思很明显,自己怎么跟自己合并呀!<br>
        3、被操作类别含有子类别时,不能和其他的类别进行合并,必须先对子类别进行适当的处理。<br>
        4、如果你想把一个含有子类别的类别合并到某个类别下面,你必须先在那个类别下面先对应的建立几个空类别,然后再一一对应合并过去。</p>      </td>
    </tr>
  </form>
</table>
<%
end sub
%>

                                                                                              
                                                                                                    

⌨️ 快捷键说明

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