Показать сообщение отдельно
  #7  
Старый 20.12.2012, 09:50
Аватар для NumLock
NumLock NumLock вне форума
Let Me Show You
 
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
По умолчанию

работает
Код:
var
  strm: TStringStream;
  i: Integer;
  s: String;
begin
  IdHTTP1.HandleRedirects:=False;
  IdHTTP1.AllowCookies:=True;
  IdHTTP1.CookieManager:=IdCookieManager1;
  strm:=TStringStream.Create('actions=add&logines=wormix&passwdr=wormix1');
  try
    IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded';
    try
      IdHTTP1.Post('http://excode.ru/aut.php', strm);
    except
      if IdHTTP1.ResponseCode div 100 = 3 then
      begin
        for i:=0 to IdCookieManager1.CookieCollection.Count-1 do
          IdHTTP1.Request.CustomHeaders.Add('Cookie: '+IdCookieManager1.CookieCollection.Items[i].CookieText);
        IdHTTP1.Request.Referer:='http://excode.ru/index.php';
        IdHTTP1.Request.ContentType:='text/html';
        s:=IdHTTP1.Get('http://excode.ru/index.php');
        if Pos('accaunt', s)>0 then Label1.Caption:='ok' else Label1.Caption:='err';
      end;
    end;
  finally
    strm.Free;
  end;
end;
__________________
Пишу программы за еду.
__________________
Ответить с цитированием