<?php
# Name: PHP版程氏音乐CMS管理系统 v3.0
# Author: 程氏<web@chshcms.com> [QQ:848769359]
# Homepage:http://www.chshcms.cn/
include_once("../../lib/cs_label.php");
include_once("../loginstate.php");
SystemPer('2_5');
$ac=CS_Request("ac");
$op=CS_Request("op");
$id=CS_Request("id");
?>
<!doctype html>
<html>
<head>
<meta charset="gbk">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>csdjcms management</title>
<link href="../res/css/admin_style.css" rel="stylesheet" />
<script language="javascript" src="../res/js/jquery.js"></script>
<style> 
body{width:440px;}
</style>
<script language="javascript">
$(document).ready(function(){
	$("#danceedit").click(function(){
        <?php if($op==1){ ?>
		var CS_ID=$("#CS_ID").val();
	        $("#CS_ID").css("border-color","#666 #ccc #ccc #666");
	        if(CS_ID==""){
		     $("#CS_ID").css("border","1px solid red");
		     $("#Msg").text("请填写要操作的歌曲ID！").css("color","red");
		     return false;
	        }
        <?php }elseif($op==2){ ?>
		var CS_CID2=$("#CS_CID2").val();
	        $("#CS_CID2").css("border-color","#666 #ccc #ccc #666");
	        if(CS_CID2=="0"){
		     $("#CS_CID2").css("border","1px solid red");
		     $("#Msg").text("请选择要操作的歌曲分类！").css("color","red");
		     return false;
	        }
        <?php }elseif($op==3){ ?>
		var CS_FID2=$("#CS_FID2").val();
	        $("#CS_FID2").css("border-color","#666 #ccc #ccc #666");
	        if(CS_FID2=="0"){
		     $("#CS_FID2").css("border","1px solid red");
		     $("#Msg").text("请填写要操作的歌曲服务器组！").css("color","red");
		     return false;
	        }
        <?php } ?>
	});
});

function dhcolok(){
    this.parent.$('.webox').css({display:'none'});
    this.parent.$('.background').css({display:'none'});
}
</script>
</head>
<body class="body_none">
<div class="nav">
	<ul class="cc">
		<li<?php if($op=="1" || $op=="") echo ' class="current"';?>><a href="?op=1">按歌曲ID操作</a></li>
		<li<?php if($op=="2") echo ' class="current"';?>><a href="?op=2">按歌曲分类操作</a></li>
		<li<?php if($op=="3") echo ' class="current"';?>><a href="?op=3">按服务器组操作</a></li>
	</ul>
