Witam ,
Pytanie jest nastepujace , jak zczytac liste plikow z serwera i umiescic ja w listboxie , laczac sie przez IdHTTP z wykorzystaniem skryptu ktory jest juz na serwerze i oszczedzi mi wiele pracy jesli go wykorzystam.
Za strukture plikow odpowiada plik ftpstruckt.php ktory wyglada tak :
<?
session_start();
include ("config.php");
require_once("class/class.User.php");
if ( isset( $_GET['dir'] ) ) {
$PrevCat = $_SESSION['cat'];
$GetDir = str_replace( array( '%3A', '%2F', '%3F', '%3D', '%20' ), array( ':', '/', '?', '&', ' ' ), $_GET["dir"] );
$_SESSION['cat'] = "$PrevCat/$GetDir";
header("Location: index.php");
}
if ( $_GET['go'] == 'up' ) {
$NewCatPath = '';
$TempCat = $_SESSION['cat'];
$TableTempCat = explode('/', $TempCat);
for($i = 0; $i < count($TableTempCat)-1; $i++ ) {
if ( $i == (count($TableTempCat) - 2) ) {
$NewCatPath .= $TableTempCat[$i];
}
else {
$NewCatPath .= $TableTempCat[$i]."/";
}
}
$_SESSION['cat'] = $NewCatPath;
header("Location: index.php");
}
if ( $_GET['action'] == 'addpkt' ) {
$User = new User($DBconfig);
$User->addPkt(9, 100);
header("Location: index.php");
}
if ( $_GET['action'] == 'logout' ) {
session_destroy();
session_unset();
header("Location: index.php");
}
if ( isset($_GET['inactive']) ) {
$User = new User($DBconfig);
$User->InActivationUser($_GET['inactive']);
header("Location: index.php?action=showuser");
}
if ( isset($_GET['active']) ) {
$User = new User($DBconfig);
$User->ActivationUser($_GET['active']);
header("Location: index.php?action=showuser");
}
if ( isset($_GET['deluser']) ) {
$User = new User($DBconfig);
$User->delUser($_GET['deluser']);
header("Location: index.php?action=showuser");
}
if ( isset($_GET['file']) ) {
if ( $_SESSION['name'] == 'FTPsupport' ) {
if ( $_SESSION['file'] == 0 ) {
$_SESSION['error'] = '2';
header("Location: index.php");
}
else {
$authUser = new User($DBconfig);
$_SESSION['file']--;
$authUser->IncFileLimit();
$SourceFile = $DefaultCat.$_SESSION['cat'];
$FileName = $_GET['file'];
str_replace( array( '%3A', '%2F', '%3F', '%3D', '%20' ), array( ':', '/', '?', '&', ' ' ), $FileName );
$FileSize = filesize($SourceFile.$FileName);
$MainSource = "Support/".$_SESSION['cat'];
$SecondSource = $SourceFile.$FileName;
$FileInfo = pathinfo($MainSource);
header("Location: ".$MainSource."/".$FileName);
/*header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream');
header('Content-Type: application/download');
header('Content-Disposition: attachment; filename = '.$FileName);
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.$FileSize);
readfile($MainSource);
header('Pragma: no-cache'); //ustawiamy: aby zawartość nie była cache'owana,
header('Content-Transfer-Encoding: binary'); //zawartość wysyłanego pliku jest binarna,
header('Content-Type: application/x-unknown'); //aplikacja odpowiedzialna za plik,
header("Content-Disposition: attachment; filename = $FileName"); //nazwa pliku,
header("Location: ".$MainSource); //zródło pliku. */
}
}
else {
header("Location: index.php");
$_SESSION['error'] = '1';
}
}
?>
z gory dzieki za pomoc.