Procedure tform1.ftpanalyse (s: string; var userername, password, ip, fileName: string; var dirlist: tstringlist);
var
Ich, J: Ganzzahl;
Strauthorization, Straddr, Strdirfile: String; // Autorisierungsinformationen
Beginnen
Benutzername: = 'Anonymous';
Passwort: = '[email protected]';
IP: = '';
STRADDR: = Kopie (s, 7, Länge (s) -6); // Holen Sie sich das Teil nach ftp: //
// S -Format muss ähnlich sein wie ftp: // rec: [email protected]/20050418/abcdef.vox oder ftp: //192.168.76.11/...
i: = pos ('@', s);
if (i> 0) dann
Beginnen
Strauthorisierung: = Kopie (s, 7, i-7);
J: = pos (':', Strauthorization);
if (j <1) dann
Ausfahrt;
Benutzername: = Copy (Strauthorization, 1, j-1);
Passwort: = Copy (Strauthorization, J+1, Länge (Strauthorisierung) -J);
Ende ;
i: = pos ('@', Straddr);
J: = pos ('/', Straddr);
if (j> 0) dann
IP: = Copy (STRADDR, I+1, JI-1); // IP-Adresse abrufen
strdirfile: = copy (Straddr, j+1, Länge (STRADDR) -J);
Dirlist.Delimiter: = '/';
Dirlist.DelimitedText: = strdirfile; // Verzeichnisliste abrufen
Dateiname: = Dirlist [Dirlist.Count-1]; // Der letzte Teil ist der Dateiname
Dirlist.Delete (Dirlist.Count-1);
Ende ;