<?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);

$playadd=playadd(1);

?>

<html>

<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" src="js/jquery.js"></script>

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

</head>

<body>

<script language="javascript">

$ = function(em){	return document.getElementById(em);	};

$F = function(em){	return document.getElementById(em).value;	};

function setid() 

{ 

var s_format = $('format').value;

var s_formatb = $('formatb').value;

var s_url = $('S_DjUrl').value;

str='<br>'; 

if(!window.form1.upcount.value) 

window.form1.upcount.value=1; 

	  if(window.form1.upcount.value>50){

	  	alert("您一次最多添加50首歌曲nn如果歌曲太多,请分次进行.");

	  	window.form1.upcount.value = 50;

	  	setid();

	  }

	  if(window.form1.upcount.value<1){

	  	alert("您最少要添加1首歌曲");

	  	window.form1.upcount.value = 1;

	  	setid();

	  }

else{

for(i=1;i<=window.form1.upcount.value;i++) 

str+='<input type="hidden" name="S_ID[]" value="'+i+'">&nbsp;&nbsp;名称'+i+'：<input name="S_Name'+i+'" size=50><br>&nbsp;&nbsp;试听'+i+'：<input type="text" name="S_Url'+i+'" value="'+s_url+i+'.'+s_format+'" size="50"><br>&nbsp;&nbsp;下载'+i+'：<input type="text" name="S_Down'+i+'" value="'+s_url+i+'.'+s_formatb+'" size="50"><br><br>'; 

}

window.upid.innerHTML=str; 

}

function CheckForm(){

        if (document.form1.S_ClassID.value=="0"){

            alert("请先选择所属栏目！");

            document.form1.S_ClassID.focus();

            return false;

        }

        if (document.form1.S_User.value==""){

            alert("添加会员不能为空！");

            document.form1.S_User.focus();

            return false;

        }

        if (document.form1.S_Skin.value==""){

            alert("播放页面风格模板不能为空！");

            document.form1.S_Skin.focus();

            return false;

        }

}

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> 

<?php

SystemPer(2);

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

if($action=="addlistsave"){

global $db;

$S_ID = RequestBox('S_ID');

$upcount = SafeRequest('upcount','post');

$S_Addpath = SafeRequest('S_Server','post');

$S_Reco = SafeRequest('S_IsBest','post');

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

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

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

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

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

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

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

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

$S_Name=SafeRequest('S_Name'.$ID[$i].'','post');

$S_Url=SafeRequest('S_Url'.$ID[$i].'','post');

$S_DownUrl=SafeRequest('S_Down'.$ID[$i].'','post');

$sql="Insert s_video (S_Name,S_Remark,S_ClassID,S_Topic,S_Pic,S_Author,S_Content,S_Reco,S_IsEnd,S_Source,S_Vdata,S_Direct,S_Keywords,S_AddTime,S_AddPath,S_PurView,S_Templay,S_IsEnd) values ('".$S_Name."','".$S_DownUrl."',".$S_ClassID.",0,'0','本站原创','',".$S_Reco.",0,'".$S_Source."','".$S_Url."','".$S_Direct."','".$S_Name."','".$S_AddTime."','".$S_Addpath."','".$S_PurView."','".$S_Templay."',".S_IsEnd.")";

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

}

exit('<script language=javascript>alert("恭喜您，共添加 '.$upcount.' 首舞曲！");window.location.href="admin_video.php";</script>');

}

?>

<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 name="form1" method="post" action="?action=addlistsave">

					<tr>

                                                <td height="30" colspan="3" class="td_title">&nbsp;&nbsp;&nbsp;&nbsp;批 量 添 加 歌 曲</td>

					</tr>

					<tr> 

                                                <td height="30" class="td_border">&nbsp;&nbsp;&nbsp;所属栏目：<select name="S_ClassID">

                                                <option value="0" style="color:#FF0000;">&nbsp;选择栏目</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='".$row3['S_ID']."' >".$row3['S_Name']."</option>";	

						

						}

					}

			  ?>

                                              </select> &nbsp; &nbsp;需要添加几首                                               

                                                <input type="text" name="upcount" value="1" size="3" onFocus="this.style.borderColor='#F93'" onBlur="this.style.borderColor='#CCC'">

                                                <input type="button" name="button" class="rb1" onClick="setid();" value="设定"> </td>

					</tr>

					<tr> 

                                                <td height="30" class="td_border">&nbsp;&nbsp;添加会员：<input name="S_Direct" type="text" id="S_Direct" value="admin" 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>&nbsp;&nbsp;<FONT COLOR="red">必须是站内注册用户！必须存在！不能乱写！</FONT></td>

					</tr>

					<tr> 

                                                <td height="30" class="td_border">&nbsp;&nbsp;播放页面风格模板：<input id="S_Templay" name="S_Templay" size="20" value="play.html"> &nbsp;<input type="button" value="浏览..." style="width:60px"  onClick="SelectTemplets('form1.S_Templay');" class="rb1" />                               

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

					</tr> 

					<tr> 

                                                <td height="30" class="td_border">&nbsp;&nbsp;服 务 器：

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

                                                <option value="0" style="color:#FF0000;">不设置</option>

              <?php

              	$sqlfwq="select * from s_pathip  ";

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

				if($results){

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



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

	

						

						}

					}

			  ?>

                                                </select>

                                               播放来源：

                                               <select name="S_playform" id="S_playform">

                                              

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

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

                                                推荐等级：

                                                <select name="S_IsBest">

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

                                                </td>

					</tr>

					<tr> 

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

<input id="S_IsEnd" name="S_IsEnd" size="10" value="1"></td>

</td>

					</tr>

					<tr> 

                                                <td height="30" class="td_border">&nbsp;&nbsp;试听文件格式：<input type="text" name="format" value="wma" size="10" onFocus="this.style.borderColor='#F93'" onBlur="this.style.borderColor='#CCC'">&nbsp;下载文件格式：<input type="text" name="formatb" value="mp3" size="10" onFocus="this.style.borderColor='#F93'" onBlur="this.style.borderColor='#CCC'"></td>

					</tr>

					<tr> 

                                                <td height="30" class="td_border">&nbsp;&nbsp;公用绝对或相对路径：<input type="text" name="S_DjUrl" value="" size="50" onFocus="this.style.borderColor='#F93'" onBlur="this.style.borderColor='#CCC'">&nbsp;(公用路径/歌曲文件名)</br><font color=red>*此为对下列添歌批量写入数据库的路径。</font></td>

					</tr>

					<tr align="center" valign="middle"> 

                                                <td align="left" height="25" id="upid" class="td_border"></td> 

					</tr>

					<tr align="center" valign="middle"> 

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

                                                <input type="submit" name="Submit" value=" 提交 " class="rb1" onClick="return CheckForm();">&nbsp;<input type="reset" name="Submit2" value=" 重执 " class="rb1">

                                                <input type="hidden" name="MM_insert" value="true"></td> 

					</tr> 

				</form>

					  </table>

<script language="javascript"> setid();</script>

                      		</div>

	</div>

</div>

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

</body>

</html>

