Parsing error.. Hopefully an easy fix for you gurus...

Guys, I get a parsing error when I call the getDirectory() function and have no idea why… I echoed and saw a successful connection was made to the FTP server. Please help, going nuts with this. Thanks!

<?php include 'dbconnect2.php'; $sql="Select v.* FROM FTP_INFO v"; $result=mysql_query($sql); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $host = $row['FTP_Server']; $user = $row['FTP_User_Id']; $password = $row['FTP_Password']; $rootfolder = $row['FTP_Root_Folder_Name']; $conn_id = ftp_connect($host) or die("Could not connect to $ftp_server"); $login_result = ftp_login($conn_id,$user,$password); ftp_pasv($conn_id, true); //$dir = ftp_nlist($conn_id,"./Call" ); //echo '
'.print_r($dir,true).'
'; getDirectory('.'); // Get the current directory //getDirectory( "./CallSpy" ); // Get contents of the "files/includes" folder } function getDirectory( $path = '.', $level = 0 ){ $ignore = array( 'cgi-bin', '.', '..' ); // Directories to ignore when listing output. Many hosts // will deny PHP access to the cgi-bin. $dh = @opendir( $path ); // Open the directory to the handle $dh while( false !== ( $file = readdir( $dh ) ) ){ // Loop through the directory if( !in_array( $file, $ignore ) ){ // Check that this file is not to be ignored $spaces = str_repeat( ' ', ( $level * 4 ) ); // Just to add spacing to the list, to better // show the directory tree. if( is_dir( "$path/$file" ) ){ // Its a directory, so we need to keep reading down... echo "$spaces $file
"; getDirectory( "$path/$file", ($level+1) ); // Re-call this same function but on a new directory. // this is what makes function recursive. } else { echo "$spaces $file
"; // Just print out the filename } } } closedir( $dh ); // Close the directory handle } ?>

Add the complete error message. Note that you pass in “.” into the function and the function seem written to quietly ignore it

Parse error: in C:\xampp\htdocs\dashboard\Call\HTML\Spirit8 Free Website Template - Free-CSS.com\tf-free-no.3\php\ftp_connect.php on line 28

Line 28 is the call to the getDirectory(’.’) function… Thx

Sponsor our Newsletter | Privacy Policy | Terms of Service