<?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 "fun.php";

@set_time_limit(0);

$S_ID=CollectGet("S_ID","auto");

$sql="select * from s_custom where S_ID=$S_ID";

$row=$db->getrow($sql);

if($row){

  $S_Name=$row['S_Name'];

  $S_Url=$row['S_Url'];

  $S_Code=$row['S_Code'];

  $S_Source=$row['S_Source'];

  $S_Page=$row['S_Page'];

  $S_UrlStr=$row['S_UrlStr'];

  $S_PageGo=$row['S_PageGo'];

  $S_PageEnd=$row['S_PageEnd'];

  $S_Order=$row['S_Order'];

  $S_AutoSave=$row['S_AutoSave'];

  $S_SavePic=$row['S_SavePic'];

  $S_Safe=$row['S_Safe'];

  $S_ListGo=$row['S_ListGo'];

  $S_ListEnd=$row['S_ListEnd'];

  $S_LinkGo=$row['S_LinkGo'];

  $S_LinkEnd=$row['S_LinkEnd'];

  $S_VideoNameGo=$row['S_VideoNameGo'];

  $S_VideoNameEnd=$row['S_VideoNameEnd']; 

  $S_RemarkGo=$row['S_RemarkGo'];

  $S_RemarkEnd=$row['S_RemarkEnd'];

  $S_DirectGo=$row['S_DirectGo'];

  $S_DirectEnd=$row['S_DirectEnd'];

  $S_YearGo=$row['S_YearGo'];

  $S_YearEnd=$row['S_YearEnd'];

  $S_AuthorGo=$row['S_AuthorGo'];

  $S_AuthorEnd=$row['S_AuthorEnd'];

  $S_AreaMode=$row['S_AreaMode'];

  $S_AreaName=$row['S_AreaName'];

  $S_AreaGo=$row['S_AreaGo'];

  $S_AreaEnd=$row['S_AreaEnd'];

  $S_PicMode=$row['S_PicMode'];

  $S_PicGo=$row['S_PicGo'];

  $S_PicEnd=$row['S_PicEnd'];

  $S_LanguageMode=$row['S_LanguageMode'];

  $S_LanguageName=$row['S_LanguageName'];

  $S_LanguageGo=$row['S_LanguageGo'];

  $S_LanguageEnd=$row['S_LanguageEnd'];

  $S_ClassMode=$row['S_ClassMode'];

  $S_ClassID=$row['S_ClassID'];

  $S_ClassGo=$row['S_ClassGo'];

  $S_ClassEnd=$row['S_ClassEnd'];

  $S_ContentGo=$row['S_ContentGo'];

  $S_ContentEnd=$row['S_ContentEnd'];

  $S_PlayUrlGo=$row['S_PlayUrlGo'];

  $S_PlayUrlEnd=$row['S_PlayUrlEnd'];

  $S_AddGo=$row['S_AddGo'];

  $S_AddEnd=$row['S_AddEnd'];

  $S_AddMode=$row['S_AddMode'];

  $S_AddOldStr=$row['S_AddOldStr'];

  $S_AddNewStr=$row['S_AddNewStr'];

  $S_AddTime=$row['S_AddTime'];

  $S_Replace=$row['S_Replace'];

  $S_PlayUrlMode=$row['S_PlayUrlMode'];

  $S_AddPath=$row['S_AddPath'];

	}



?>

<!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" />

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

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

<title>自定义采集</title>

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

<script src="../../js/jquery.js"></script>

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

</head>



<body>

<div class="r_main">

	<div class="r_content">

		<div class="r_content_1">       

<?php

