<?php

/*

'**************************************************************************************************

' 软件名称: 黑色幻想舞曲管理系统CMS2.0

' 版本编号: hshxsdj 2.0

' 官方网站: http://www..hshxs.com

' 官方论坛：http://bbs.hshxs.com

' 版权所有: 黑色幻想开发团队    噬己翼(QQ:532917920)

' 郑重声明:

'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；

'    2、黑色幻想网络事业部保留此软件的法律追究权利

'**************************************************************************************************

*/

include "../include/conn.php";

include "../include/function.php";

include "admin_version.php";

include "admin_loginstate.php";

include "../include/userset.php";

@set_time_limit(0);

@header("Cache-control: private"); 

@header("Content-type: text/html;charset=gb2312");

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>舞曲管理</title>

<link  href="images/style.css" rel="stylesheet" type="text/css" />

<link type="text/css" href="images/alerts.css" rel="stylesheet" media="screen">

<script type="text/javascript" language="javascript">var tentpath='<?php echo S_SitePath?>';</script>

<script language="javascript" type="text/javascript" src="js/jquery.js"></script>

<script language="javascript" type="text/javascript" src="js/video.js"></script>

<script language="javascript" src="js/alerts.js"></script>

<script language="javascript">

$(document).ready(function(){

	$("#addvideo").click(function(){

		var S_Name=$("#S_Name").val();

		var S_ClassID=$("#S_ClassID").val();

		var S_Remark=$("#S_Remark").val();

		var S_Source=$("#S_Source1").val();

		var S_Vdata1=$("#S_Vdata1").val();

	$("#S_Name").css("border-color","#666 #ccc #ccc #666");

	$("#SClassID").text("");

	$("#SSource").text("");

	$("#S_Vdata1").css("border-color","#666 #ccc #ccc #666");

	if(S_Name==""){

		$("#S_Name").css("border","1px solid red");

		$("#SClassID").text("出错了，请填写舞曲名称！").css("color","red");

		jAlert("出错了，请填写舞曲名称！","操作提示");

		

		return false;

		}

	else if(S_ClassID=="0"){

		$("#SClassID").text("请选择舞曲分类！").css("color","red");

		jAlert("出错了，请选择舞曲分类！","操作提示");

		return false;

		}

	else if(S_Source==""){

		$("#SSource").text("请选择播放源").css("color","red");

		jAlert("出错了，请选择播放源！","操作提示");

		return false;}

	else if(S_Vdata==""){

		$("#S_Vdata").css("border","1px solid red");

		$("#S_Vdata").focus();

		jAlert("出错了，请填写播放地址！","操作提示");

		return false;}

	else if(S_Templay==""){

		$("#S_Templay").css("border","1px solid red");

		$("#S_Templay").focus();

		jAlert("出错了，请选择播放页模版！","操作提示");

		return false;}

	});

	$("#showvideo1").click(function (){

	window.location='?action=listbylz';

	});

	$("#showvideo2").click(function(){

	window.location='admin_Video.asp?action=listbylz';

	});

	$("#showvideo3").click(function (){

	window.location='admin_Video.asp?action=listbylz&types=unclass';

	});

	

	$("#btn_editall").click(function(){

		jConfirm('您确定要执行操作吗?', '操作提示', function(r) {

				if(r==true){formb.submit();}

				});

	 });

	

	$("#delallsel1").click(function(){

		$("#deltypes").show();

	})

	

	$("#delallsel6").click(function(){

		$("#deltypes").hide();

	})

	$("#delallsel10").click(function(){

		$("#deltypes").hide();

	})

	

});



function del(id,url){

	jConfirm('您确定要删除该舞曲吗?', '操作提示', function(r) {

		if(r==true){

			window.location='?action=del&S_ID='+id+'&url='+url;

			}

				});

		

		}

function RemoveData(pid){

		jConfirm('确定移除本组舞曲数据吗?', '操作提示', function(r) {

				if(r==true){

					$('#'+pid).remove();

					}

				});

	}	

	

function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}



function chgclass(id,cid){

	$.get("js/ajaxfun.php?action=chgclasslist&id="+id+"&cid="+cid+"&sid=1",function(R){

			$("#class_"+id).html(R);												

			})

	}

	

function savechgclass(cid,id){

	$.get("js/ajaxfun.php?action=savecls&id="+id+"&cid="+cid+"&sid=1",function(R){

				$("#class_"+id).html(R);													  

			});

	}



