1
pnppcs
PHP FTP Client in a custom block??
  • 2005/8/4 7:15

  • pnppcs

  • Just popping in

  • Posts: 55

  • Since: 2005/1/25


Hi all, I stumbled across a script that I think allows FTP access to a server through a webpage using PHP. This has me very interested as I would like to give my clients a simple FTP client from my website but i'm not sure if this is posible.

I thought this is a good way to share the script also as it would be quite useful to a lot of people.

I tried adding the script into a custom block and well the block won't even show up.

I'm using 2.0.13 and below is the script:
<?
$host "";
$user "";
$password "";

$ftp_connection ftp_connect($host);

@
ftp_login($ftp_connection$user$password);

$path $HTTP_GET_VARS["path"];
   
$parent substr($path0strrpos($path"/"));
   
$file_list ftp_nlist($ftp_connection$path);
?>


<? if($path != "") { ?>
<a href="<?= $_SERVER["PHP_SELF"?>?path=<?= $parent ?>">..</a>
<br />
<? ?>

<? for($index 0$index sizeof($file_list); $index++) { ?>

   <?
   $file_size 
ftp_size($ftp_connection$file_list[$index]);

   
//Format the file name so that it doesn't include the full path.
   
if($path == "")
      
$file_name $file_list[$index];
   else
      
$file_name substr($file_list[$index], strrpos($file_list[$index], "/") + 1
                          
strlen($file_list[$index]) -  strrpos($file_list[$index], "/"));
   
?>

   <? //Find out if it's a file or a directory. ?>
   <? if($file_size == -1) { ?>
   <a href="<?= $_SERVER["PHP_SELF"?>?path=<?= $file_list[$index?>"><? ?>
   <?= $file_name ?><? if($file_size == -1) { ?></a><? ?>
   <br />

<? ?>

<?
ftp_close
($ftp_connection);
?>


Maybe this code is only for a stand alone webpage.php or maybe even a one page module??

Does anyone have any ideas??

Marty.

2
Bassman
Re: PHP FTP Client in a custom block??
  • 2005/8/4 7:37

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23



3
pnppcs
Re: PHP FTP Client in a custom block??
  • 2005/8/4 8:38

  • pnppcs

  • Just popping in

  • Posts: 55

  • Since: 2005/1/25


oh how cool is that

Thankyou bassman

Login

Who's Online

151 user(s) are online (96 user(s) are browsing Support Forums)


Members: 0


Guests: 151


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits