Registriert seit: 4. Apr 2009
24 Beiträge
|
Re: Abfrage
8. Apr 2009, 22:49
Ich versteh die Welt nicht mehr ...
Hier Mein Code...
Delphi-Quellcode:
unit Chat1;
interface
uses
Windows, WinInet, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, StdCtrls, Login;
type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
Frame11: TFrame1;
procedure Button1Click(Sender: TObject);
procedure Frame11CancelBtnClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function putfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean;
var
hopen, hconnect: HINTERNET;
begin
hopen := InternetOpen(' myagent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
Result := FtpPutFile(hconnect, pchar(localfile), pchar(remotefile), FTP_TRANSFER_TYPE_UNKNOWN, 0);
InternetCloseHandle(hconnect);
end;
function getfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean;
var
hopen, hconnect: HINTERNET;
begin
hopen := InternetOpen(' myagent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
Result := FtpGetFile(hconnect, pchar(localfile), pchar(remotefile), false, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0);
InternetCloseHandle(hconnect);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Frame11.Show;
Button1.Hide;
end;
procedure TForm1.Frame11CancelBtnClick(Sender: TObject);
begin
ShowMessage(' ...wird beendet.');
close;
end;
end.
und
Delphi-Quellcode:
unit Login;
interface
uses
Windows, WinInet, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TFrame1 = class(TFrame)
Label1: TLabel;
Password: TEdit;
OKBtn: TButton;
CancelBtn: TButton;
Label2: TLabel;
Edit1: TEdit;
procedure OKBtnClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
implementation
{$R *.dfm}
function putfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean;
var
hopen, hconnect: HINTERNET;
begin
hopen := InternetOpen(' myagent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
Result := FtpPutFile(hconnect, pchar(localfile), pchar(remotefile), FTP_TRANSFER_TYPE_UNKNOWN, 0);
InternetCloseHandle(hconnect);
end;
function getfile(server, username, password, localfile, remotefile: string; port: word = 21): boolean;
var
hopen, hconnect: HINTERNET;
begin
hopen := InternetOpen(' myagent', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
hconnect := InternetConnect(hopen, pchar(server), port, pchar(username), pchar(password), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
Result := FtpGetFile(hconnect, pchar(localfile), pchar(remotefile), false, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0);
InternetCloseHandle(hconnect);
end;
procedure TFrame1.OKBtnClick(Sender: TObject);
var
Datei: TextFile;
MyFile: TStringList;
PasswordMatches: Boolean;
begin
getfile(' ip', ' benutzer', ' pw', ' verzeichniss' + Edit1.Text + ' .txt', Edit1.Text + ' .txt');
MyFile := TStringList.Create;
try
MyFile.LoadFromFile(Edit1.text + ' .txt');
PasswordMatches := Trim(MyFile.text) = ' Edit2.text';
finally
MyFile.Free;
end;
end;
end.
|