function SelectTemplets(fname){

   if(document.all){

     var posLeft = window.event.clientY-100;

     var posTop = window.event.clientX-400;

   }

   else{

     var posLeft = 100;

     var posTop = 100;

   }

   window.open("admin_templets.php?f="+fname, "popmoldWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);

}

</script>

   



</head>



<body>

<?php

SystemPer(2);

	class ui_video{

		

		public function editdata($Arr,$url){

			global $editor;

			global $db;

			$playadd=playadd(1);

			$editor->BasePath='edit';

			$editor->Height=465;

			$editor->Width=650;

			$editor->AutoSave=false;

						$name=$Arr[0];

						$color=$Arr[1];

						$author=$Arr[2];

						$direct=$Arr[3];

						$pic=$Arr[4];

						$reco=$Arr[5];

						$hits=$Arr[6];

						$hide=$Arr[7];

						$key=$Arr[8];

						$remark=$Arr[9];

						$content=$Arr[10];

						$isend=$Arr[11];

						$source=$Arr[12];

						$vdata=$Arr[13];

						$year=$Arr[14];

						$lan=$Arr[15];

						$topic=$Arr[16];

						$class=$Arr[17];

						$area=$Arr[18];

						$path=$Arr[19];

						$S_PurView=$Arr[20];

						$S_Templay=$Arr[21];

						$S_dx=$Arr[22];

						$S_yz=$Arr[23];

						$S_btime=$Arr[24];

						$rhits=$Arr[25];

						$zhits=$Arr[26];

						$yhits=$Arr[27];

						$shits=$Arr[28];

						$xhits=$Arr[29];

			$editor->Value=	$content;		

			//图片保存路径session

			$_SESSION['imgtypes']="video";

			//舞曲保存路径session

			$_SESSION['djtypes']="upload/url";

?>

<div class="r_main">

	<div class="r_content">

		<div class="r_content_1">

<table width="100%" border="0" cellpadding="0" cellspacing="0"  class="tb_style">	

							<form action="<?php echo $url?>" method="post"  name="form1" >

							  <input name="lasturl"  type="hidden" value="<?php echo urlencode($_SERVER['HTTP_REFERER']); ?>">

							  <tr>

                                <td colspan="3" class="td_title">&nbsp;舞曲数据</td>

                              </tr>

                              

							  <tr>

								

								<td width="11%"  height="30" class="td_border">&nbsp;舞曲名称：

							        &nbsp;&nbsp;</td>

							    <td width="89%" class="td_border"><input type="text" name="S_Name" id="S_Name" value="<?php echo $name?>" size="35" />

                                  <font color="#FF0000">＊</font>

                                  颜色：

<select name="S_Color" >

  <?php if(!IsNul($color)){?>

  <option  value=""></option>

  <?php }else{?>

  <option style="background-color:<?php echo $color?>;color: <?php echo $color?>" value="<?php echo $color?>"></option>

  <?php }?>

  <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>

&nbsp;&nbsp;舞曲分类：

<select name="S_ClassID" id="S_ClassID">

              <?php

              	$sqlclass="select * from s_class where S_SystemID=1 ";

				$results=$db->query($sqlclass);

				if($results){

					while ($row3=$db->fetch_array($results)){

						if($class==$row3['S_ID']){

							echo "<option value='".$row3['S_ID']."' selected='selected'>".$row3['S_Name']."</option>";

							}

						else{

							echo "<option value='".$row3['S_ID']."' >".$row3['S_Name']."</option>";

							}	

						

						}

					}

			  ?>	 

</select><font color="#FF0000">＊</font><label id="SClassID"></label></td>

							  </tr>

							  <tr>

								

								<td width="11%" height="30" class="td_border">&nbsp;舞曲歌手：</td>

							    <td height="30" class="td_border"><input name="S_Author" type="text" id="S_Author" value="<?php echo $author?>" size="20" onfocus="this.style.borderColor='#F93'" onblur="this.style.borderColor='#CCC'" />

<select onChange='S_Author.value=this.value;'>

                                                <option value=''>选择歌手</option>

                                                <option value='网络转摘'>网络转摘</option>

                                                <option value='本站原创'>本站原创</option>

                                                </select>

                                  <input type="checkbox" name="edittime" class="checkbox" id="edittime"   value="1" checked="checked"/>

更新时间</td>

							  </tr>

							  <tr>

								<td width="11%" height="30" class="td_border">&nbsp;图片地址：</td>

							    <td height="30" class="td_border"><input name="S_Pic" type="text" id="S_Pic" value="<?php echo $pic?>" size="35" />

                                  <input name="doClear" type="button" class="rb1" id="doClear" value="清  除" onclick="javascript:document.form1.S_Pic.value='';"/>

                                  <iframe src="js/upload.php?action=video" scrolling="No" topmargin="0" width="300" height="30" marginwidth="0" marginheight="0" frameborder="0" align="center"></iframe>                                </td>

							  </tr>

							  

							  <tr>

							    <td width="11%" height="30" class="td_border">&nbsp;推荐星级：</td>

						        <td height="30" class="td_border">

<select name="S_Reco" id="S_Reco" style=" color:#FF0000; " >

                                  <option value="0" <?php if($reco==0){echo "selected";}?>>取消</option>

                                  <option value="1" <?php if($reco==1){echo "selected";}?>>一星</option>

                                  <option value="2" <?php if($reco==2){echo "selected";}?>>二星</option>

                                  <option value="3" <?php if($reco==3){echo "selected";}?>>三星</option>

								  <option value="4" <?php if($reco==4){echo "selected";}?>>四星</option>

                                  <option value="5" <?php if($reco==5){echo "selected";}?>>五星</option>

</select>

&nbsp;日人气：

<input type="text" name="S_Rhits" id="S_Rhits" value="<?php if(!IsNum($rhits)){$rhits=0;}?><?php echo $rhits?>"  size="4" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>

&nbsp;周人气：

<input type="text" name="S_Zhits" id="S_Zhits" value="<?php if(!IsNum($zhits)){$zhits=0;}?><?php echo $zhits?>"  size="4" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>

&nbsp;月人气：

<input type="text" name="S_Yhits" id="S_Yhits" value="<?php if(!IsNum($yhits)){$yhits=0;}?><?php echo $yhits?>"  size="4" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>

&nbsp;收人气：

<input type="text" name="S_Shits" id="S_Shits" value="<?php if(!IsNum($shits)){$shits=0;}?><?php echo $shits?>"  size="4" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>

&nbsp;下人气：

<input type="text" name="S_Xhits" id="S_Xhits" value="<?php if(!IsNum($xhits)){$xhits=0;}?><?php echo $xhits?>"  size="4" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>

&nbsp;总人气：

<input type="text" name="S_Hits" id="S_Hits" value="<?php if(!IsNum($hits)){$hits=0;}?><?php echo $hits?>"  size="4" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>

</td>

							  </tr>

							  <tr>

							    <td height="30" class="td_border">&nbsp;所属会员：</td>

							    <td height="30" class="td_border">

<input name="S_Direct" type="text" id="S_Direct" value="<?php if($direct==""){ echo "admin";}else{ echo $direct;}?>" size="30" onfocus="this.style.borderColor='#F93'" onblur="this.style.borderColor='#CCC'" />

<select onChange='S_Direct.value=this.value;'>

                                                <option value='admin'>选择会员</option>

              <?php

              	$sqluser="select * from s_users where S_State=0 ";

				$results=$db->query($sqluser);

				if($results){

					while ($rowu=$db->fetch_array($results)){

						if($direct=="".$rowu['S_Name'].""){

							echo "<option value='".$rowu['S_Name']."' selected='selected'>".$rowu['S_Name']."</option>";

							}

						else{

							echo "<option value='".$rowu['S_Name']."' >".$rowu['S_Name']."</option>";

							}	

						

						}

					}

			  ?>	



                                                </select><font color="#FF0000">&nbsp;＊请选择会员，您也可以输入会员名称如：admin</font>

</td>

						      </tr>

						

							  <tr>

								

								<td width="11%" height="30" class="td_border">&nbsp;所属地区：</td>

							    <td height="30" class="td_border"><select name="S_Area" id="S_Area" >

                                <?php

                                if($area!=""){

									echo "<option value=$area>$area</option>";

									}

								?>

                                  	<option value="未知">选择地区</option>

                <?php

              	$sqlclass="select * from s_area ";

				$results=$db->query($sqlclass);

				if($results){

					while ($row3=$db->fetch_array($results)){

						if($area==$row3['S_AreaName']){

							echo "<option value='".$row3['S_AreaName']."' selected='selected'>".$row3['S_AreaName']."</option>";

							}

						else{

							echo "<option value='".$row3['S_AreaName']."' >".$row3['S_AreaName']."</option>";

							}	

						

						}

					}

			  ?>

                                </select>

&nbsp;所属语言：

<select name="S_Language" id="S_Language" >

	<?php

    if($lan!=""){

        echo "<option value=$lan>$lan</option>";

        }

    ?>

  <option value="未知">选择语言</option>

                <?php

              	$sqlclass="select * from s_area ";

				$results=$db->query($sqlclass);

				if($results){

					while ($row3=$db->fetch_array($results)){

						if($lan==$row3['S_Language']){

							echo "<option value='".$row3['S_Language']."' selected='selected'>".$row3['S_Language']."</option>";

							}

						else{

							echo "<option value='".$row3['S_Language']."' >".$row3['S_Language']."</option>";

							}	

					

						}

					}

			  ?>

    </select>

&nbsp;发行年月：<input id="S_Year" name="S_Year" size="8" value="<?php if($year==""){ echo date( "Y");}else{ echo $year;}?>"></td>

							  </tr>

							  

							  <tr>

							    <td width="11%" height="30" class="td_border">&nbsp;所属专题：</td>

						        <td height="30" class="td_border">

              <select name="S_Topic" id="S_Topic">

              <option value="0">选择专题</option>

              <?php

              	$sqlclass="select * from s_topic where S_SystemID=1 ";

				$results=$db->query($sqlclass);

				if($results){

					while ($row3=$db->fetch_array($results)){

						if($topic==$row3['S_ID']){

							echo "<option value='".$row3['S_ID']."' selected='selected' >".$row3['S_Name']."</option>";

							}

						else{

							echo "<option value='".$row3['S_ID']."' >".$row3['S_Name']."</option>";

							}	

					

						}

					}

			  

			  ?>

               </select>

&nbsp;舞曲大小：<input id="S_Dx" name="S_Dx" size="15" value="<?php echo $S_dx?>">

&nbsp;舞曲音质：<input id="S_Yz" name="S_Yz" size="15" value="<?php echo $S_yz?>">

&nbsp;舞曲时长：<input id="S_Btime" name="S_Btime" size="15" value="<?php echo $S_btime?>"></td>

							  </tr>

                              

							  <tr>

								

								<td width="11%" height="30" class="td_border">&nbsp;下载点数：</td>

							    <td height="30" class="td_border"><input name="S_IsEnd" type="text" id="S_IsEnd" size="50" value="<?php if($isend==""){ echo "0";}else{echo $isend;}?>"/>

						        <font color="#FF0000">＊</font></td>

							  </tr>



							  <tr>

								

								<td width="11%" height="30" class="td_border">&nbsp;舞曲标签：</td>

							    <td height="30" class="td_border"><input name="S_Keywords" type="text" id="S_Keywords" size="50" value="<?php echo $key?>"/>

						        <br />

						        <font color="#FF0000">＊ 注意：每个标签关健词可以使用&quot;逗号,空格,|,下划线,&quot;来隔开</font></td>

							  </tr>



							  <tr>

								<td height="30" colspan="2" class="td_border">

                                        			<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">

                                                        <tr>

                                                            <td width="11%" height="30" class="td_border">

                                                                &nbsp;播放来源：</td>

                                                            <td width="89%" class="td_border">

                                                            <select name="S_Source" id="S_Source">

                                                              <option value=''>暂无数据</option>

                                                              <?php echo playselect($playadd,$source);?>

                                                            </select> <font color="#FF0000">＊</font> 

                                                            &nbsp;服务器组:

                                                            <select name="S_Server" id="S_Server">

                                                              <option value="0">服务器组</option>

                                                              <?php echo getAddPath($path);?>

                                                            </select>                         

                                                            &nbsp;播放页面风格模板：<input id="S_Templay" name="S_Templay" size="10" value="<?php echo $S_Templay?>"> &nbsp;<input type="button" value="浏览..." style="width:60px"  onClick="SelectTemplets('form1.S_Templay');" class="rb1" />                               

                                                            <font color="#FF0000">＊可以利用这个功能支持所有播放器</font> </td>

                                                        </tr>

                                                        <tr>

                                                            <td width="11%" class="td_border">&nbsp;视听地址

                                                             </td>

                                                            <td  align="left"><input name="S_Vdata" type="text" id="S_Vdata" value="<?php echo $vdata?>" size="70" />

&nbsp;&nbsp;<input type="button" class="submit" value="本地上传" onclick="SelectUpload1('form1.S_Vdata');" />&nbsp;&nbsp;&nbsp;&nbsp;  

<input type="button" class="submit" value="飞速上传" onClick="SelectUpload('form1.S_Vdata');" />&nbsp;&nbsp;&nbsp;&nbsp;  

<input type="button" class="submit" value="威客上传" onClick="SelectUpload2('form1.S_Vdata');" />

                                                            <font color="#FF0000">＊</font></td>

                                                      </tr>

							  <tr>

							    <td  height="30" class="td_border">&nbsp;下载地址：</td>

							    <td class="td_border"><input name="S_Remark" type="text" id="S_Remark" value="<?php echo $remark?>" size="70" />

							      <label id="S_ClassID"></label><font color="#FF0000">＊</font></td>

						      </tr>



                                                    </table>

        											

                                	</div>                                </td>

							  </tr>



							  <tr>

								<td class="td_border">&nbsp;&nbsp;舞曲介绍：</td>

							    <td class="td_border">

					<?php

                      $editor->Create();

					  ?>

								</td>

							  </tr>

							  

							  <tr>

								

								<td height="40" colspan="2" align="center" class="td_border"> &nbsp;

								  <input type="submit" name="Submit" value="确定提交"class="rb1"  id="addvideo"/>

								  &nbsp;&nbsp; <input type="reset" name="reset" value="清除重置" class="rb1"/></td>

							  </tr>

							</form>  

<script type="text/javascript">

function SelectUpload1(fname){

   if(document.all){

     var posLeft = 100;

     var posTop = 100;

   }

   else{

     var posLeft = 100;

     var posTop = 100;

   }

 window.open('js/uploaddj.php','newwindow','height=100,width=500,top=200,left=200,toolbar=no,menubar=no,scrollbars=no,	 resizable=no,location=no, status=no');

}

function SelectUpload(fname){

   if(document.all){

     var posLeft = window.event.clientY-100;

     var posTop = window.event.clientX-400;

   }

   else{

     var posLeft = 100;

     var posTop = 100;

   }

   window.open("../include/rayfileup/rayfileup.php?type=ht", "popupWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=150,left="+posLeft+", top="+posTop);

}

function SelectUpload2(fname){

   if(document.all){

     var posLeft = 100;

     var posTop = 100;

   }

   else{

     var posLeft = 100;

     var posTop = 100;

   }

 window.open('http://www.vdisk.cn/api/webupload?success=<?php echo S_SiteDomain?>/include/rayfileup/kimi.php?type=ht','newwindow','height=100,width=700,top=200,left=200,toolbar=no,menubar=no,scrollbars=no,	 resizable=no,location=no, status=no');

}

</script>

					  </table>

                      		</div>

	</div>

</div>

<?php			

			}

		

		function main($sql,$size){

			global $db;

			$playadd=playadd(1);

			$Arr=getpagerow($sql,$size);//sql,每页显示条数

			$result=$db->query($Arr[2]);

			$videonum=$db->num_rows($result);

			$action=SafeRequest("action","get");

?>

<div class="r_main">

	<div class="r_content">

		<div class="r_content_1">

          <form name="form1" id="form1" method="post">

            <table class="tb_style" border="0"  cellspacing="0" cellpadding="0" >

                <tr>

                  <td class="td_title">&nbsp;舞曲数据管理：&nbsp;&nbsp;[共有<span id="vdjnum" style="color:red;"><img src="images/loading2.gif"></span>首远程音乐数据]&nbsp;&nbsp;[<a href="admin_downmp3.php?sid=1"><font color="#FF0000">保存到本地</font></a>]&nbsp;&nbsp;&nbsp;&nbsp;[共有<span id="vpicnum" style="color:red;"><img src="images/loading2.gif"></span>张远程图片]&nbsp;&nbsp;[<a href="admin_downpic.php?sid=1"><font color="#FF0000">保存到本地</font></a>]</td>

                </tr>

            </table>

    				 <table class="tb_style" border="0" cellspacing="0" cellpadding="0">

                    <tr>

                      <td height="30" width="70">&nbsp; 关键字:</td>

                      <td align="center" width="150">&nbsp;<input name="keyword" type="text" id="keyword" value=""  onkeydown="event.keyCode==13 && $('#search').click();"/></td>

                      <td align="center" width="70">&nbsp;<input name="搜索" type="button" id="search" value="搜索" class="rb1"  /></td>

                      <td>&nbsp;



                      <select  onchange="MM_jumpMenu('self',this,0)">

                             <option value="admin_video.php">查看分类</option>

             <?php

              	$sqlclass="select * from s_class where S_SystemID=1 ";

				$results=$db->query($sqlclass);

				if($results){

					while ($row3=$db->fetch_array($results)){

					echo "<option value='?action=listbycs&S_ID=".$row3['S_ID']."' >".$row3['S_Name']."</option>";

						}

					}

			  

			  ?>             

                      </select>

                       &nbsp;&nbsp;&nbsp;

                       <select  onchange="MM_jumpMenu('self',this,0)">

                            <option value="admin_video.php">播放来源</option>

                            <?php echo playselect2($playadd,"")?>

       				    </select>                      

                       &nbsp;&nbsp;&nbsp;

                       <select  onchange="MM_jumpMenu('self',this,0)">

                            <option value="admin_video.php">查看专题</option>

              <?php

              	$sqlclass="select * from s_topic where S_SystemID=1 ";

				$results=$db->query($sqlclass);

				if($results){

					while ($row3=$db->fetch_array($results)){

					echo "<option value='?action=listbytopic&S_ID=".$row3['S_ID']."' >".$row3['S_Name']."</option>";

						}

					}

			  

			  ?>	

            </select>

                       &nbsp;                       

&nbsp;	</td>

                      </tr>

                  </table>

          </form>



				<table width="100%" border="0" cellpadding="0" cellspacing="0"  class="tb_style" >

				  <form method="post" name="formb" action="?action=delall" >

				  <tr>

					<td width="7%" height="30" bgcolor="#FFFFFF" class="td_btop3">&nbsp;编号

                    	<?php if($action=="listidup"){?>

                       			 <a href="?action=listiddown"><img src="images/down.gif" border="0" alt="点击按ID升序排列"></a>

                        <?php	}

							else{

						?>

								<a href="?action=listidup"><img src="images/up.gif" border="0" alt="点击按ID升序排列"></a>

						<?php		}?>                    </td>

					<td width="25%"  align="center" bgcolor="#FFFFFF" class="td_btop3">舞曲标题</td>

					<td width="8%" align="center"  bgcolor="#FFFFFF" class="td_btop3">人气 

                    	<?php if($action=="listbyhits"){?>

                        <a href="?action=listbyhitsa"><img src="images/up.gif" border="0" alt="点击按人气排序"></a>

                        <?php }else{?>

                         <a href="?action=listbyhits"><img src="images/down.gif" border="0" alt="点击按人气排序"></a>

                        <?php }?>        			</td>

					<td width="8%" align="center" bgcolor="#FFFFFF" class="td_btop3">会员</td>

					<td width="8%" align="center" bgcolor="#FFFFFF" class="td_btop3">播放来源</td>

					<td width="8%" align="center" bgcolor="#FFFFFF" class="td_btop3">舞曲分类</td>

					<td width="8%" align="center" bgcolor="#FFFFFF" class="td_btop3">专题</td>

					<td width="10%"  align="center" bgcolor="#FFFFFF" class="td_btop3">推荐星级

                    <?php if($action=="listbyreco"){?>

                    	<a href="?action=listbyrecoa"><img src="images/up.gif" border="0" alt="点击按星级排序"></a>

                    <?php }else{?>

                    	<a href="?action=listbyreco"><img src="images/down.gif" border="0" alt="点击按星级排序"></a>

                    <?php }?>                    </td>

					<td width="10%" align="center"  bgcolor="#FFFFFF" class="td_btop3">更新时间

                    <?php if($action=="listbytime"){?>

                    	<a href="?action=listbytimea"><img src="images/up.gif" border="0" alt="点击按星级排序"></a>

                    <?php }else{?>

                    	<a href="?action=listbytime"><img src="images/down.gif" border="0" alt="点击按星级排序"></a>

                    <?php }?>                    </td>

                    <td width="8%" align="center" bgcolor="#FFFFFF" class="td_btop3">操 作</td>

				  </tr>

                       <?php

					   if($videonum==0) echo "

							<tr>

                            	<td colspan=\"9\" class=\"td_border\" height=\"30\" align=center><b>暂无舞曲,请添加</b></td>

                            </tr>";

                       if($result){

						   while ($row = $db ->fetch_array($result)){

					   ?>  

							<tr>

							  <td height="30" class="td_border">&nbsp;<input type="checkbox" name="S_ID[]" value="<?php echo $row['S_ID']?>" class="checkbox" id="S_ID"/><?php echo $row['S_ID']?>、</td>

								<td align="left" class="td_border">

                                <?php if(SafeRequest("action","get")=="listbysc"){

									$row['S_Name']=ReplaceStr($row['S_Name'],SafeRequest("keyword","get"),"<font color=red>".SafeRequest("keyword","get")."</font>");

									}

									?>

								<a href="<?php echo LinkUrl("s_video",$row['S_ClassID'],1,$row['S_ID'])?>" target="_blank"><font color="<?php echo $row['S_Color']?>"><?php echo $row['S_Name']?></font></a>

                                <?php if($action!="listdel" and $action!="listtmp"){?>

								<?php echo SpanShow("s_video",$row['S_ClassID'],1,$row['S_ID'],"mark/admin_spanvideoshow.php?sel=single")?>

                                <?php }?>

                               <span id="remarksel" r_id="<?php echo $row['S_ID']?>" style="cursor:hand;"><img src="images/lz.gif"></span>                                </td>

								<td align="center" class="td_border"><?php echo $row['S_Hits']?></td>

								<td align="center" class="td_border"><a href="<?php echo userlink('index',$row['S_Direct'])?>" target="_blank"><?php echo $row['S_Direct']?></a></td>

								<td align="center" class="td_border"><?php echo playaddshow($playadd,$row['S_Source'])?></td>

                                <td width="123" align="center" class="td_border">

                                <span id="class_<?php echo $row['S_ID']?>">

								<?php

                                	$res=$db->getrow("select S_Name from s_class where S_ID=".$row['S_ClassID']."");

									if($res){

										echo $res['S_Name'];

										}

									else{

										echo "暂无分类";

										}	

								?><img src="images/edit.gif" onclick="chgclass(<?php echo $row['S_ID']?>,<?php echo $row['S_ClassID']?>)" style="cursor:pointer"></span>								</td>

								<td align="center" class="td_border"><div id="ss<?php echo $row['S_ID']?>"><span id="topicsel" s_id="<?php echo $row['S_ID']?>" topicid="<?php echo $row['S_Topic']?>" style="cursor:hand;">&nbsp;

							  <?php

                                	if($row['S_Topic']!=0){

										echo "<img src='images/topicyes.gif'>";

										}

									else{

										echo "<img src='images/topicno.gif'>";

										}	

								?></span></div></td>

							  <td align="center" class="td_border" id="S_Reco<?php echo $row['S_ID']?>"><script language="javascript">ShowStar(<?php echo $row['S_Reco']?>,<?php echo $row['S_ID']?>)</script></td>

								<td align="center" class="td_border">&nbsp;<?php 

								if(date("Y-m-d",strtotime($row['S_AddTime']))==date('Y-m-d')){

									echo "<font color=red>".date("Y-m-d",strtotime($row['S_AddTime']))."</font>";

									}

								else{

									echo date("Y-m-d",strtotime($row['S_AddTime']));

									}	

								?> </td>

                                <td align="center"  class="td_border"><A href="?action=editdata&S_ID=<?php echo $row['S_ID']?>">编辑</a>&nbsp; <a style="cursor:pointer;" onclick="del(<?php echo $row['S_ID']?>,'<?php echo urlencode($_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?".$_SERVER["QUERY_STRING"]) ;?>')" >删除</a></td>

                            </tr>

   <?php

                         							   

		 }

	 }

?> 

				  <tr>

					<td height="30" colspan="10" align="left" class="td_border">&nbsp;<input type="checkbox" name="ChkAll" id="ChkAll" ids="S_ID"  class="checkbox"/>

全选

 &nbsp;&nbsp;

 <input type="radio" name="DelALLSel" id="delallsel1" checked="checked" class="radio" value="1">

 批量删除

 <select class="select" name="deltypes" id="deltypes">

 <?php if($action=="listdel"){?>

 	<option  value="2">审核数据</option>

 <?php }

 else{?>

   	<option  value="3">放入回收站</option>

 <?php }?>   

    <option value="6">直接删除</option>

 </select>

<?php if(S_Webmode==0 and $action<>"listdel"){?>

<input type="radio" name="DelALLSel" id="delallsel6"  value="6" class="radio"/>

批量生成&nbsp;&nbsp;

<?php }?>

<input type="button" name="plxx" onclick="javascript:document.formb.action='admin_video_edit.php';formb.submit();" class="rb1" value='批量修改数据'/>

<input type="button" name="submit1" value="执行操作"  class="rb1" id="btn_editall"/>

<input id="showlist" name="showlist" type="text" value="" style="visibility:hidden"/>

<input id="actiontypes" name="actiontypes" value="<?php echo urlencode($_SERVER['QUERY_STRING']);?>" type="hidden">

&nbsp;</td>

				    </tr>

				  </form>

			  	  <tr>

				    <td height="30" colspan="9" align="right" class="td_border"><?php echo $Arr[0];?></td>

			      </tr>

			  </table>

	  </div>

	</div>

</div>

<script language="javascript">$.get("js/ajaxfun.php?action=getpicnum&sid=1",function(R){$("#vpicnum").html(R);})</script>

<script language="javascript">$.get("js/ajaxfun.php?action=getdjnum",function(R){$("#vdjnum").html(R);})</script>

<?php			

			}

		}