</div>
<div>
<!-- mod start -->
<form method="post" class="J_ajaxForm" action="?ac=edit&op=<?php echo $op?>" data-role="edit">
<div class="pop_cont pop_table">
	<table width="100%" style="table-layout:fixed;">
		<col width="90" />
		<col />
         <?php if($op==1 || $op==""){ ?>
		<tr>
			<th>按歌曲ID</th>
			<td>
				<span class="must_red">*</span>
				<input type="text" id="CS_ID" name="CS_ID" class="input input_hd length_5" value="<?php echo $id?>">
				<div class="gray">多个用“,”逗号格开</div>
			</td>
		</tr>
         <?php }elseif($op==2){ ?>
		<tr>
			<th>按歌曲分类</th>
			<td>
				<span class="must_red">*</span>
				<select id="CS_CID2" name="CS_CID2" class="select_5"><option value="0">--选择分类--</option>
                               <?php
                                   $sqlc="select * from ".Getdbname('class')." where CS_SID=1";
                                   $results=$db->query($sqlc);
	                             if($results){
	                                while ($row1=$db->fetch_array($results)){
                                                  echo '<option value="'.$row1['CS_ID'].'">'.$row1['CS_Name'].'</option>';
                                        }
                                     }
                               ?>
				</select>
			</td>
		</tr>
         <?php }elseif($op==3){ ?>
		<tr>
			<th>按服务器组</th>
			<td>
				<span class="must_red">*</span>
				<select id="CS_FID2" name="CS_FID2" class="select_5"><option value="0">--选择服务器组--</option>
                               <?php
                                   $sqlc="select * from ".Getdbname('fwqip')."";
                                   $results=$db->query($sqlc);
	                             if($results){
	                                while ($row2=$db->fetch_array($results)){
                                                  echo '<option value="'.$row2['CS_ID'].'">'.$row2['CS_Name'].'</option>';
                                        }
                                     }
                               ?>
				</select>
			</td>
		</tr>
         <?php } ?>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Color">修改颜色</label></th>
			<td>
				<div class="mb5"><select class="select_2" name="CS_Color">
  			<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>								
			</select></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_CID">转移分类</label></th>
			<td>
				<div class="mb5"><select class="select_2" name="CS_CID">
            					 <?php
              						$sqlclass="select * from ".Getdbname('class')." where CS_YID=0 and CS_SID=1";
									$results=$db->query($sqlclass);
									if($results){
										while ($row3=$db->fetch_array($results)){
										         echo "<option value='".$row3['CS_ID']."' >".$row3['CS_Name']."</option>";
										}
									}
			  
			  			 ?>             
                                         </select></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Singer">修改歌手</label></th>
			<td>
				<div class="mb5"><input type="text" name="CS_Singer" class="input length_5" value=""></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Reco">修改星际</label></th>
			<td>
				<div class="mb5"><select class="select_2" name="CS_Reco">
                                                <option value="0">不推荐</option>
                                                <option value="1">一星际</option>
                                                <option value="2">二星际</option>
                                                <option value="3">三星际</option>
                                                <option value="4">四星际</option>
                                                <option value="5">五星际</option>           
                                         </select></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Hits">修改人气</label></th>
			<td>
				<div class="mb5"><input type="text" name="CS_Hits" class="input length_5" value=""></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_User">修改会员</label></th>
			<td>
				<div class="mb5"><input type="text" name="CS_User" class="input length_5" value=""></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_TID">修改专集</label></th>
			<td>
				<div class="mb5"><select class="select_2" name="CS_TID"><option value='0'>--选择专题--</option>
            					 <?php
              						$sqlt="select * from ".Getdbname('topic')." where CS_YID=0 and CS_SID=1";
									$results=$db->query($sqlt);
									if($results){
										while ($row11=$db->fetch_array($results)){
										         echo "<option value='".$row11['CS_ID']."' selected='selected'>".$row11['CS_Name']."</option>";
										}
									}
			  
			  			 ?>             
                                         </select></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_YID">是否审核</label></th>
			<td>
				<ul class="three_list cc">
					<li><label><input name="CS_YID" type="checkbox" value="ok" checked>审核</label></li>
				</ul>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_AddTime">更新时间</label></th>
			<td>
				<ul class="three_list cc">
					<li><label><input name="CS_AddTime" type="checkbox" checked>更新时间</label></li>
				</ul>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_PID">播放器</label></th>
			<td>
				<div class="mb5"><select class="select_2" name="CS_PID">
                                                <option value="0">wma播放器</option>
                                                <option value="7">mp3,mp4播放器</option>
                                                <option value="1">cmp播放器</option>
                                                <option value="2">flv播放器</option>
                                                <option value="3">优库播放</option>
                                                <option value="4">土豆播放</option>
                                                <option value="5">swf播放器</option>
                                                <option value="6">音乐台播放</option>
                                         </select></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_FID">服务器组</label></th>
			<td>
				<div class="mb5"><select class="select_2" name="CS_FID">
                                                <option value="0">选择服务器</option>
            					 <?php
              						$sqlf="select * from ".Getdbname('fwqip')." ";
									$results=$db->query($sqlf);
									if($results){
										while ($row2=$db->fetch_array($results)){
										         echo "<option value='".$row2['CS_ID']."' >".$row2['CS_Name']."</option>";
										}
									}
			  
			  			 ?>             
                                         </select></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Coin">下载金币</label></th>
			<td>
				<div class="mb5"><input type="text" name="CS_Coin" class="input length_5" value=""></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Vip">下载级别</label></th>
			<td>
				<div class="mb5"><select class="select_2" name="CS_Vip">
                                                <option value="0">游客下载</option>
                                                <option value="1">普通会员</option>
                                                <option value="2">VIP会员</option>          
                                         </select></div>
			</td>
		</tr>
		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Template">修改模版</label></th>
			<td>
				<div class="mb5"><input type="text" id="CS_Template" name="CS_Template" class="input length_3" value=""></div>
			</td>
		</tr>
 		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Title">SEO标题</label></th>
			<td>
				<div class="mb5"><input type="text" id="CS_Title" name="CS_Title" class="input length_5" value=""></div>
				<div class="gray">SEO标题-title</div>
			</td>
		</tr>
 		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Keywords">SEO关词</label></th>
			<td>
				<div class="mb5"><input type="text" id="CS_Keywords" name="CS_Keywords" class="input length_5" value=""></div>
				<div class="gray">SEO关键词-Keywords</div>
			</td>
		</tr>
 		<tr>
			<th><label><input type="checkbox" name="Tid[]" value="CS_Description">SEO介绍</label></th>
			<td>
				<div class="mb5"><input type="text" id="CS_Description" name="CS_Description" class="input length_5" value=""></div>
				<div class="gray">SEO介绍-Description</div>
			</td>
		</tr>
	</table>
