Serwer - lista plikow- listbox - przez skrypt PHP anie IdFTP

0

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.

0
 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");

jak mam to wywolac w delphi ?

W zadnej ksiazce nie ma jak wywolywac dzialania z php w delphi

0

napisalem cos takiego , zeby wyswietlilo mi w memo zrodlo strony znajdujacej sie w dziale MOBILES na serwerze

procedure TForm1.Button3Click(Sender: TObject);
var
Input, OutPut : tstringstream;
begin
idHttp2.Request.ContentType := 'application/x-www-form-urlencoded';
idHttp2.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 5.0; pl-PL; rv:1.7.6) Gecko/20050226 Firefox/1.0.1';
Input := TStringStream.Create('');
Output := TStringStream.Create('');
idHttp2.Port:=80;
Input.WriteString('ftpstruct.php?dir=Mobiles');
IdHttp2.Host:='193.218.153.73';
idhttp2.Connect;
IdHTTP2.HandleRedirects:=True;
idHttp2.Post('http://www.kom-box.pl/SupportFiles/ftpstruct.php',Input ,Output);

memo1.Text:=Output.DataString;

end;

nic mi nie wyswietla

0
procedure TForm1.Button1Click(Sender: TObject);
var
OutPut : tstringstream;
begin
 Output := TStringStream.Create('');
 IdHttp1.Host:='www.kom-box.pl';
 idhttp1.Connect;
 idHttp1.Request.ContentType := 'application/x-www-form-urlencoded';
 idHttp1.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 5.0; pl-PL; rv:1.7.6) Gecko/20050226 Firefox/1.0.1';
 idHttp1.Port:=80;
 IdHTTP1.HandleRedirects:=True;
 idHttp1.get('http://www.kom-box.pl/SupportFiles/ftpstruct.php?dir=Mobiles',output);
 memo1.Text:=output.DataString;
end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1