?>        



<?php

$ui=new ui_video;

$action=SafeRequest("action","get");

include_once('../images/edit/sinaEditor.class.php');

$editor=new sinaEditor('gently_editor');

switch($action){

	case 'main':

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video where S_IsHide=0 and S_ClassID<>0 order by S_AddTime desc",30);

		break;

	case 'delall':

		delall();

		break;

	case 'listdel':

		listdel();

		break;

	case 'listbysc':

		search();

		break;

	case 'listtmp':

		listtmp();

		break;

	case 'add':

		add();

		break;

	case 'saveadd':

		saveadd();

		break;

	case 'editdata':

		editdata();

		break;

	case 'saveedit':

		saveedit();

		break;

	case 'del':

		del();

		break;

	case 'listbycs':

		listbycs();

		break;

	case 'listbylz':

		listbylz();

		break;

	case 'listbytopic':

		listbytopic();

		break;

	case 'listidup':

		listidup();

		break;

	case 'listbyhits':

		listbyhits();

		break;

	case 'listbyreco':

		listbyreco();

		break;

	case 'listbyrecoa':

		listbyrecoa();

		break;

	case 'listbytime':

		listbytime();

		break;

	case 'listbytimea':

		listbytimea();

		break;

	case 'check':

		check();

		break;

	case 'orderbyplay':

		orderbyplay();

		break;

	default:

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Direct,S_Remark,S_Reco,S_Topic from s_video  where S_IsHide=0 and S_ClassID<>0 order by S_AddTime desc",30);

		break;

	}

	

	function orderbyplay(){

		global $ui;

		$source=SafeRequest("source","get");

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where S_IsHide=0 and S_ClassID<>0 and S_Source Like '%".$source."%' order by S_ID desc",30);

		}

	

	function listtmp(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where  S_IsHide<>1 and S_ClassID=0 order by S_AddTime desc",30);						

		}

	//时间

	function listbytime(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where  S_IsHide=0 and S_ClassID<>0 order by S_AddTime desc",30);				

		}

	function listbytimea(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where  S_IsHide=0 and S_ClassID<>0 order by S_AddTime asc",30);				

		}	

	

	//星级

	function listbyreco(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where  S_IsHide=0 and S_ClassID<>0 order by S_Reco desc",30);		

		}

	function listbyrecoa(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where S_IsHide=0 and S_ClassID<>0 order by S_Reco asc",30);		

		}	

	//人气

	function listbyhits(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where S_IsHide=0 and S_ClassID<>0 order by S_Hits desc",30);

		}

	function listbyhitsa(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where  S_IsHide=0 and S_ClassID<>0 order by S_Hits asc",30);		

		}	

	//id升序

	function listidup(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where S_IsHide=0 and S_ClassID<>0 order by S_ID asc",30);

		}

	//连载

	function listbylz(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video  where S_IsEnd=1 and S_IsHide=0 and S_ClassID<>0 order by S_ID desc",30);

		}	

	//查询专题

	function listbytopic(){

		global $ui;

		$S_ID=SafeRequest("S_ID","get");

		$ui->main("select * from s_video where S_Topic=".$S_ID." and S_ClassID<>0 and S_IsHide=0 order by S_ID desc",30);

		}

	

	//查询分类

	function listbycs(){

		global $ui;

		$S_ID=SafeRequest("S_ID","get");

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video where S_ClassID=$S_ID order by S_ID desc",30);

		//$ui->main("select * from s_video where S_ClassID in (Select S_ID from S_Class where S_FatherID=$S_ID) or S_ClassID=$S_ID order by S_ID desc",30);

		}

	function check(){

		global $ui;

		$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Direct,S_Reco,S_Topic from s_video where  S_Name in (select S_Name from S_video group by S_Name having count(*)>1) order by S_Name asc",30);		

		//$ui->main("select S_Name,S_ID,S_Source,S_AddTime,S_Hits,S_ClassID,S_Remark,S_Reco,S_Topic from s_video where (S_Name in (select S_Name  from s_video group by S_Name )) order by S_Name asc",30);		

		}

		

	function del(){

		global $db;

		$S_ID=SafeRequest("S_ID","get");

		$LastUrl=SafeRequest("url","get");

		if(substr(strtolower($LastUrl),0,7)!="http://") $LastUrl="http://".$LastUrl; 

		$sql1="delete from s_dt where S_Djid='".$S_ID."'";

		$db->query($sql1);

		$sql2="delete from s_usersc where S_Djid='".$S_ID."'";

		$db->query($sql2);

		$sql3="delete from s_down where S_Djid='".$S_ID."'";

		$db->query($sql3);

		$sql="delete from s_video where S_ID='".$S_ID."'";

		$clsid=$db->Getrow("select S_ClassID from s_video where S_ID=".$S_ID."");

		if($db->query($sql)){

			if(S_Webmode==0){

				$fileurl=LinkUrl("s_video",$clsid['S_ClassID'],1,$S_ID);

				$fileurl="../".substr($fileurl,strlen(S_SitePath));

				if(file_exists($fileurl)){

					unlink($fileurl);

					}	

				}

			echo "<script>window.location='".$LastUrl."'</script>";

			}

		else{

			die("<script>jAlert('舞曲删除失败','操作提示',function(R){window.location='admin_video.php';})</script>");

			}	

		}

	//编辑

	function editdata(){

		global $ui;

		global $db;

		$S_ID=SafeRequest("S_ID","get");

		$sql="Select * from s_video where S_ID=".$S_ID."";

		if($row=$db->Getrow($sql)){

			$Arr=array($row['S_Name'],$row['S_Color'],$row['S_Author'],$row['S_Direct'],$row['S_Pic'],$row['S_Reco'],$row['S_Hits'],$row['S_IsHide'],$row['S_Keywords'],$row['S_Remark'],$row['S_Content'],$row['S_IsEnd'],$row['S_Source'],$row['S_VData'],$row['S_Year'],$row['S_Language'],$row['S_Topic'],$row['S_ClassID'],$row['S_Area'],$row['S_AddPath'],$row['S_PurView'],$row['S_Templay'],$row['S_Dx'],$row['S_Yz'],$row['S_Btime'],$row['S_Rhits'],$row['S_Zhits'],$row['S_Yhits'],$row['S_Favhits'],$row['S_Downhits']);

			}

		$ui->editdata($Arr,"?action=saveedit&S_ID=".$S_ID."");

		}

	//保存编辑

	function saveedit(){

		global $db;

		$S_ID=SafeRequest("S_ID","get");

		$LastUrl=urldecode(SafeRequest("lasturl","post"));

		$S_Name = SafeRequest("S_Name","post");

		$S_Color = SafeRequest("S_Color","post");

		$S_Remark = SafeRequest("S_Remark","post");

		$S_ClassID = SafeRequest("S_ClassID","post");

		$S_Topic = SafeRequest("S_Topic","post");

		$S_Pic = SafeRequest("S_Pic","post");

		$S_Author = SafeRequest("S_Author","post");

		$S_ConTent = SafeRequest("gently_editor","post");

		$S_Reco = SafeRequest("S_Reco","post");

		$S_IsEnd = SafeRequest("S_IsEnd","post");

		$S_Source = SafeRequest("S_Source","post");

		$S_Vdata = SafeRequest("S_Vdata","post");

		$S_Year = SafeRequest("S_Year","post");

		$S_Area = SafeRequest("S_Area","post");

		$S_Language = SafeRequest("S_Language","post");

		$S_Server=SafeRequest("S_Server","post");

		$S_Hits = SafeRequest("S_Hits","post");

		$S_Rhits = SafeRequest("S_Rhits","post");

		$S_Zhits = SafeRequest("S_Zhits","post");

		$S_Yhits = SafeRequest("S_Yhits","post");

		$S_Shits = SafeRequest("S_Shits","post");

		$S_Xhits = SafeRequest("S_Xhits","post");

		$S_AddTime =date('Y-m-d H:i:s');

		$S_Direct = SafeRequest("S_Direct","post");

		$S_Keywords1 = SafeRequest("S_Keywords","post");

		$S_PurView = SafeRequest("S_PurView","post");

		$S_Templay=SafeRequest("S_Templay","post");

		$S_Dx=SafeRequest("S_Dx","post");

		$S_Yz=SafeRequest("S_Yz","post");

		$S_Btime=SafeRequest("S_Btime","post");

		//判断

		if(!$S_IsEnd){$S_IsEnd=0;}

		if(!S_Templay){$S_Templay="play.html";}

		if(!IsNul($S_Year)){$S_Year="未知";}

		if(!IsNum($S_Hits)){$S_Hits=0;}

                if(file_exists("..".$S_Remark."")&&(substr($S_Remark,0,1)=="/")){

                   if($S_Dx==""){$S_Dx=formatsize(filesize("..".$S_Remark));}

                }



		if($S_EditTime=='1'){

			$sql="update s_video set S_Dx='".$S_Dx."',S_Yz='".$S_Yz."',S_Btime='".$S_Btime."',S_Name='".$S_Name."',S_Color='".$S_Color."',S_Remark='".$S_Remark."',S_ClassID=".$S_ClassID.",S_Topic=".$S_Topic.",S_Pic='".$S_Pic."',S_Author='".$S_Author."',S_Content='".$S_ConTent."',S_Reco=".$S_Reco.",S_IsEnd=".$S_IsEnd.",S_Source='".$S_Source."',S_Vdata='".$S_Vdata."',S_Year='".$S_Year."',S_Area='".$S_Area."',S_Language='".$S_Language."',S_Hits=".$S_Hits.",S_Rhits=".$S_Rhits.",S_Zhits=".$S_Zhits.",S_Yhits=".$S_Yhits.",S_Favhits=".$S_Shits.",S_Downhits=".$S_Xhits.",S_Direct='".$S_Direct."',S_Keywords='".$S_Keywords1."',S_AddTime='".$S_AddTime."',S_AddPath='".$S_Server."',S_Templay='".$S_Templay."' where S_ID=".$S_ID."";

		}else{

			$sql="update s_video set S_Dx='".$S_Dx."',S_Yz='".$S_Yz."',S_Btime='".$S_Btime."',S_Name='".$S_Name."',S_Color='".$S_Color."',S_Remark='".$S_Remark."',S_ClassID=".$S_ClassID.",S_Topic=".$S_Topic.",S_Pic='".$S_Pic."',S_Author='".$S_Author."',S_Content='".$S_ConTent."',S_Reco=".$S_Reco.",S_IsEnd=".$S_IsEnd.",S_Source='".$S_Source."',S_Vdata='".$S_Vdata."',S_Year='".$S_Year."',S_Area='".$S_Area."',S_Language='".$S_Language."',S_Hits=".$S_Hits.",S_Rhits=".$S_Rhits.",S_Zhits=".$S_Zhits.",S_Yhits=".$S_Yhits.",S_Favhits=".$S_Shits.",S_Downhits=".$S_Xhits.",S_Direct='".$S_Direct."',S_Keywords='".$S_Keywords1."',S_AddPath='".$S_Server."',S_Templay='".$S_Templay."' where S_ID=".$S_ID."";

			}

		if($db->query($sql)){

			//获取分类ID

			$sqlc="select S_ClassID from s_video where S_ID=$S_ID Order by S_ID desc";

			$crow=$db->getrow($sqlc);

			$Url="mark/admin_spanvideoshow.php?sel=single";					

			echo "<script>spango(".$S_ID.",\"".$Url."&cid=".$crow['S_ClassID']."\");</script>";

			die("<script>window.location='".$LastUrl."'</script>");

			}

		else{

			die("<script>jAlert('舞曲编辑失败','操作提示',function(R){history.back();})</script>");

			}

	}

	

	// 添加舞曲

	function add(){

		global $ui;

		$Arr=array("","","","","","","","","","","","","","","","","","","","","","play.html","","","","","","","","");

		$ui->editdata($Arr,"?action=saveadd");

		}

	//执行保存

	function saveadd(){

		global $db;

		$S_Name = SafeRequest("S_Name","post");

		$S_Color = SafeRequest("S_Color","post");

		$S_Remark = SafeRequest("S_Remark","post");

		$S_ClassID = SafeRequest("S_ClassID","post");

		$S_Topic = SafeRequest("S_Topic","post");

		$S_Pic = SafeRequest("S_Pic","post");

		$S_Author = SafeRequest("S_Author","post");

		$S_ConTent = SafeRequest("gently_editor","post");

		$S_Reco = SafeRequest("S_Reco","post");

		$S_IsEnd = SafeRequest("S_IsEnd","post");

		$S_Source = SafeRequest("S_Source","post");

		$S_Vdata = SafeRequest("S_Vdata","post");

		$S_Year = SafeRequest("S_Year","post");

		$S_Area = SafeRequest("S_Area","post");

		$S_Language = SafeRequest("S_Language","post");

		$S_Server=SafeRequest("S_Server","post");

		$S_Hits = SafeRequest("S_Hits","post");

		$S_Rhits = SafeRequest("S_Rhits","post");

		$S_Zhits = SafeRequest("S_Zhits","post");

		$S_Yhits = SafeRequest("S_Yhits","post");

		$S_Shits = SafeRequest("S_Shits","post");

		$S_Xhits = SafeRequest("S_Xhits","post");

		$S_AddTime =date('Y-m-d H:i:s');

		$S_Direct = SafeRequest("S_Direct","post");

		$S_Keywords1 = SafeRequest("S_Keywords","post");

		$S_PurView = SafeRequest("S_PurView","post");

		$S_Templay=SafeRequest("S_Templay","post");

		$S_Dx=SafeRequest("S_Dx","post");

		$S_Yz=SafeRequest("S_Yz","post");

		$S_Btime=SafeRequest("S_Btime","post");

		//判断 

		if(!$S_IsEnd){$S_IsEnd=0;}

		if(!S_Templay){$S_Templay="play.html";}

		if(!IsNul($S_Year)){$S_Year="未知";}

		if(!IsNum($S_Hits)){$S_Hits=0;}

                if(file_exists("..".$S_Remark."")&&(substr($S_Remark,0,1)=="/")){

                   if($S_Dx==""){$S_Dx=formatsize(filesize("..".$S_Remark));}

                }

		

		$sql="Insert s_video (S_Dx,S_Yz,S_Btime,S_Name,S_Color,S_Remark,S_ClassID,S_Topic,S_Pic,S_Author,S_Content,S_Reco,S_IsEnd,S_Source,S_Vdata,S_Year,S_Area,S_Language,S_Hits,S_Rhits,S_Zhits,S_Yhits,S_Favhits,S_Downhits,S_Direct,S_Keywords,S_AddTime,S_AddPath,S_Templay) values ('".$S_Dx."','".$S_Yz."','".$S_Btime."','".$S_Name."','".$S_Color."','".$S_Remark."',".$S_ClassID.",".$S_Topic.",'".$S_Pic."','".$S_Author."','".$S_ConTent."',".$S_Reco.",".$S_IsEnd.",'".$S_Source."','".$S_Vdata."','".$S_Year."','".$S_Area."','".$S_Language."',".$S_Hits.",".$S_Rhits.",".$S_Zhits.",".$S_Yhits.",".$S_Shits.",".$S_Xhits.",'".$S_Direct."','".$S_Keywords1."','".$S_AddTime."','".$S_Server."','".$S_Templay."')";

		if($db->query($sql)){

			die("<script>window.location='admin_video.php'</script>");

			}

		else{

			die("<script>jAlert('舞曲添加失败','操作提示',function(R){history.back();})</script>");

			}	

		}

	

	//搜索

	function search(){

		global $ui;	

		$key=SafeRequest("keyword","get");

		$key=convert_encoding($key, 'GBK','UTF-8');

		$sql="select * from s_video where  S_Name like '%".$key."%' or S_Author like '%".$key."%'";

		$ui->main($sql,20);

		}

		

	//回收站

	function listdel(){

		global $ui;

		$ui->main("select * from s_video  where S_IsHide=1 ",30);

		}

	

	function delall(){

		global $db;

		$types=urldecode(SafeRequest("actiontypes","post"));

		$showlist=SafeRequest("showlist","post");

		$S_ID=RequestBox("S_ID");

		$S_ID1=RequestBox("S_ID");

		$DelALLSel=SafeRequest("DelALLSel","post");

		if($S_ID=="0"){

			echo "<script>jAlert('请选择要操作的数据?','操作提示',function(R){history.back();})</script>";

			die();

			}

		$Arr=explode(',',$S_ID);

		switch($DelALLSel){

			case '1':

				$DelType=SafeRequest("deltypes","post");

				if($DelType==2){

					for($i=0;$i<count($Arr);$i++){

						$sql="update s_video set S_IsHide=0 where S_ID=".$Arr[$i]."";

						$db->query($sql);

						     if(S_DjaddFun==1){

                                                        //获取会员用户名和舞曲名

						        $sqlc="select S_Direct,S_Name from s_video where S_ID=$Arr[$i] Order by S_ID desc";

						        $crow=$db->getrow($sqlc);

						        $sql2="select s_id from s_users where S_Name='".$crow[S_Direct]."'";

						        $s_id= $db->Getone($sql2);

						        if($s_id){

						        $db->query("update s_users set S_Coin=S_Coin+".S_DjaddPoints." where s_id='".$s_id."'");

								//发消息通知

								$s_xid=0;

								$s_nameb="系统消息";

								$s_namea=$crow[S_Direct];

								$s_content="恭喜您，您上传的《".$crow[S_Name]."》歌曲已经通过审核了，系统给你自动增加了（".S_DjaddPoints."）点！";

								$s_addtime=date('Y-m-d H:i:s');

								$sql="insert into s_xiaoxi (S_Xid,S_Nameb,S_Namea,S_Content,S_Addtime) values (".$s_xid.",'".$s_nameb."','".$s_namea."','".$s_content."','".$s_addtime."')";

								if($db->query($sql));

						        }

						     }

						}

					die("<script>jAlert('数据审核成功了！','操作提示',function(R){window.location='?".$types."';})</script>");

					}

				elseif($DelType==3){

					for($i=0;$i<count($Arr);$i++){

						$sql="update s_video set S_IsHide=1 where S_ID=".$Arr[$i]."";

						$db->query($sql);

						}

					die("<script>jAlert('数据已放入回收站！','操作提示',function(R){window.location='?".$types."';})</script>");						 					}

				elseif($DelType==6){

					for($i=0;$i<count($Arr);$i++){

						$sql="delete from s_video where S_ID=".$Arr[$i]."";

						$db->query($sql);

						$sql1="delete from s_dt where S_Djid='".$Arr[$i]."'";

						$db->query($sql1);

						$sql2="delete from s_usersc where S_Djid='".$Arr[$i]."'";

						$db->query($sql2);

						$sql3="delete from s_down where S_Djid='".$Arr[$i]."'";

						$db->query($sql3);

						if(S_Webmode==0){

		                                        $clsid=$db->Getrow("select S_ClassID from s_video where S_ID=".$Arr[$i]."");

							$fileurl=LinkUrl("s_video",$clsid['S_ClassID'],1,$Arr[$i]);

							$fileurl="../".substr($fileurl,strlen(S_SitePath));

							if(file_exists($fileurl)){

								unlink($fileurl);

							}	

						}

					}

					die("<script>jAlert('数据删除成功!','操作提示',function(R){window.location='?".$types."';})</script>");						 					}	

				break;

			case '6':

				$S_ID=RequestBox("S_ID");

				for($i=0;$i<count($Arr);$i++){

					//获取分类ID

					$sqlc="select S_ClassID from s_video where S_ID=$Arr[$i] Order by S_ID desc";

					$crow=$db->getrow($sqlc);

					$Url="mark/admin_spanvideoshow.php?sel=single";					

					echo "<script>spango(".$Arr[$i].",\"".$Url."&cid=".$crow['S_ClassID']."\");</script>";

					}

				die("<script>jAlert('数据批量生成成功!！','操作提示',function(R){window.location='?".$types."';})</script>");	

				break;

			}

		}

