<?php
include("loginkey.php");//引入权限检测文件
include("include/config.php");//引入公共变量文件
include("include/common.php");//引入公共函数文件
$lm_id = cinput($_GET['lm_id']);
$lm_error = cinput($_GET['lm_error']);
//查找是否有下级目录
$sqlstr="select * from limao_nm where lm_nmid='".mysql_real_escape_string($lm_id)."' limit 1";
$rs = limaors($sqlstr);
$rows=mysql_fetch_assoc($rs);
if($rows){
	  viewmsg('此栏目有下属二级栏目无法删除！','list_namo.php');
	}else{
switch($lm_error){
	case 1:
	$sqlstr = "select * from limao_article where lm_type='".mysql_real_escape_string($lm_id)."'";
	$num = lmtotal($sqlstr);
	if($num>=1){
	viewmsg('对不起此栏目下有关联文章无法删除','list_namo.php');	
break;
  }else{
$delsql="delete from limao_nm where lm_id='".mysql_real_escape_string($lm_id)."'"; 
limaors($delsql);
viewmsg('栏目信息已经删除啦！','list_namo.php');
break;
  	}
  case 2:
$sqlstr = "select * from limao_shop where lm_type='".mysql_real_escape_string($lm_id)."'";
$num = lmtotal($sqlstr);
	if($num>=1){
	viewmsg('对不起此栏目下有关联商品无法删除','list_namo.php');	
break;
 }else{
$delsql="delete from limao_nm where lm_id='".mysql_real_escape_string($lm_id)."'"; 
limaors($delsql);
viewmsg('栏目信息已经删除啦！','list_namo.php'); 
break;
  	}
  default:
  
//$delsql="delete from limao_nm where lm_id='".mysql_real_escape_string($lm_id)."'"; 
//limaors($delsql);
//viewmsg('栏目信息已经删除啦！','list_namo.php');
  			
		}
	
	
	}
		
	
   

?>