SystemPer(5);

	if($S_Page=='1'){//指定分类页面

		$Url=$S_UrlStr;

		$Content=geturlcontent($Url,$S_Code);//读取列表文件

		if(!IsNul($Content)) die("在获取<font color=red>$Url</font>时出错,原因获取不到内容!");

		$returnStr = getContent($Content,$S_ListGo,$S_ListEnd,1);//截取列表开始--结束

		$returnStr=formaturl($returnStr,$Url);

        $vLinkArr=getArr($S_LinkGo,$S_LinkEnd,$returnStr);//获取到舞曲连接地址 返回数组

		if(empty($vLinkArr)) die("获取舞曲连接地址时出错,请确认");

		$LinkCount=count($vLinkArr);//连接总数

	if($S_PicMode==0){

                $vpicArr=getArr($S_PicGo,$S_PicEnd,$returnStr);//获取到图片地址 返回数组

		if(empty($vpicArr)) die("获取图片地址时出错,请确认");

        }

		$NowVideoCount=CollectGet("nvc","auto");

		if(!IsNul($NowVideoCount)){

			$NowVideoCount=0;

			}

		else{

			if($NowVideoCount>$LinkCount){

				$LinkCount=$LinkCount-1;

				}

			}

        echo " <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"  class=\"tb_style\" >

        	<tr>

               <td height=\"30\" align=\"left\" class=\"td_title\">

           		&nbsp;&nbsp;正在采集指定分类列表,共<font color=red>".$S_PageEnd."</font>页,当前页共<font color=red>".$LinkCount."</font>条数据,已经采集<font color=red>".($NowVideoCount+1)."</font>条</td>

            </tr>

      </table> ";

		$VideoContent=geturlcontent($vLinkArr[$NowVideoCount],$S_Code);//舞曲内容页面

		if(!IsNul($VideoContent)) die("在获取<font color=red>$vLinkArr[$NowVideoCount]</font>舞曲内容页出错,获取不到数据，暂停3秒继续采集下一舞曲!<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&nvc=".($NowVideoCount+1)."'}</script>");

		$VideoContent=formaturl($VideoContent,$vLinkArr[$NowVideoCount]);

		$V_Name=getContent($VideoContent,$S_VideoNameGo,$S_VideoNameEnd,1);//舞曲名		

		$V_Remark=$S_RemarkGo;

		if($S_ClassMode=='0'){//分类

			$V_ClassID=$S_ClassID;

			}

		else{

			$V_ClassName=getContent($VideoContent,$S_ClassGo,$S_ClassEnd,1);

			$sql="select S_ID from s_class where S_Name like '%$V_ClassName%' Order by S_ID desc";

			$row=$db->getRow($sql);

			if($row['S_ID']){

				$V_ClassID=$row['S_ID'];

				}

			else{

				$V_ClassID=0;

				}	

			}

		$V_Direct=removeFilter(getContent($VideoContent,$S_DirectGo,$S_DirectEnd,1),$S_Safe);

		if($S_AreaMode=='1'){

			$V_Area=getContent($VideoContent,$S_AreaGo,$S_AreaEnd,1);

			}

		else{

			$V_Area=$S_AreaName;

			}

		$V_Author=removeFilter(getContent($VideoContent,$S_AuthorGo,$S_AuthorEnd,1),$S_Safe);

		if($S_LanguageMode=='1'){

			$V_Language=getContent($VideoContent,$S_LanguageGo,$S_LanguageEnd,1);

			}

		else{

			$V_Language=$S_LanguageName;

			}

		$V_Year=getContent($VideoContent,$S_YearGo,$S_YearEnd,1);

		$V_Pic=$vpicArr[$NowVideoCount];

	if($S_PicMode==1){

		$V_Pic=getContent($VideoContent,$S_PicGo,$S_PicEnd,1);

		$V_Pic=dealPic($V_Pic,$S_Url);

        }

		$V_Content=getContent($VideoContent,$S_ContentGo,$S_ContentEnd,1);

		$V_Content=collectRep($V_Content,$S_Replace);

		if($S_PlayUrlMode=='1'){

			$V_PlayUrlArr=getArr($S_PlayUrlGo,$S_PlayUrlEnd,$VideoContent);

			for($u=0;$u<count($V_PlayUrlArr);$u++){				

				$tempcontent=geturlcontent($S_Url.$V_PlayUrlArr[$u],$S_Code);

				}

			$V_Vdata=implode('#',$playArr);

			$V_Vdata=getContent($tempcontent,$S_AddGo,$S_AddEnd,1);//舞曲地址

			$V_Vdata=collectRep($V_Vdata,$S_Replace);

			unset($playArr);

			}

	   else{

		   $V_PlayListContent=getContent($VideoContent,$S_PlayUrlGo,$S_PlayUrlEnd,1);

		   $playArr=getArr($S_AddGo,$S_AddEnd,$V_PlayListContent);

		   $V_Vdata=implode('#',$playArr);	

		   $V_Vdata=getContent($VideoContent,$S_AddGo,$S_AddEnd,1);//舞曲地址

		   $V_Vdata=collectRep($V_Vdata,$S_Replace); 

		   }	

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



		$NowVideoCount=$NowVideoCount+1;

		showcollectinfo($V_Name,$V_Remark,$V_Direct,$V_Author,$V_Year,$V_Pic,$V_ClassID,$V_Area,$V_Language,$V_Content,$V_Vdata);

		$sql="Insert s_zhuangbi (S_Name,S_Remark,S_ClassID,S_Pic,S_Author,S_Content,S_Source,S_Vdata,S_Year,S_Area,S_Language,S_Direct,S_AddTime,S_Url,S_AddPath) values ('".$V_Name."','".$V_Remark."',".$V_ClassID.",'".$V_Pic."','".$V_Author."','".$V_Content."','".$S_Source."','".$V_Vdata."','".$V_Year."','".$V_Area."','".$V_Language."','".$V_Direct."','".$V_AddTime."','".$S_Url."','".$S_AddPath."')";

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

			echo "<div style=\"height:45px;line-height:45px;\">&nbsp;&nbsp;<font color=green>舞曲保存成功</font>";

			}

		else{

			echo "<div style=\"height:45px;line-height:45px;\">&nbsp;&nbsp;<font color=red>舞曲保存失败</font>";

			}	

		if($NowVideoCount>=$LinkCount){

			if($S_AutoSave=='1'){

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....恭喜全部采集完毕！！&nbsp;暂停3秒后开始自动入库舞曲!</div><script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='admin_inflow.php?action=save&sel=4&url=".$S_Url."&ispic=".$S_SavePic."'}</script>");

				}

			else{	

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....恭喜全部采集完毕！！</div>");

				}

			}			

		else{

			die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....</div><script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&nvc=".($NowVideoCount)."'}</script>");

			

			}			

		}

	elseif($S_Page=='2'){//自动分页类

		$StartPage=$S_PageGo;

		$Spage=CollectGet("spage","auto");

		

		if($S_Order=="desc"){

			if(!IsNul($Spage)){

				$Spage=$S_PageEnd;}

			else{

				if($Spage>=$S_PageEnd) $Spage=$S_PageEnd;

				}	

			}

		else{	

			if(!IsNul($Spage)){

				$Spage=$S_PageGo;

			}else{

				if($Spage>$S_PageEnd) $Spage=$S_PageEnd;

				}

		}

		$Url=ReplaceStr($S_UrlStr,'{$ID}',$Spage);

		$Content=geturlcontent($Url,$S_Code);//读取列表文件

		if(!IsNul($Content)) {

			if($S_Order=="desc"){

				die("在获取<font color=red>$Url</font>时出错,原因获取不到内容!<br/>暂停三秒采集下一列表<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".($Spage-1)."'}</script>");

				}

			else{

				die("在获取<font color=red>$Url</font>时出错,原因获取不到内容!<br/>暂停三秒采集下一列表<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".($Spage+1)."'}</script>");

				}	

			}

		$returnStr = getContent($Content,$S_ListGo,$S_ListEnd,1);//截取列表开始--结束

		$returnStr=formaturl($returnStr,$Url);

                $vLinkArr=getArr($S_LinkGo,$S_LinkEnd,$returnStr);//获取到舞曲连接地址 返回数组

		if(empty($vLinkArr)) die("获取舞曲连接地址时出错,请确认");

		$LinkCount=count($vLinkArr);//连接总数

	if($S_PicMode==0){

                $vpicArr=getArr($S_PicGo,$S_PicEnd,$returnStr);//获取到图片地址 返回数组

		if(empty($vpicArr)) die("获取图片地址时出错,请确认");

        }

		$NowVideoCount=CollectGet("nvc","auto");

		if(!IsNul($NowVideoCount)){

			$NowVideoCount=0;

			}

		else{

			if($NowVideoCount>$LinkCount){

				$LinkCount=$LinkCount-1;

				}

			}

        echo " <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"  class=\"tb_style\" >

        	<tr>

               <td height=\"30\" align=\"left\" class=\"td_title\">

           		&nbsp;&nbsp;正在采集第<font color=red>".$Spage."</font>页列表,共<font color=red>".($S_PageEnd-$S_PageGo)."</font>页,当前页共<font color=red>".$LinkCount."</font>条数据,已经采集<font color=red>".($NowVideoCount)."</font>条</td>

            </tr>

      </table> ";	



		$VideoContent=geturlcontent($vLinkArr[$NowVideoCount],$S_Code);//舞曲内容页面

//die("".$vLinkArr[1]."");

		$VideoContent=formaturl($VideoContent,$vLinkArr[$NowVideoCount]);

		if(!IsNul($VideoContent)) die("在获取<font color=red>$vLinkArr[$NowVideoCount]</font>舞曲内容页出错,获取不到数据，暂停3秒继续采集下一舞曲!<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".$Spage."&nvc=".($NowVideoCount+1)."'}</script>");

		$V_Name=getContent($VideoContent,$S_VideoNameGo,$S_VideoNameEnd,1);//舞曲名

		$V_Remark=$S_RemarkGo;

		if($S_ClassMode=='0'){//分类

			$V_ClassID=$S_ClassID;

			}

		else{

			$V_ClassName=getContent($VideoContent,$S_ClassGo,$S_ClassEnd,1);

			$sql="select S_ID from s_class where S_Name like '%$V_ClassName%' Order by S_ID desc";

			$row=$db->getRow($sql);

			if($row['S_ID']){

				$V_ClassID=$row['S_ID'];

				}

			else{

				$V_ClassID=0;

				}	

			}

		$V_Direct=removeFilter(getContent($VideoContent,$S_DirectGo,$S_DirectEnd,1),$S_Safe);

		if($S_AreaMode=='1'){

			$V_Area=getContent($VideoContent,$S_AreaGo,$S_AreaEnd,1);

			}

		else{

			$V_Area=$S_AreaName;

			}	

		$V_Author=removeFilter(getContent($VideoContent,$S_AuthorGo,$S_AuthorEnd,1),$S_Safe);

		if($S_LanguageMode=='1'){

			$V_Language=getContent($VideoContent,$S_LanguageGo,$S_LanguageEnd,1);

			}

		else{

			$V_Language=$S_LanguageName;

			}

		$V_Year=getContent($VideoContent,$S_YearGo,$S_YearEnd,1);

		$V_Pic=$vpicArr[$NowVideoCount];

	if($S_PicMode==1){

		$V_Pic=getContent($VideoContent,$S_PicGo,$S_PicEnd,1);

		$V_Pic=dealPic($V_Pic,$S_Url);

        }

		$V_Content=getContent($VideoContent,$S_ContentGo,$S_ContentEnd,1);

		$V_Content=collectRep($V_Content,$S_Replace);

		if($S_PlayUrlMode=='1'){

			$V_PlayUrlArr=getArr($S_PlayUrlGo,$S_PlayUrlEnd,$VideoContent);

			for($u=0;$u<count($V_PlayUrlArr);$u++){				

				$tempcontent=geturlcontent($S_Url.$V_PlayUrlArr[$u],$S_Code);

				}

			$V_Vdata=implode('#',$playArr);

			$V_Vdata=getContent($tempcontent,$S_AddGo,$S_AddEnd,1);//舞曲地址

			$V_Vdata=collectRep($V_Vdata,$S_Replace);

			unset($playArr);

			}

	   else{

		   $V_PlayListContent=getContent($VideoContent,$S_PlayUrlGo,$S_PlayUrlEnd,1);

		   $playArr=getArr($S_AddGo,$S_AddEnd,$V_PlayListContent);

		   $V_Vdata=implode('#',$playArr);

		   $V_Vdata=getContent($VideoContent,$S_AddGo,$S_AddEnd,1);//舞曲地址

		   $V_Vdata=collectRep($V_Vdata,$S_Replace);		   

		   }

	   if($NowVideoCount>=($LinkCount-1)){

		   if($S_Order=="desc"){

			   $Spage=$Spage-1;

			   }

			else{

				$Spage=$Spage+1;

				}   	   

		   $NowVideoCount=0;

	   	}

		else{			

			$NowVideoCount=$NowVideoCount+1;

			}

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



		    if($S_Url=="http://www.92cc.com/"){

		           $V_Vdata="".$V_Vdata.".mp4";

		    }



		showcollectinfo($V_Name,$V_Remark,$V_Direct,$V_Author,$V_Year,$V_Pic,$V_ClassID,$V_Area,$V_Language,$V_Content,$V_Vdata);

		$sql="Insert s_zhuangbi (S_Name,S_Remark,S_ClassID,S_Pic,S_Author,S_Content,S_Source,S_Vdata,S_Year,S_Area,S_Language,S_Direct,S_AddTime,S_Url,S_AddPath) values ('".$V_Name."','".$V_Remark."',".$V_ClassID.",'".$V_Pic."','".$V_Author."','".$V_Content."','".$S_Source."','".$V_Vdata."','".$V_Year."','".$V_Area."','".$V_Language."','".$V_Direct."','".$V_AddTime."','".$S_Url."','".$S_AddPath."')";

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

			echo "<div style=\"height:45px;line-height:45px;\">&nbsp;&nbsp;<font color=green>舞曲保存成功</font>";

			}

		else{

			echo "<div style=\"height:45px;line-height:45px;\">&nbsp;&nbsp;<font color=red>舞曲保存失败</font>";

			}

		if($S_Order=="desc" ){

			if($Spage<$S_PageGo){

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....恭喜全部采集完毕！！</div>");}

			else{

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....</div><script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".$Spage."&nvc=".($NowVideoCount)."'}</script>");

				}

			}

		else{

			if($Spage>$S_PageEnd){

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....恭喜全部采集完毕！！</div>");

				}

			else{		

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....</div><script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".$Spage."&nvc=".($NowVideoCount)."'}</script>");

				}		

			}	



		}

	elseif($S_Page=='3'){//批量分类页面

		$Url=$S_UrlStr;

		$UrlArr=explode('#',$Url);

		$UrlCount=count($UrlArr);

		

		$Spage=CollectGet("spage","auto");

		if(!IsNul($Spage)){

			$Spage=0;

			}

		else{

			if($Spage>($UrlCount-1)){

				$Spage=($UrlCount-1);

				}

			}	

		$Content=geturlcontent($UrlArr[$Spage],$S_Code);//读取列表文件

		if(!IsNul($Content)) die("在获取<font color=red>$UrlArr[$Spage]</font>时出错,原因获取不到内容!<br/>暂停三秒采集下一列表<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".($Spage+1)."'}</script>");

		$returnStr = getContent($Content,$S_ListGo,$S_ListEnd,1);//截取列表开始--结束

		$returnStr=formaturl($returnStr,$UrlArr[$Spage]);

		

        $vLinkArr=getArr($S_LinkGo,$S_LinkEnd,$returnStr);//获取到舞曲连接地址 返回数组

		if(empty($vLinkArr)) die("获取舞曲连接地址时出错,请确认");

		$LinkCount=count($vLinkArr);//连接总数

	if($S_PicMode==0){

                $vpicArr=getArr($S_PicGo,$S_PicEnd,$returnStr);//获取到图片地址 返回数组

		if(empty($vpicArr)) die("获取图片地址时出错,请确认");

        }

		$NowVideoCount=CollectGet("nvc","auto");

		

		if(!IsNul($NowVideoCount)){

			$NowVideoCount=0;

			}

		else{

			if($NowVideoCount>$LinkCount){

				$LinkCount=$LinkCount-1;

				}

			}

        echo " <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"  class=\"tb_style\" >

        	<tr>

               <td height=\"30\" align=\"left\" class=\"td_title\">

           		&nbsp;&nbsp;正在采集第<font color=red>".($Spage+1)."</font>页列表,共<font color=red>".($UrlCount)."</font>页,当前页共<font color=red>".$LinkCount."</font>条数据,已经采集<font color=red>".($NowVideoCount)."</font>条</td>

            </tr>

      </table> ";

	  	

		$VideoContent=geturlcontent($vLinkArr[$NowVideoCount],$S_Code);//舞曲内容页面

		$VideoContent=formaturl($VideoContent,$vLinkArr[$NowVideoCount]);

		if(!IsNul($VideoContent)) die("在获取<font color=red>$vLinkArr[$NowVideoCount]</font>舞曲内容页出错,获取不到数据，暂停3秒继续采集下一舞曲!<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".$Spage."&nvc=".($NowVideoCount+1)."'}</script>");

		$V_Name=getContent($VideoContent,$S_VideoNameGo,$S_VideoNameEnd,1);//舞曲名

		$V_Remark=$S_RemarkGo;

		if($S_ClassMode=='0'){//分类

			$V_ClassID=$S_ClassID;

			}

		else{

			$V_ClassName=getContent($VideoContent,$S_ClassGo,$S_ClassEnd,1);

			$sql="select S_ID from s_class where S_Name like '%$V_ClassName%' Order by S_ID desc";

			$row=$db->getRow($sql);

			if($row['S_ID']){

				$V_ClassID=$row['S_ID'];

				}

			else{

				$V_ClassID=0;

				}	

			}

		$V_Direct=removeFilter(getContent($VideoContent,$S_DirectGo,$S_DirectEnd,1),$S_Safe);

		if($S_AreaMode=='1'){

			$V_Area=getContent($VideoContent,$S_AreaGo,$S_AreaEnd,1);

			}

		else{

			$V_Area=$S_AreaName;

			}	

		$V_Author=removeFilter(getContent($VideoContent,$S_AuthorGo,$S_AuthorEnd,1),$S_Safe);

		if($S_LanguageMode=='1'){

			$V_Language=getContent($VideoContent,$S_LanguageGo,$S_LanguageEnd,1);

			}

		else{

			$V_Language=$S_LanguageName;

			}

		$V_Year=getContent($VideoContent,$S_YearGo,$S_YearEnd,1);

		$V_Pic=$vpicArr[$NowVideoCount];

	if($S_PicMode==1){

		$V_Pic=getContent($VideoContent,$S_PicGo,$S_PicEnd,1);

		$V_Pic=dealPic($V_Pic,$S_Url);

        }

		$V_Content=getContent($VideoContent,$S_ContentGo,$S_ContentEnd,1);

		$V_Content=collectRep($V_Content,$S_Replace);

		if($S_PlayUrlMode=='1'){

			$V_PlayUrlArr=getArr($S_PlayUrlGo,$S_PlayUrlEnd,$VideoContent);

			for($u=0;$u<count($V_PlayUrlArr);$u++){				

				$tempcontent=geturlcontent($S_Url.$V_PlayUrlArr[$u],$S_Code);

				}

			$V_Vdata=implode('#',$playArr);

			$V_Vdata=getContent($tempcontent,$S_AddGo,$S_AddEnd,1);//舞曲地址

			$V_Vdata=collectRep($V_Vdata,$S_Replace);

			unset($playArr);

			}

	   else{

		   $V_Vdata=getContent($VideoContent,$S_AddGo,$S_AddEnd,1);//舞曲地址

		   $V_Vdata=collectRep($V_Vdata,$S_Replace);

		   }

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



		showcollectinfo($V_Name,$V_Remark,$V_Direct,$V_Author,$V_Year,$V_Pic,$V_ClassID,$V_Area,$V_Language,$V_Content,$V_Vdata);

	$sql="Insert s_zhuangbi (S_Name,S_Remark,S_ClassID,S_Pic,S_Author,S_Content,S_Source,S_Vdata,S_Year,S_Area,S_Language,S_Direct,S_AddTime,S_Url,S_AddPath) values ('".$V_Name."','".$V_Remark."',".$V_ClassID.",'".$V_Pic."','".$V_Author."','".$V_Content."','".$S_Source."','".$V_Vdata."','".$V_Year."','".$V_Area."','".$V_Language."','".$V_Direct."','".$V_AddTime."','".$S_Url."','".$S_AddPath."')";

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

			echo "<div style=\"height:45px;line-height:45px;\">&nbsp;&nbsp;<font color=green>舞曲保存成功</font>";

			}

		else{

			echo "<div style=\"height:45px;line-height:45px;\">&nbsp;&nbsp;<font color=red>舞曲保存失败</font>";

			}

			

	   if($NowVideoCount>=($LinkCount-1)){

		   $Spage=$Spage+1;

		   $NowVideoCount=0;

	   	}

		else{			

			$NowVideoCount=$NowVideoCount+1;

			}

		if($Spage>($UrlCount-1)) die("恭喜全部采集完毕！！");		

		if($NowVideoCount>=$LinkCount){

			die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....恭喜全部采集完毕！！</div>");

			}			

		else{

			die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....</div><script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".$Spage."&nvc=".($NowVideoCount)."'}</script>");

			

			}		

		

		}

	elseif($S_Page=='4'){//采集内容页

		$StartPage=$S_PageGo;

		$Spage=CollectGet("spage","auto");

		if($S_Order=="desc"){

			if(!IsNul($Spage)){

				$Spage=$S_PageEnd;}

			else{

				if($Spage>=$S_PageEnd) $Spage=$S_PageEnd;

				}	

			}

		else{	

			if(!IsNul($Spage)){

				$Spage=$S_PageGo;

			}else{

				if($Spage>$S_PageEnd) $Spage=$S_PageEnd;

				}

		}

		$Url=ReplaceStr($S_UrlStr,'{$ID}',$Spage);

		$VideoContent=geturlcontent($Url,$S_Code);//读取列表文件

		$VideoContent=formaturl($VideoContent,$Url);

	if($S_PicMode==0){

                $vpicArr=getArr($S_PicGo,$S_PicEnd,$returnStr);//获取到图片地址 返回数组

		if(empty($vpicArr)) die("获取图片地址时出错,请确认");

        }

		if(!IsNul($VideoContent)){

			if($S_Order=="desc"){

				die("在获取<font color=red>$Url</font>时出错,原因获取不到内容!<br/>暂停三秒采集下一列表<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".($Spage-1)."'}</script>");

				}

			else{

				die("在获取<font color=red>$Url</font>时出错,原因获取不到内容!<br/>暂停三秒采集下一列表<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".($Spage+1)."'}</script>");

				}	

			

		}

        echo " <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"  class=\"tb_style\" >

        	<tr>

               <td height=\"30\" align=\"left\" class=\"td_title\">

           		&nbsp;&nbsp;正在采集第<font color=red>".$Spage."</font>页舞曲内容,共<font color=red>".$S_PageEnd."</font>条数据,已经采集<font color=red>".($Spage)."</font>条</td>

            </tr>

      </table> ";			

		$V_Name=getContent($VideoContent,$S_VideoNameGo,$S_VideoNameEnd,1);//舞曲名

		if($S_ClassMode=='0'){//分类

			$V_ClassID=$S_ClassID;

			}

		else{

			$V_ClassName=getContent($VideoContent,$S_ClassGo,$S_ClassEnd,1);

			$sql="select S_ID from s_class where S_Name like '%$V_ClassName%' Order by S_ID desc";

			$row=$db->getRow($sql);

			if($row['S_ID']){

				$V_ClassID=$row['S_ID'];

				}

			else{

				$V_ClassID=0;

				}	

			}

		$V_Direct=removeFilter(getContent($VideoContent,$S_DirectGo,$S_DirectEnd,1),$S_Safe);

		if($S_AreaMode=='1'){

			$V_Area=getContent($VideoContent,$S_AreaGo,$S_AreaEnd,1);

			}

		else{

			$V_Area=$S_AreaName;

			}	

		$V_Author=removeFilter(getContent($VideoContent,$S_AuthorGo,$S_AuthorEnd,1),$S_Safe);

		if($S_LanguageMode=='1'){

			$V_Language=getContent($VideoContent,$S_LanguageGo,$S_LanguageEnd,1);

			}

		else{

			$V_Language=$S_LanguageName;

			}

		$V_Year=getContent($VideoContent,$S_YearGo,$S_YearEnd,1);

		$V_Pic=$vpicArr[$NowVideoCount];

	if($S_PicMode==1){

		$V_Pic=getContent($VideoContent,$S_PicGo,$S_PicEnd,1);

		$V_Pic=dealPic($V_Pic,$S_Url);

        }

		$V_Content=getContent($VideoContent,$S_ContentGo,$S_ContentEnd,1);

		$V_Content=collectRep($V_Content,$S_Replace);

		if($S_PlayUrlMode=='1'){

			$V_PlayUrlArr=getArr($S_PlayUrlGo,$S_PlayUrlEnd,$VideoContent);

			for($u=0;$u<count($V_PlayUrlArr);$u++){				

				$tempcontent=geturlcontent($S_Url.$V_PlayUrlArr[$u],$S_Code);

				}

			$V_Vdata=implode('#',$playArr);

			$V_Vdata=getContent($tempcontent,$S_AddGo,$S_AddEnd,1);//舞曲地址

			$V_Vdata=collectRep($V_Vdata,$S_Replace);

			unset($playArr);

			}

	   else{

		   $V_PlayListContent=getContent($VideoContent,$S_PlayUrlGo,$S_PlayUrlEnd,1);		  

		   $V_Vdata=getContent($VideoContent,$S_AddGo,$S_AddEnd,1);//舞曲地址

		   $V_Vdata=collectRep($V_Vdata,$S_Replace);		   

		   }

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



		if($S_Order=="desc"){

			 $Spage=$Spage-1;

			}

		else{	

		 	$Spage=$Spage+1;

			}

		showcollectinfo($V_Name,$V_Remark,$V_Direct,$V_Author,$V_Year,$V_Pic,$V_ClassID,$V_Area,$V_Language,$V_Content,$V_Vdata);

	$sql="Insert s_zhuangbi (S_Name,S_Remark,S_ClassID,S_Pic,S_Author,S_Content,S_Source,S_Vdata,S_Year,S_Area,S_Language,S_Direct,S_AddTime,S_Url,S_AddPath) values ('".$V_Name."','".$V_Remark."',".$V_ClassID.",'".$V_Pic."','".$V_Author."','".$V_Content."','".$S_Source."','".$V_Vdata."','".$V_Year."','".$V_Area."','".$V_Language."','".$V_Direct."','".$V_AddTime."','".$S_Url."','".$S_AddPath."')";

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

			echo "<div style=\"height:45px;line-height:45px;\">&nbsp;&nbsp;<font color=green>舞曲保存成功</font>";

			}

		else{

			echo "<div style=\"height:45px;line-height:45px;\">&nbsp;&nbsp;<font color=red>舞曲保存失败</font>";

			}

		if($S_Order=="desc"){

			if($Spage<$S_PageGo){

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....恭喜全部采集完毕！！</div>");

				}

			else{				

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....</div><script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".$Spage."&nvc=".($NowVideoCount)."'}</script>");}			

			}

		else{

			if($Spage>=$S_PageEnd){

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....恭喜全部采集完毕！！</div>");

				}

			else{				

				die("&nbsp;&nbsp;<font color=red>$V_Name</font>采集完毕,暂停3秒继续采集....</div><script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?S_ID=".$S_ID."&spage=".$Spage."&nvc=".($NowVideoCount)."'}</script>");

				}

			}		

	

		}	