function getAddPath($path){

	global $db;

	$serverstr="";

	$sqlserver="select S_ID,S_Name from `s_pathip`";

	$resultserver=$db->query($sqlserver);

	  if($resultserver){

		  while($rowserver=$db->fetch_array($resultserver)){

			  if($path==$rowserver['S_ID']){

			  $serverstr.="<option value='".$rowserver['S_ID']."' selected='selected'>".$rowserver['S_Name']."</option>";

			  }

			  else{

			  $serverstr.="<option value='".$rowserver['S_ID']."'>".$rowserver['S_Name']."</option>";	

				  }	

			  }

		  }

	return $serverstr;	  

	}	

	

	function isselect($S_PurView,$values){

		if(($S_PurView=="0")||($S_PurView=="")){

			

		}

		else{

			$S_PurViewarr=explode(",",$S_PurView);

			for($i=0;$i<count($S_PurViewarr);$i++){

				if($S_PurViewarr[$i]==$values){

					echo("checked");

				}

			}

		}

	}

function formatsize($size) {

	$prec=3;

	$size = round(abs($size));

	$units = array(0=>" B ", 1=>" KB", 2=>" MB", 3=>" GB", 4=>" TB");

	if ($size==0) return str_repeat(" ", $prec)."0$units[0]";

	$unit = min(4, floor(log($size)/log(2)/10));

	$size = $size * pow(2, -10*$unit);

	$digi = $prec - 1 - floor(log($size)/log(10));

	$size = round($size * pow(10, $digi)) * pow(10, -$digi);

	return $size.$units[$unit];

}

?>

<?php include "admin_bottom.php"; ?>

</body>

</html>