<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<title>下载更新</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="../ls_admin/css/admin.css" />
</head>
<?php
// set up basic connection
require_once('../ls_admin/inc/ls_ftp.php');
require_once('../ls_admin/inc/constant.php');  //获得当前运行版本
$updateDir="../update/";
$openftp=new Ftp();
if($openftp->connect())
{
	$localpath=$updateDir."newver.php";
	$openftp->download("newver.php",$localpath);  //获得版本文件
	require_once($updateDir.'newver.php');
	
	$remotefiles= $openftp->filelist();
	for($i=0;$i<count($remotefiles);$i++)
	{
		$numDir=	$remotefiles[$i];
		$num=str_replace("./","",$numDir);
		echo $numDir.'<br/>';
		if(is_numeric($num) && ($num >$lsVer && $num<= $newVer))
		{
			$remotepath=$numDir."/";
			$localpath=$updateDir.$remotepath;
			if(!file_exists($localpath))mkdir($localpath);
			$ls_msg=$openftp->downloadfolder($remotepath,$localpath);
			if(!$ls_msg)
			$ls_msg="error in ftp_err.log";
			echo $ls_msg.'<br/><br/>';
		}
	}
}



?> 
