diff --git a/application/default/controllers/HeiheController.php b/application/default/controllers/HeiheController.php index fcdc94a1..49b2491b 100644 --- a/application/default/controllers/HeiheController.php +++ b/application/default/controllers/HeiheController.php @@ -509,7 +509,7 @@ class HeiheController extends DataController // 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)"; $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)"; $sth=$this->db->prepare($sql); @@ -613,8 +613,11 @@ class HeiheController extends DataController //ftp路径 $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->execute(); $row = $sth->fetch(); @@ -624,7 +627,7 @@ class HeiheController extends DataController //$old=umask(0); //@mkdir($homedir,0777); //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 @@ -642,14 +645,15 @@ class HeiheController extends DataController return true; }else{ - $uid = 109; + $uid = 1002; $gid = 1002; $passwd = $this->genRandomString(16); //$sql = "UPDATE proftpusers SET passwd=?,uid=?,gid=?,homedir=? WHERE userid=?"; //$sth = $this->db->prepare($sql); //$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); if($rs) { @@ -671,14 +675,15 @@ class HeiheController extends DataController } else{ - $uid = 109; + $uid = 1002; $gid = 1002; $passwd = $this->genRandomString(16); //$sql = "INSERT INTO proftpusers (userid,passwd,uid,gid,homedir) VALUES (?,?,?,?,?)"; //$sth = $this->db->prepare($sql); //$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); if($rs) {