<?php

/*
'**************************************************************************************************
' 程序名称: CCTVAI开源音乐管理系统
' 官方网站: http://www.cctvai.com
' 联系 Q Q: 1542367792
' QQ交流群：136687984
' 版本：(终结版)
' 备注：未经书面授权，不得向任何第三方提供本软件系统！
' 功能，模板，插件，扩展，定制请联系QQ：1542367792
'**************************************************************************************************
*/
error_reporting(0);
include "../include/cctvai.conn.php";
include "function_common.php";
admincheck(3);
/*if(Smallfivesolution()==$_SERVER['SERVER_NAME']) {
} else {
	echo Smallfivesq();
	exit();
}*/
$action=SafeRequest("action", "get");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="gbk">
<meta name="renderer" content="webkit" /> 
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>后台管理中心</title> 
<link href="css/add.css" rel="stylesheet" />
<style type="text/css">
.table2{width: 100%;max-width: 100%;border-collapse: collapse;border-spacing: 0;}
.table2 td{font-size: 12px;border-top: 1px solid #ddd;padding: 8px;vertical-align: top;}
.table2 tr:hover{text-decoration: none;background-color: #e6f2fb;}
.table2 th{border-bottom: 2px solid #ddd;vertical-align: bottom;padding: 2px;text-align: left;}
.table3{width: 100%;max-width: 100%;border-collapse: collapse;border-spacing: 0;}
.table3 tr:hover{text-decoration: none;background-color: #e6f2fb;}
.table3 td{font-size: 12px;line-height:25px;border-top: 1px solid #ddd;padding: 5px;vertical-align: top;border-right: solid 1px #ddd;}
.table3 th{border-bottom: 2px solid #ddd;vertical-align: bottom;padding: 2px;text-align: left;}
</style>
<script language='javascript'>
function SelectAll() {
	for (var i = 0; i < document.myform.CD_ClassID.length; i++) {
		document.myform.CD_ClassID.options[i].selected = true;
	}
}
function UnSelectAll() {
	for (var i = 0; i < document.myform.CD_ClassID.length; i++) {
		document.myform.CD_ClassID.options[i].selected = false;
	}
}
function $(vId) {
	return document.all ? document.all[vId] : document.getElementById(vId);
}
function switchSupport(vTribe, vFlag) {
	vTribes = {
		'ModifyColor' : '0',
		'ModifyGrade' : '1',
		'ModifyPoints' : '2',
		'ModifyIsbest' : '3',
		'ModifyServer' : '4',
		'ModifySpecial' : '5',
		'ModifyClass' : '6',
		'ModifyUser' : '7',
		'ModifyFrom' : '8',
		'ModifyBitkbps' : '9',
		'ModifySkin' : '10',
		'ModifyDeleted' : '11',
		'ModifyPassed' : '12',
		'ModifySinger' : '13'
	};
	
	for (var i = 0; i < 11; i++) {
		try {
			$('supportTribe' + vTribes[vTribe]).style.color = vFlag ? 'red' : '#000';
			$('supportTitle' + vTribes[vTribe]).style.color = vFlag ? 'black' : '#000';
		} catch (e) {}
		try {
			$('myform').elements['support[' + vTribe + '][soldier][' + i + ']'].disabled = vFlag ? false : true;
			$('myform').elements['support[' + vTribe + '][soldier][' + i + ']'].style.borderColor = vFlag ? '#F93' : '#CCC';
		} catch (e) {}
		try {
			$('myform').elements['support[' + vTribe + '][level][' + i + ']'].disabled = vFlag ? false : true;
		} catch (e) {}
	}
}
</script>
</head> 
<body>
<?php
switch($action) {
	case 'edit':
		Edit();
		break;
	default:
		Main();
		break;
}
?>
</body>
</html>
<?php
Function Main() {
	global $db;
	$id=SafeRequest("id", "get");
?> 
  <div class="contents"> 
   <div class="panel"> 
    <div style="padding: 8px;"> 
     <a href="dance.php" class="btn">所有音乐</a> 
     <a href="class.php" class="btn">分类栏目管理</a> 
     <a href="dancetop.php" class="btn">音乐榜单管理</a> 
     <a href="dance.php?action=add" class="btn">添加音乐</a> 
     <a href="dance.php?action=pass" class="btn">审核音乐</a> 
     <a href="dance.php?action=isbest" class="btn">星级音乐</a> 
     <a href="dance.php?action=error" class="btn">报错的音乐</a> 
     <a href="dance.php?action=deleted" class="btn">音乐回收站</a> 
    </div> 
   </div> 
  </div> 
  <div class="contents"> 
   <div class="panel"> 
    <div class="panel-head"> 
     <strong>若要批量修改某个属性的值，请先选中其左侧的复选框，然后再设定属性值。 </strong> 
    </div> 
    <form method="post" id="myform" name="myform" action="?action=edit"> 
     <table class="table3"> 
      <tbody> 
       <tr> 
        <td align="left"><input type='radio' id='BatchType1' name='BatchType' value='1' <?php if($id<>''){echo ' checked';}?>></td>
        <td width='120' align="left"><label for="BatchType1">修改指定音乐ID</label></td>
        <td align="left"><input type="text" id="CD_ID" name="CD_ID" class="input input_hd length_6" value="<?php echo $id;?>"></td>
       </tr> 
       <tr> 
        <td align="left"><input type='radio' id='BatchType2' name='BatchType' value='2'></td>
        <td align="left"><label for="BatchType2">修改指定服务器的音乐</label></td>
        <td align="left"><select name="CD_ServerID[]"> <?php
$sqlclass='select * from ' . tname('server') . '';
$results=$db->query($sqlclass);
if($results) {
	while($row3=$db->fetch_array($results)) {
		echo "<option value='" . $row3['CD_ID'] . "' >" . $row3['CD_Name'] . '</option>';
	}
}
?></select></td>  
       </tr> 
       <tr> 
        <td align="left"><input type="radio" id="BatchType3" name="BatchType" value="3" /></td> 
        <td align="left"><label for="BatchType3">修改指定栏目的音乐</label></td> 
        <td align="left"><select name="CD_ClassID[]"> <?php
$sql="select CD_ID,CD_Name from " . tname('class') . " where CD_FatherID=0 order by CD_TheOrder asc";
$result=$db->query($sql);
$classnum=$db->num_rows($result);
if($result) {
	while($row=$db->fetch_array($result)) {
		if($cctvai_CD_ClassID==$row['CD_ID']) {
			echo "<option value='" . $row['CD_ID'] . "' selected='selected'>&nbsp;|—" . $row['CD_Name'] . "</option>";
		} else {
			echo "<option value='" . $row['CD_ID'] . "' >&nbsp;|—" . $row['CD_Name'] . "</option>";
		}
echo Get_Fclass_select($row['CD_ID'],'class');				
}
}
?></select></td>  
       </tr> 
       <tr> 
        <td height="35" colspan="3" align="left" bgcolor="#FAFBF7" class="td_border">以上三种指定为修改范围</td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyColor" value="Yes" id="support[ModifyColor][is_able]" onClick="switchSupport('ModifyColor', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe0"><label for="support[ModifyColor][is_able]">标题颜色</label></td> 
        <td><select name="CD_Color" id="support[ModifyColor][soldier][0]" disabled=""> 
        <option value=""></option> 
        <option style="background-color:#00FF00;color: #00FF00" value="#00FF00">绿色</option>
        <option style="background-color:#0000CC;color: #0000CC" value="#0000CC">深蓝</option>
        <option style="background-color:#FFFF00;color: #FFFF00" value="#FFFF00">黄色</option>
        <option style="background-color:#FF33CC;color: #FF33CC" value="#FF33CC">粉红</option>
        <option style="background-color:#FF0000;color: #FF0000" value="#FF0000">红色</option>
        <option style="background-color:#660099;color: #660099" value="#660099">紫色</option>
        <option style="background-color:#FFFFFF;color: #FFFFFF" value="">无色</option> 
        </select>
        </td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyGrade" value="Yes" id="support[ModifyGrade][is_able]" onClick="switchSupport('ModifyGrade', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe1"><label for="support[ModifyGrade][is_able]">下载权限</label></td> 
        <td><select name="CD_Grade" id="support[ModifyGrade][soldier][0]" disabled=""> <option value="0">游客下载</option> <option value="1" selected="">普通用户</option> <option value="2">VIP 用户</option> </select></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyPoints" value="Yes" id="support[ModifyPoints][is_able]" onClick="switchSupport('ModifyPoints', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe2"><label for="support[ModifyPoints][is_able]">下载扣除金币</label></td> 
        <td><input class="input length_1" name="CD_Points" id="support[ModifyPoints][soldier][0]" type="text" size="5" value="0" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" disabled="" /></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyIsbest" value="Yes" id="support[ModifyIsbest][is_able]" onClick="switchSupport('ModifyIsbest', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe3"><label for="support[ModifyIsbest][is_able]">星级推荐</label></td> 
        <td><select name="CD_Isbest" id="support[ModifyIsbest][soldier][0]" disabled=""> <option value="0" selected="">不推荐</option> <option value="1">一星级</option> <option value="2">二星级</option> <option value="3">三星级</option> <option value="4">四星级</option> <option value="5">五星级</option> </select></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyServer" value="Yes" id="support[ModifyServer][is_able]" onClick="switchSupport('ModifyServer', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe4"><label for="support[ModifyServer][is_able]">服 务 器</label></td>
        <td><select name="CD_Server" id="support[ModifyServer][soldier][0]" disabled=""> <option value="0" selected="">不设置</option> <?php
$sqlclass='select * from ' . tname('server') . '';
$results=$db->query($sqlclass);
if($results) {
	while($row3=$db->fetch_array($results)) {
		echo "<option value='" . $row3['CD_ID'] . "' >" . $row3['CD_Name'] . '</option>';
	}
}
?></select></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyClass" value="Yes" id="support[ModifyClass][is_able]" onClick="switchSupport('ModifyClass', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe6"><label for="support[ModifyClass][is_able]">移动到分类</label></td> 
        <td><select name="CD_Class" id="support[ModifyClass][soldier][0]" disabled=""> <option value="0" selected="">选择分类</option> 
<?php
$sql="select CD_ID,CD_Name from " . tname('class') . " where CD_FatherID=0 order by CD_TheOrder asc";
$result=$db->query($sql);
$classnum=$db->num_rows($result);
if($result) {
	while($row=$db->fetch_array($result)) {
		if($cctvai_CD_ClassID==$row['CD_ID']) {
			echo "<option value='" . $row['CD_ID'] . "' selected='selected'>&nbsp;|—" . $row['CD_Name'] . "</option>";
		} else {
			echo "<option value='" . $row['CD_ID'] . "' >&nbsp;|—" . $row['CD_Name'] . "</option>";
		}
echo Get_Fclass_select($row['CD_ID'],'class');				
}
}
?></select></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifySpecial" value="Yes" id="support[ModifySpecial][is_able]" onClick="switchSupport('ModifySpecial', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe5"><label for="support[ModifySpecial][is_able]">移动到专辑</label></td> 
        <td><select name="CD_Special" id="support[ModifySpecial][soldier][0]" disabled=""> <option value="0">不选择</option> <?php
$sqlclass='select CD_ID,CD_Name from ' . tname('malbum') . '';
$results=$db->query($sqlclass);
if($results) {
	while($row3=$db->fetch_array($results)) {
		echo "<option value='" . $row3['CD_ID'] . "' >" . $row3['CD_Name'] . '</option>';
	}
}
?></select></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyUser" value="Yes" id="support[ModifyUser][is_able]" onClick="switchSupport('ModifyUser', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe7"><label for="support[ModifyUser][is_able]">所属会员</label></td> 
        <td><input class="input length_3" name="CD_User" id="support[ModifyUser][soldier][0]" type="text" size="5" value="" disabled="" /><font color="#d01f3c">&nbsp;必须是站内注册用户帐号！必须存在！不能乱写！</font></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifySinger" value="Yes" id="support[ModifySinger][is_able]" onClick="switchSupport('ModifySinger', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe7"><label for="support[ModifySinger][is_able]">所属歌手</label></td> 
        <td><input class="input length_3" name="CD_Singer" id="support[ModifySinger][soldier][0]" type="text" size="5" value="" disabled="" /></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyFrom" value="Yes" id="support[ModifyFrom][is_able]" onClick="switchSupport('ModifyFrom', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe8"><label for="support[ModifyFrom][is_able]">所属来源</label></td> 
        <td><input class="input length_1" name="CD_From" id="support[ModifyFrom][soldier][0]" type="text" size="5" value="" disabled="" /></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyBitkbps" value="Yes" id="support[ModifyBitkbps][is_able]" onClick="switchSupport('ModifyBitkbps', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe9"><label for="support[ModifyBitkbps][is_able]">音频码率</label></td> 
        <td><input class="input length_1" name="CD_Bitkbps" id="support[ModifyBitkbps][soldier][0]" type="text" size="5" value="" disabled="" /></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifySkin" value="Yes" id="support[ModifySkin][is_able]" onClick="switchSupport('ModifySkin', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe10"><label for="support[ModifySkin][is_able]">播放模板</label></td> 
        <td><input class="input length_2" name="CD_Skin" id="support[ModifySkin][soldier][0]" type="text" size="5" value="" disabled="" /></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyDeleted" value="Yes" id="support[ModifyDeleted][is_able]" onClick="switchSupport('ModifyDeleted', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe11"><label for="support[ModifyDeleted][is_able]">删除音乐</label></td> 
        <td><select name="CD_Deleted" id="support[ModifyDeleted][soldier][0]" disabled=""> <option value="0" selected="">移进回收站</option> <option value="1">从回收站恢复</option> <option value="2">直接删除</option> </select></td> 
       </tr> 
       <tr> 
        <td width="30" align="center"><input type="checkbox" name="ModifyPassed" value="Yes" id="support[ModifyPassed][is_able]" onClick="switchSupport('ModifyPassed', this.checked)" /></td> 
        <td width="100" align=" left" id="supportTribe12"><label for="support[ModifyPassed][is_able]">音乐审核</label></td> 
        <td><input name="CD_Passed" type="radio" id="support[ModifyPassed][soldier][0]" value="0" checked="" disabled="" />&nbsp;通过&nbsp;<input name="CD_Passed" type="radio" id="support[ModifyPassed][level][0]" value="1" disabled="" />&nbsp;取消</td> 
       </tr> 
       <tr> 
        <td height="35" colspan="3" align="left" bgcolor="#FAFBF7" class="td_border"> <button type="submit" id="adddance" class="btn btn_submit J_ajax_submit_btn" style="margin-left: 10px;">确定提交</button> &nbsp;&nbsp;<font color="#d01f3c">注意：批量设置只对该表进行设置，不与积分,奖惩,动态挂钩！</font> </td> 
       </tr> 
      </tbody> 
     </table> 
    </form>
   </div> 
  </div> 
<?php
}
Function Edit() {
	global $db;
	$cctvai_Com_CD_ID=SafeRequest('CD_ID', 'post');
	$cctvai_Com_BatchType=SafeRequest('BatchType', 'post');
	$cctvai_Com_ClassID=RequestBox('CD_ClassID');
	$cctvai_Com_ServerID=RequestBox('CD_ServerID');
	$cctvai_Com_Hits=SafeRequest('CD_Hits', 'post');
	$cctvai_Com_User=SafeRequest('CD_User', 'post');
	$cctvai_Com_Singer=SafeRequest('CD_Singer', 'post');
	$cctvai_Com_Color=SafeRequest('CD_Color', 'post');
	$cctvai_Com_Grade=SafeRequest('CD_Grade', 'post');
	$cctvai_Com_Points=SafeRequest('CD_Points', 'post');
	$cctvai_Com_Server=SafeRequest('CD_Server', 'post');
	$cctvai_Com_Isbest=SafeRequest('CD_Isbest', 'post');
	$cctvai_Com_Skin=SafeRequest('CD_Skin', 'post');
	$cctvai_Com_Passed=SafeRequest('CD_Passed', 'post');
	$cctvai_Com_Class=SafeRequest('CD_Class', 'post');
	$cctvai_Com_SpecialID=SafeRequest('CD_Special', 'post');
	$cctvai_Com_Deleted=SafeRequest('CD_Deleted', 'post');
	$cctvai_Com_Bitkbps=SafeRequest('CD_Bitkbps', 'post');
	$cctvai_Com_From=SafeRequest('CD_From', 'post');
	$cctvai_Com_ModifyHits=SafeRequest('ModifyHits', 'post');
	$cctvai_Com_ModifyUser=SafeRequest('ModifyUser', 'post');
	$cctvai_Com_ModifySinger=SafeRequest('ModifySinger', 'post');
	$cctvai_Com_ModifyColor=SafeRequest('ModifyColor', 'post');
	$cctvai_Com_ModifyGrade=SafeRequest('ModifyGrade', 'post');
	$cctvai_Com_ModifyPoints=SafeRequest('ModifyPoints', 'post');
	$cctvai_Com_ModifyServer=SafeRequest('ModifyServer', 'post');
	$cctvai_Com_ModifyIsbest=SafeRequest('ModifyIsbest', 'post');
	$cctvai_Com_ModifySkin=SafeRequest('ModifySkin', 'post');
	$cctvai_Com_ModifyPassed=SafeRequest('ModifyPassed', 'post');
	$cctvai_Com_ModifyClass=SafeRequest('ModifyClass', 'post');
	$cctvai_Com_ModifySpecial=SafeRequest('ModifySpecial', 'post');
	$cctvai_Com_ModifyDeleted=SafeRequest('ModifyDeleted', 'post');
	$cctvai_Com_ModifyBitkbps=SafeRequest('ModifyBitkbps', 'post');
	$cctvai_Com_ModifyFrom=SafeRequest('ModifyFrom', 'post');
	If($cctvai_Com_BatchType=='1') {
		$sql1="CD_ID in ($cctvai_Com_CD_ID)";
	} ElseIf($cctvai_Com_BatchType=='2') {
		$sql1="CD_Server in ($cctvai_Com_ServerID)";
	} ElseIf($cctvai_Com_BatchType=='3') {
		$sql1="CD_ClassID in ($cctvai_Com_ClassID)";
	}
	If($cctvai_Com_ModifyPoints=='Yes') {
		If($cctvai_Com_Points=='') {
			showmessage('出错了，下载扣除点数不能为空！', '', 1);
		}
		if($db->query($sql='update ' . tname('dj') . ' set CD_Points=' . $cctvai_Com_Points . ' where ' . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyHits=='Yes') {
		If($cctvai_Com_Hits=='') {
			showmessage('出错了，试听次数不能为空！', '', 1);
		}
		if($db->query($sql='update ' . tname('dj') . ' set CD_Hits=' . $cctvai_Com_Hits . ' where ' . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyUser=='Yes') {
		If($cctvai_Com_User=='') {
			showmessage('出错了，添加会员不能为空！', '', 1);
		}
		if($db->query($sql='update ' . tname('dj') . " set CD_User='" . $cctvai_Com_User . "' where " . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyFrom=='Yes') {
		If($cctvai_Com_From=='') {
			showmessage('出错了，来源不能为空！', '', 1);
		}
		if($db->query($sql='update ' . tname('dj') . " set CD_From='" . $cctvai_Com_From . "' where " . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyBitkbps=='Yes') {
		If($cctvai_Com_Bitkbps=='') {
			showmessage('出错了，码率不能为空！', '', 1);
		}
		if($db->query($sql='update ' . tname('dj') . " set CD_Bitkbps='" . $cctvai_Com_Bitkbps . "' where " . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifySinger=='Yes') {
		If($cctvai_Com_Singer=='') {
			showmessage('出错了，所属歌手不能为空！', '', 1);
		}
		//检测歌手$singername['CD_ID']
		$singername=$db->getrow("select CD_ID from " . tname('singer') . " where CD_Name='" . $cctvai_Com_Singer . "'");
		if($singername=="") {
			if($cctvai_Com_User=="") {
				$cctvai_Com_User="admin";
			}
			$setarr=array(
				'CD_ClassID'=>4,
				'CD_Name'=>$cctvai_Com_Singer,
				'CD_Sex'=>'',
				'CD_Bieming'=>'',
				'CD_Guoji'=>'',
				'CD_Yuan'=>'',
				'CD_Birth'=>'',
				'CD_Birthday'=>'',
				'CD_Sign'=>'',
				'CD_Height'=>'',
				'CD_Kg'=>'',
				'CD_User'=>$cctvai_Com_User,
				'CD_Pic'=>'',
				'CD_Intro'=>'',
				'CD_Hits'=>0,
				'CD_IsBest'=>1,
				'CD_Passed'=>1,
				'CD_AddTime'=>date('Y-m-d H:i:s')
			);
			inserttable('singer', $setarr, 1);
			$singername=$db->getrow("select CD_ID from " . tname('singer') . " where CD_User='" . $cctvai_Com_User . "' and CD_Name='" . $cctvai_Com_Singer . "'  order by CD_ID desc");
		}
 		if(!IsNum($singername['CD_ID'])) {
			$singername['CD_ID']=0;
		} 
		if($db->query($sql='update ' . tname('dj') . " set CD_Singer='" . $singername['CD_ID'] . "' where " . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyColor=='Yes') {
		if($db->query($sql='update ' . tname('dj') . " set CD_Color='" . $cctvai_Com_Color . "' where " . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyGrade=='Yes') {
		if($db->query($sql='update ' . tname('dj') . ' set CD_Grade=' . $cctvai_Com_Grade . ' where ' . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyServer=='Yes') {
		if($db->query($sql='update ' . tname('dj') . ' set CD_Server=' . $cctvai_Com_Server . ' where ' . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyIsbest=='Yes') {
		if($db->query($sql='update ' . tname('dj') . ' set CD_Isbest=' . $cctvai_Com_Isbest . ' where ' . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifySkin=='Yes') {
		If($cctvai_Com_Skin=='') {
			showmessage('出错了，播放页风格模板不能为空！', '', 1);
		}
		if($db->query($sql='update ' . tname('dj') . " set CD_Skin='" . $cctvai_Com_Skin . "' where " . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyPassed=='Yes') {
		if($db->query($sql='update ' . tname('dj') . ' set CD_Passed=' . $cctvai_Com_Passed . ' where ' . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyClass=='Yes') {
		If($cctvai_Com_Class=='0') {
			showmessage('出错了，请先选择分类！', '', 1);
		}
		if($db->query($sql='update ' . tname('dj') . ' set CD_ClassID=' . $cctvai_Com_Class . ' where ' . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifySpecial=='Yes') { //$cctvai_Com_CD_ID
		if($db->query($sql='update ' . tname('dj') . ' set CD_SpecialID=' . $cctvai_Com_SpecialID . ' where ' . $sql1 . '')) {
		}
	}
	If($cctvai_Com_ModifyDeleted=='Yes') {
		If($cctvai_Com_Deleted=='0') {
			if($db->query($sql='update ' . tname('dj') . ' set CD_Deleted=1 where ' . $sql1 . '')) {
			}
		} ElseIf($cctvai_Com_Deleted=='1') {
			if($db->query($sql='update ' . tname('dj') . ' set CD_Deleted=0 where ' . $sql1 . '')) {
			}
		} ElseIf($cctvai_Com_Deleted=='2') {
			$query=$db->query("select CD_Url,CD_Pic,CD_DownUrl from " . tname('dj') . " where CD_ID in ($cctvai_Com_CD_ID)");
			while($row=$db->fetch_array($query)) {
				if(delunlink($row['CD_Pic'])==true) {
					@unlink(_cctvai_root_ . $row['CD_Pic']);
				}
				if(delunlink($row['CD_Url'])==true) {
					@unlink(_cctvai_root_ . $row['CD_Url']);
				}
				if(delunlink($row['CD_DownUrl'])==true) {
					@unlink(_cctvai_root_ . $row['CD_DownUrl']);
				}
			}
			$arr=explode(",", $cctvai_Com_CD_ID);
			$num=count($arr);
			if($db->query($sql='delete from ' . tname('dj') . ' where ' . $sql1 . '')) {
			}
			if($db->query('update ' . tname('system') . " set cd_djmub=cd_djmub-'$num'")) {
			}
		}
	}
	showmessage('恭喜您，批量设置数据成功！', 'dance.php', 0);
}
?>