change ftp to ftp2.westgis.ac.cn

This commit is contained in:
wlx 2013-05-24 08:37:35 +00:00
parent ec18b2737b
commit ebe7205124
1 changed files with 12 additions and 7 deletions

View File

@ -509,7 +509,7 @@ class HeiheController extends DataController
// 2. 保存变化记录 save changelog & userid for the latest version // 2. 保存变化记录 save changelog & userid for the latest version
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)"; $sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)";
$this->db->query($sql,array($changelog,$u_id,$row['uuid'])); $this->db->query($sql,array($changelog,$u_id,$row['uuid']));
file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1"); file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1");
//自动添加数据分类为黑河 //自动添加数据分类为黑河
$sql="insert into datasource (uuid,sourceid) values(?,1)"; $sql="insert into datasource (uuid,sourceid) values(?,1)";
$sth=$this->db->prepare($sql); $sth=$this->db->prepare($sql);
@ -613,8 +613,11 @@ class HeiheController extends DataController
//ftp路径 //ftp路径
$homedir = "/disk1/WestDC/upload/".$uuid."/"; $homedir = "/disk1/WestDC/upload/".$uuid."/";
//ftp用户表
$ftptable=' pureftp ';//ftp2.westgis.ac.cn
$sql = "SELECT * FROM proftpusers WHERE userid='$uname' ORDER BY pkid DESC"; //$sql = "SELECT * FROM proftpusers WHERE userid='$uname' ORDER BY pkid DESC";
$sql = "SELECT * FROM $ftptable WHERE userid='$uname' ORDER BY pkid DESC";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
$row = $sth->fetch(); $row = $sth->fetch();
@ -624,7 +627,7 @@ class HeiheController extends DataController
//$old=umask(0); //$old=umask(0);
//@mkdir($homedir,0777); //@mkdir($homedir,0777);
//umask($old); //umask($old);
$page=file_get_contents('http://ftp1.westgis.ac.cn/proftp_upload.php?uuid='.$uuid); $page=file_get_contents('http://ftp2.westgis.ac.cn/proftp_upload.php?uuid='.$uuid);
if (!empty($page)) die($page);//there are errors in visit ftp page if (!empty($page)) die($page);//there are errors in visit ftp page
@ -642,14 +645,15 @@ class HeiheController extends DataController
return true; return true;
}else{ }else{
$uid = 109; $uid = 1002;
$gid = 1002; $gid = 1002;
$passwd = $this->genRandomString(16); $passwd = $this->genRandomString(16);
//$sql = "UPDATE proftpusers SET passwd=?,uid=?,gid=?,homedir=? WHERE userid=?"; //$sql = "UPDATE proftpusers SET passwd=?,uid=?,gid=?,homedir=? WHERE userid=?";
//$sth = $this->db->prepare($sql); //$sth = $this->db->prepare($sql);
//$rs = $sth->execute(array($passwd,$uid,$gid,$homedir,$uname)); //$rs = $sth->execute(array($passwd,$uid,$gid,$homedir,$uname));
$sql="update proftpusers SET passwd='".$passwd."',uid=".$uid.",gid=".$gid.",homedir='".$homedir."' WHERE userid='".$uname."'"; //$sql="update proftpusers SET passwd='".$passwd."',uid=".$uid.",gid=".$gid.",homedir='".$homedir."' WHERE userid='".$uname."'";
$sql="update ".$ftptable." SET passwd='".$passwd."',uid=".$uid.",gid=".$gid.",homedir='".$homedir."' WHERE userid='".$uname."'";
$rs=$this->db->query($sql); $rs=$this->db->query($sql);
if($rs) if($rs)
{ {
@ -671,14 +675,15 @@ class HeiheController extends DataController
} }
else{ else{
$uid = 109; $uid = 1002;
$gid = 1002; $gid = 1002;
$passwd = $this->genRandomString(16); $passwd = $this->genRandomString(16);
//$sql = "INSERT INTO proftpusers (userid,passwd,uid,gid,homedir) VALUES (?,?,?,?,?)"; //$sql = "INSERT INTO proftpusers (userid,passwd,uid,gid,homedir) VALUES (?,?,?,?,?)";
//$sth = $this->db->prepare($sql); //$sth = $this->db->prepare($sql);
//$rs = $sth->execute(array($uname,$passwd,$uid,$gid,$homedir)); //$rs = $sth->execute(array($uname,$passwd,$uid,$gid,$homedir));
$sql="insert into proftpusers (userid,passwd,uid,gid,homedir) values('".$uname."','".$passwd."',109,1002,'".$homedir."')"; //$sql="insert into proftpusers (userid,passwd,uid,gid,homedir) values('".$uname."','".$passwd."',109,1002,'".$homedir."')";
$sql="insert into ".$ftptalbe." (userid,passwd,uid,gid,homedir) values('".$uname."','".$passwd."',1002,1002,'".$homedir."')";
$rs=$this->db->query($sql); $rs=$this->db->query($sql);
if($rs) if($rs)
{ {