Выкладываю сырцы этого регера. Код вроде бы итак понятен, если что не ясно - велкам в комменты.
Файл проекта.
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Основной юнит.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, IdCookieManager, IdAntiFreezeBase,
IdAntiFreeze, IdCookie;
type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
Button1: TButton;
IdAntiFreeze1: TIdAntiFreeze;
IdCookieManager1: TIdCookieManager;
Memo1: TMemo;
Image1: TImage;
Edit1: TEdit;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses pngImage, IdMultipartFormData;
procedure TForm1.Button1Click(Sender: TObject);
var
tmp: string;
tmpImage: TMemoryStream;
PNG: TPNGObject;
Bitmap: TBitmap;
begin
Bitmap := TBitmap.Create;
IdHTTP1.AllowCookies := True;
tmp := IdHTTP1.Get('http://by.ru/create.cgi');
delete(tmp, 1, Pos('<label for="pin" >Ïðîâåðî÷íîå ñëîâî:', tmp) + 164);
delete(tmp, Pos('">', tmp), Length(tmp));
tmpImage := TMemoryStream.Create;
IdHTTP1.Get('http://by.ru/' + tmp, tmpImage);
tmpImage.Position := 0;
PNG := TPNGObject.Create;
PNG.LoadFromStream(tmpImage);
bitmap.Assign(png);
Image1.Picture.Graphic := Bitmap;
tmpImage.Free;
PNG.Destroy;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Data: TIdMultiPartFormDataStream;
CheckKey: string;
tmpDomen, tmpPass: string;
i: integer;
begin
Data := TIdMultiPartFormDataStream.Create;
Data.AddFormField('username', 'onlytest');
Data.AddFormField('pin', edit1.text);
CheckKey := IdHTTP1.Post('http://by.ru/create.cgi', Data);
tmpDomen := chr(ord('a') + Random(28));
Randomize();
for i := 0 to 8 do tmpDomen := tmpDomen + IntToStr(Random(9));
tmpPass := '';
for i := 0 to 10 do tmpPass := tmpPass + IntToStr(Random(9));
Data.AddFormField('domain', tmpDomen);
CheckKey := IdHTTP1.Post('http://by.ru/create.cgi?step=1', Data);
Data.AddFormField('password', tmpPass);
Data.AddFormField('confirm', tmpPass);
CheckKey := IdHTTP1.Post('http://by.ru/create.cgi?step=2', Data);
Data.AddFormField('method-email-active', 'on');
Data.AddFormField('email', 'mamiev@gmail.com');
CheckKey := IdHTTP1.Post('http://by.ru/create.cgi?step=3', Data);
CheckKey := IdHTTP1.Post('http://by.ru/create.cgi?step=4', Data);
Data.Free;
Memo1.Lines.Add('ftp://' + tmpDomen + ':' + tmpPass + '@ftp.by.ru-' + tmpDomen + '.by.ru');
// ftp://login:pass@ftp.by.ru-login.by.ru
end;
end.