function showcollectinfo($V_Name,$V_Remark,$V_Direct,$V_Author,$V_Year,$V_Pic,$V_ClassID,$V_Area,$V_Language,$V_Content,$V_Vdata){

	echo "<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"  class=\"tb_style\" >

    <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">舞曲名称：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;\">$V_Name</td>

    </tr>

    <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">舞曲歌手：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;\">$V_Author</td>

    </tr>

    <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">发行年份：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;\">$V_Year</td>

    </tr>

    <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">舞曲图片：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;\">$V_Pic

	   </td>

    </tr>

    <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">舞曲分类：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;\">$V_ClassID</td>

    </tr>

    <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">舞曲地区：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;\">$V_Area</td>

    </tr>

    <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">舞曲语言：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;\">$V_Language</td>

    </tr>

     <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">舞曲简介：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;\">$V_Content</td>

    </tr>

    <tr>

       <td width=\"10%\" height=\"30\" align=\"right\" class=\"td_border\">舞曲地址：</td>

       <td width=\"90%\" height=\"30\" align=\"left\" class=\"td_border\" style=\"padding-left:10px;word-break: break-all; word-wrap:break-word;\">$V_Vdata</td>

    </tr>

</table>";

	}



?>        

        </div>

    </div>

</div>        

</body>

</html>