</div>
<!-- mod end -->
<div class="pop_bottom">
    <div class="tips_error" id="Msg"></div>
	<button class="btn fr" onclick="dhcolok();" type="button">取消</button>
	<button class="btn btn_submit J_ajax_submit_btn mr10 fr" id="danceedit" type="submit">提交</button>
</div>
</form>
<!-- end -->
</div>
<?php
if($ac=='edit'){
		$CS_ID=CS_Request("CS_ID");
		$CS_Color=CS_Request("CS_Color");
		$CS_CID=CS_Request("CS_CID");
		$CS_CID2=CS_Request("CS_CID2");
		$CS_TID=CS_Request("CS_TID");
		$CS_YID=CS_Request("CS_YID");
		$CS_Singer=CS_Request("CS_Singer");
		$CS_User=CS_Request("CS_User");
		$CS_PID=CS_Request("CS_PID");
		$CS_FID=CS_Request("CS_FID");
		$CS_FID2=CS_Request("CS_FID2");
		$CS_Reco=CS_Request("CS_Reco");
		$CS_Coin=CS_Request("CS_Coin");
		$CS_Vip=CS_Request("CS_Vip");
		$CS_Hits=CS_Request("CS_Hits");
		$CS_Template=CS_Request("CS_Template");
		$CS_AddTime=CS_Request("CS_AddTime");
    		$CS_Title=CS_Request("CS_Title");
    		$CS_Keywords=CS_Request("CS_Keywords");
    	        $CS_Description=CS_Request("CS_Description");

    if($CS_YID!='ok'){
           $CS_YID=1;
    }else{
           $CS_YID=0;
    }

		$CS_CSID = CS_RequestBox("Tid");
		$Arr=explode(',',$CS_CSID);
                switch($op){
	                 case '1':
		              if($CS_ID==""){
			         echo '<script>$("#Msg").text("抱歉,请填写要修改的歌曲ID!").css("color","red");</script>';
			         die();
		              }

                              for($i=0;$i<count($Arr);$i++){
                                     if($Arr[$i]=="CS_Color"){
                                         $db->query("update ".Getdbname('dance')." set CS_Color='".$CS_Color."' where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_CID"){
                                         $db->query("update ".Getdbname('dance')." set CS_CID=".$CS_CID." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_YID"){
                                         $db->query("update ".Getdbname('dance')." set CS_YID=".$CS_YID." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_TID"){
                                         $db->query("update ".Getdbname('dance')." set CS_TID=".$CS_TID." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_FID"){
                                         $db->query("update ".Getdbname('dance')." set CS_FID=".$CS_FID." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Singer"){
                                         $db->query("update ".Getdbname('dance')." set CS_Singer='".$CS_Singer."' where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Reco"){
                                         $db->query("update ".Getdbname('dance')." set CS_Reco=".$CS_Reco." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Coin"){
                                         $db->query("update ".Getdbname('dance')." set CS_Coin=".$CS_Coin." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_PID"){
                                         $db->query("update ".Getdbname('dance')." set CS_PID=".$CS_PID." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_User"){
                                         $db->query("update ".Getdbname('dance')." set CS_User='".$CS_User."' where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Vip"){
                                         $db->query("update ".Getdbname('dance')." set CS_Vip=".$CS_Vip." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Hits"){
                                         $db->query("update ".Getdbname('dance')." set CS_Hits=".$CS_Hits." where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Template"){
                                         $db->query("update ".Getdbname('dance')." set CS_Template='".$CS_Template."' where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_AddTime"){
                                         $db->query("update ".Getdbname('dance')." set CS_AddTime='".date('Y-m-d H:i:s')."' where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Title"){
                                         $db->query("update ".Getdbname('dance')." set CS_Title='".$CS_Title."' where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Keywords"){
                                         $db->query("update ".Getdbname('dance')." set CS_Keywords='".$CS_Keywords."' where CS_ID in (".$CS_ID.")");
                                     }elseif($Arr[$i]=="CS_Description"){
                                         $db->query("update ".Getdbname('dance')." set CS_Description='".$CS_Description."' where CS_ID in (".$CS_ID.")");
                                     }
                              }
                         break;
	                 case '2':
		              if($CS_CID2=="0"){
			         echo '<script>$("#Msg").text("抱歉,选择要操作的分类!").css("color","red");</script>';
			         die();
		              }
                              for($i=0;$i<count($Arr);$i++){
                                     if($Arr[$i]=="CS_Color"){
                                         $db->query("update ".Getdbname('dance')." set CS_Color='".$CS_Color."' where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_CID"){
                                         $db->query("update ".Getdbname('dance')." set CS_CID=".$CS_CID." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_YID"){
                                         $db->query("update ".Getdbname('dance')." set CS_YID=".$CS_YID." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_TID"){
                                         $db->query("update ".Getdbname('dance')." set CS_TID=".$CS_TID." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_FID"){
                                         $db->query("update ".Getdbname('dance')." set CS_FID=".$CS_FID." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Singer"){
                                         $db->query("update ".Getdbname('dance')." set CS_Singer='".$CS_Singer."' where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Reco"){
                                         $db->query("update ".Getdbname('dance')." set CS_Reco=".$CS_Reco." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Coin"){
                                         $db->query("update ".Getdbname('dance')." set CS_Coin=".$CS_Coin." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_PID"){
                                         $db->query("update ".Getdbname('dance')." set CS_PID=".$CS_PID." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_User"){
                                         $db->query("update ".Getdbname('dance')." set CS_User='".$CS_User."' where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Vip"){
                                         $db->query("update ".Getdbname('dance')." set CS_Vip=".$CS_Vip." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Hits"){
                                         $db->query("update ".Getdbname('dance')." set CS_Hits=".$CS_Hits." where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Template"){
                                         $db->query("update ".Getdbname('dance')." set CS_Template='".$CS_Template."' where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_AddTime"){
                                         $db->query("update ".Getdbname('dance')." set CS_AddTime='".date('Y-m-d H:i:s')."' where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Title"){
                                         $db->query("update ".Getdbname('dance')." set CS_Title='".$CS_Title."' where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Keywords"){
                                         $db->query("update ".Getdbname('dance')." set CS_Keywords='".$CS_Keywords."' where CS_CID in (".$CS_CID2.")");
                                     }elseif($Arr[$i]=="CS_Description"){
                                         $db->query("update ".Getdbname('dance')." set CS_Description='".$CS_Description."' where CS_CID in (".$CS_CID2.")");
                                     }
                              }
                         break;
	                 case '3':
		              if($CS_FID2=="0"){
			         echo '<script>$("#Msg").text("抱歉,请填写要操作的服务器组!").css("color","red");</script>';
			         die();
		              }
                              for($i=0;$i<count($Arr);$i++){
                                     if($Arr[$i]=="CS_Color"){
                                         $db->query("update ".Getdbname('dance')." set CS_Color='".$CS_Color."' where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_CID"){
                                         $db->query("update ".Getdbname('dance')." set CS_CID=".$CS_CID." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_YID"){
                                         $db->query("update ".Getdbname('dance')." set CS_YID=".$CS_YID." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_TID"){
                                         $db->query("update ".Getdbname('dance')." set CS_TID=".$CS_TID." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_FID"){
                                         $db->query("update ".Getdbname('dance')." set CS_FID=".$CS_FID." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Singer"){
                                         $db->query("update ".Getdbname('dance')." set CS_Singer='".$CS_Singer."' where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Reco"){
                                         $db->query("update ".Getdbname('dance')." set CS_Reco=".$CS_Reco." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Coin"){
                                         $db->query("update ".Getdbname('dance')." set CS_Coin=".$CS_Coin." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_PID"){
                                         $db->query("update ".Getdbname('dance')." set CS_PID=".$CS_PID." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_User"){
                                         $db->query("update ".Getdbname('dance')." set CS_User='".$CS_User."' where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Vip"){
                                         $db->query("update ".Getdbname('dance')." set CS_Vip=".$CS_Vip." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Hits"){
                                         $db->query("update ".Getdbname('dance')." set CS_Hits=".$CS_Hits." where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Template"){
                                         $db->query("update ".Getdbname('dance')." set CS_Template='".$CS_Template."' where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_AddTime"){
                                         $db->query("update ".Getdbname('dance')." set CS_AddTime='".date('Y-m-d H:i:s')."' where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Title"){
                                         $db->query("update ".Getdbname('dance')." set CS_Title='".$CS_Title."' where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Keywords"){
                                         $db->query("update ".Getdbname('dance')." set CS_Keywords='".$CS_Keywords."' where CS_FID in (".$CS_FID2.")");
                                     }elseif($Arr[$i]=="CS_Description"){
                                         $db->query("update ".Getdbname('dance')." set CS_Description='".$CS_Description."' where CS_FID in (".$CS_FID2.")");
                                     }
                              }
                         break;
                }
             echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,数据批量操作成功!").css("color","#026E12");</script>';
             echo "<script>setTimeout(\"this.parent.$('.webox').css({display:'none'});this.parent.$('.background').css({display:'none'});window.parent.location.reload();\",2000);</script>";
}
?>
</body>
</html>