note 63372 deleted from function.ftp-rawlist by bjori

From: Date: Tue, 21 Mar 2006 17:01:07 +0000
Subject: note 63372 deleted from function.ftp-rawlist by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106166@lists.php.net to get a copy of this message
Note Submitter: Reason: bad code ---- try this <? for($i = 0; $i < count($raw_list); $i++) { $dirline = $raw_list[$i]; if($systyp == "Windows_NT") { if(ereg("[-0-9]+ *[0-9:]+[PA]?M? +<DIR> {10}(.*)",$dirline,$regs)) { $out[] = array('type' => 'directory', 'name' => $regs[1]); } elseif(ereg("[-0-9]+ *[0-9:]+[PA]?M? +([0-9]+) (.*)",$dirline,$regs)) { $out[] = array('type' => 'file', 'size' => $regs[1], 'name' => $regs[2]); } } elseif($systyp == "UNIX") { if($dirline == "" && ereg("total ([0-9]*)", $raw_list[$i+2], $jump_regs)) { $out[] = array('type' => 'directory', 'name' => substr($raw_list[$i+1],0,-1)); $i += intval($jump_regs[1]); } elseif(ereg("([-dl])[rwxst-]{9}.* ([0-9]*) [a-zA-Z]+ [0-9: ]*[0-9] (.+)",$dirline,$regs)) { if($regs[1] == "d") { $out[] = array('type' => 'directory', 'name' => $regs[3]); } elseif ($regs[1] == "-") { $out[] = array('type' => 'file', 'size' => $regs[2], 'name' => $regs[3]); } else { $out[] = array('type' => 'link', 'name' => $regs[3]); } } } } ?>

« previous php.notes (#106166) next »