| |
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
<?php
/*------------------------------*/
/*
Titre : Commandes SITE
Date édition : 14 Fev 2019
*/
/*------------------------------*/
function ftpsite_commands($host , $user , $passwd , $port=21){
$fp = fsockopen($host, $port, &$errno, &$errstr, 2);
if(!$fp)
return "$errstr ($errno)";
fputs($fp, "USER $user\r\n");
fputs($fp, "PASS $passwd\r\n");
return "Login incorrect";
fputs($fp, "SITE HELP\r\n");
$lines = array();
do
{
if (! preg_match("/(214)?[- ]?(The following|Direct comments)/i", $r))
$lines[] = $r;
} while ($arr['timed_out'] != 1);
$commands = array();
foreach($lines as $line)
{
if ($line != '')
{
$tab_line = preg_split('/[-\s]/', $line, -1, PREG_SPLIT_NO_EMPTY);
foreach($tab_line as $command)
$commands[] = $command;
}
}
return $commands;
}
?>
<?php
/*------------------------------*/
/*
Titre : Commandes SITE
Date édition : 14 Fev 2019
*/
/*------------------------------*/
function ftpsite_commands($host , $user , $passwd , $port=21){
$fp = fsockopen($host, $port, &$errno, &$errstr, 2);
if(!$fp)
return "$errstr ($errno)";
fputs($fp, "USER $user\r\n");
fputs($fp, "PASS $passwd\r\n");
return "Login incorrect";
fputs($fp, "SITE HELP\r\n");
$lines = array();
do
{
if (! preg_match("/(214)?[- ]?(The following|Direct comments)/i", $r))
$lines[] = $r;
} while ($arr['timed_out'] != 1);
$commands = array();
foreach($lines as $line)
{
if ($line != '')
{
$tab_line = preg_split('/[-\s]/', $line, -1, PREG_SPLIT_NO_EMPTY);
foreach($tab_line as $command)
$commands[] = $command;
}
}
return $commands;
}
?>
|