Advertisement
Guest User

Untitled

a guest
Jan 29th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 4.74 KB | None | 0 0
  1. function TForm1.Pars(T_, ForS, _T: string): string;
  2. var
  3.  
  4.   a, b: Integer;
  5.   a, b: Integer;
  6. begin
  7.  
  8.   Result := '';
  9.   Result := '';
  10.   if (T_ = '') or (ForS = '') or (_T = '') then
  11.   if (T_ = '') or (ForS = '') or (_T = '') then
  12.     Exit;
  13.     Exit;
  14.   a := Pos(T_, ForS);
  15.   a := Pos(T_, ForS);
  16.   if a = 0 then
  17.   if a = 0 then
  18.     Exit
  19.     Exit
  20.   else
  21.   else
  22.     a := a + Length(T_);
  23.     a := a + Length(T_);
  24.   ForS := Copy(ForS, a, Length(ForS) - a + 1);
  25.   ForS := Copy(ForS, a, Length(ForS) - a + 1);
  26.   b := Pos(_T, ForS);
  27.   b := Pos(_T, ForS);
  28.   if b > 0 then
  29.   if b > 0 then
  30.     Result := Copy(ForS, 1, b - 1);
  31.     Result := Copy(ForS, 1, b - 1);
  32. end;
  33. end;
  34.  
  35.  
  36. procedure TForm1.Button3Click(Sender: TObject);
  37. begin
  38.  
  39.   Data := Tstringlist.Create;
  40.   Data := Tstringlist.Create;
  41.   Data.Add('data');
  42.   Data.Add('data');
  43.   Data.Add('login');
  44.   Data.Add('login');
  45.   Data.Add('_sourcePage=/WEB-INF/jsp_modern/user/register_with_car_selector_tab.jsp');
  46.   Data.Add('_sourcePage=/WEB-INF/jsp_modern/user/register_with_car_selector_tab.jsp');
  47.    Data.Add('ajax=False');
  48.    Data.Add('ajax=False');
  49.   Data.Add('userName=' + Edit3.Text);
  50.   Data.Add('userName=' + Edit3.Text);
  51.   Data.Add('password=' + Edit4.Text);
  52.   Data.Add('password=' + Edit4.Text);
  53.   IdHTTP1.Post(Edit6.Text+'/mitglieder/aktion/RegisterUser.html', Data);
  54.   IdHTTP1.Post(Edit6.Text+'/mitglieder/aktion/RegisterUser.html', Data);
  55.   IdHTTP1.Request.Host := Edit6.Text;
  56.   IdHTTP1.Request.Host := Edit6.Text;
  57.   IdHTTP1.Request.UserAgent :=
  58.   IdHTTP1.Request.UserAgent :=
  59.     'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10';
  60.     'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10';
  61.   IdHTTP1.Request.Accept := 'application/xml, text/xml, */*';
  62.   IdHTTP1.Request.Accept := 'application/xml, text/xml, */*';
  63.   IdHTTP1.Request.AcceptLanguage := 'en-gb,en;q=0.5';
  64.   IdHTTP1.Request.AcceptLanguage := 'en-gb,en;q=0.5';
  65.   IdHTTP1.Request.AcceptEncoding := 'gzip,deflate';
  66.   IdHTTP1.Request.AcceptEncoding := 'gzip,deflate';
  67.   IdHTTP1.Request.AcceptCharset := 'ISO-8859-1,utf-8;q=0.7,*;q=0.7';
  68.   IdHTTP1.Request.AcceptCharset := 'ISO-8859-1,utf-8;q=0.7,*;q=0.7';
  69.   IdHTTP1.Request.Connection := 'keep-alive';
  70.   IdHTTP1.Request.Connection := 'keep-alive';
  71.   IdHTTP1.Request.ContentType :=
  72.   IdHTTP1.Request.ContentType :=
  73.     'application/x-www-form-urlencoded; charset=UTF-8';
  74.     'application/x-www-form-urlencoded; charset=UTF-8';
  75.   IdHTTP1.Request.Referer := Edit6.Text;
  76.   IdHTTP1.Request.Referer := Edit6.Text;
  77.   IdHTTP1.Request.Pragma := 'no-cache';
  78.   IdHTTP1.Request.Pragma := 'no-cache';
  79.   IdHTTP1.Request.CacheControl := 'no-cache';
  80.   IdHTTP1.Request.CacheControl := 'no-cache';
  81.   try
  82.   try
  83.     Request := IdHTTP1.Post(Edit6.Text, Data);
  84.     Request := IdHTTP1.Post(Edit6.Text, Data);
  85.     s:=IdHTTP1.Post(Edit6.Text+'/mitglieder/aktion/RegisterUser.html', Data);
  86.     s:=IdHTTP1.Post(Edit6.Text+'/mitglieder/aktion/RegisterUser.html', Data);
  87.     if Pos(Edit3.Text,s)<> 0 then
  88.     if Pos(Edit3.Text,s)<> 0 then
  89.     begin
  90.     begin
  91.       Offline.Font.Color := cLlime;
  92.       Offline.Font.Color := cLlime;
  93.       Offline.Caption := 'Online';
  94.       Offline.Caption := 'Online';
  95.     end;
  96.     end;
  97.     p:=IdHTTP1.Get('http://www.motor-talk.de/mitglieder/aktion/LoginUser.html?userName='+Edit3.Text+'&login&password='+edit4.Text);
  98.     p:=IdHTTP1.Get('http://www.motor-talk.de/mitglieder/aktion/LoginUser.html?userName='+Edit3.Text+'&login&password='+edit4.Text);
  99.      if Pos(Edit3.Text,p)<> 0 then
  100.      if Pos(Edit3.Text,p)<> 0 then
  101.     begin
  102.     begin
  103.       Offline.Font.Color := cLlime;
  104.       Offline.Font.Color := cLlime;
  105.       Offline.Caption := 'Online';
  106.       Offline.Caption := 'Online';
  107.     end;
  108.     end;
  109.     g := Pars('alt="', Edit3.Text, '" src="http://avatars.motor-talk.de/data/avatars/20/2058431.gif"/>');
  110.     g := Pars('alt="', Edit3.Text, '" src="http://avatars.motor-talk.de/data/avatars/20/2058431.gif"/>');
  111.     Memo2.Clear;
  112.     Memo2.Clear;
  113.     Memo2.Lines.Add(s);
  114.     Memo2.Lines.Add(s);
  115.     Memo2.Lines.Add('----------------------------------------------------');
  116.     Memo2.Lines.Add('----------------------------------------------------');
  117.     Memo2.Lines.Add(p+'=Результат.');
  118.     Memo2.Lines.Add(p+'=Результат.');
  119.     Memo2.Lines.Add('----------------------------------------------------');
  120.     Memo2.Lines.Add('----------------------------------------------------');
  121.     Memo2.Lines.Add(g+'=Результат.');
  122.     Memo2.Lines.Add(g+'=Результат.');
  123.   finally
  124.   finally
  125.     Data.Clear;
  126.     Data.Clear;
  127.     Request := '';
  128.     Request := '';
  129.     s := '';
  130.     s := '';
  131.     g := '';
  132.     g := '';
  133.     p := '';
  134.     p := '';
  135.   end;
  136.   end;
  137. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement