RE: [PHP] FTP DIRECTORY

From: Date: Mon, 05 May 2003 13:06:26 +0000
Subject: RE: [PHP] FTP DIRECTORY
Groups: php.general 
Request: Send a blank email to php-general+get-146427@lists.php.net to get a copy of this message
Hi Zanzamarr: > I have this script to the connession to a site but in the > options it lists also the dirs.... what could I do? > > <?Php > $ftp_server = $_POST['host']; > $ftp_user_name = $_POST['nome_utente']; > $ftp_user_pass = $_POST['password']; > > $conn_id = ftp_connect($ftp_server); > > $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); > > > if ((!$conn_id) || (!$login_result)) { > echo "La connessione FTP è fallita!"; > echo "Tentativo di connessione a $ftp_server per > l'utente $ftp_user_name"; > die; > } else { > echo "Connesso a $ftp_server, utente $ftp_user_name"; > } > > $cartella = ftp_pwd($conn_id); > if ($cartella = "/"){ > echo "<br /> > Sei nella cartella : Home<br /><br />"; > }else{ > echo "<br /> > Sei nella cartella : $cartella<br />"; > } > > > $list=ftp_nlist($conn_id, "$cartella"); > $i=0; > echo "<form action=\"\" method=\"\"> > <select> > "; > > do{ > echo "<option>"; > echo $list[$i], "</option>"; $i++; > }while($list[$i]); > > echo " > </select> > </form>"; Just start $i from 2... Directories "." and ".." will be always values 0 and 1 in the array. Regards, -- Luis R. Sales Glez. ID Team Information Systems & Solutions Sony Latin America Inc. Email: lrsg@sola.sony.com

« previous php.general (#146427) next »