Проблема с авторизацией

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by RedFern.89, 6 Apr 2015.

  1. RedFern.89

    RedFern.89 Member

    Joined:
    20 Jan 2010
    Messages:
    575
    Likes Received:
    48
    Reputations:
    0
    В общем, при попытке авторизации выбивает ошибку "HTTP/1.1 302 Found"

    Code:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
      IdHTTP, ExtCtrls, StdCtrls, GIFImage, IdCookieManager;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        Image1: TImage;
        IdHTTP1: TIdHTTP;
        IdCookieManager1: TIdCookieManager;
        Edit1: TEdit;
        Edit2: TEdit;
        Edit3: TEdit;
        Edit4: TEdit;
        Memo1: TMemo;
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      SL: TStringList;
    begin
      SL := TStringList.Create;
      SL.Add('gameserver=server');
      SL.Add('playername=' + Edit2.Text);
      SL.Add('password=' + Edit3.Text);
      SL.Add('code=');
      SL.Add('secpic=' + Edit4.Text);
      IdHTTP1.Post('http://diamondrp.ru/?page=login&checkdata=do', SL);
      Memo1.Text := IdHTTP1.Get('http://diamondrp.ru/?page=ucp');
      SL.Free;
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    var
      gif: TGIFImage;
      ms: TMemoryStream;
    begin
      ms := TMemoryStream.Create;
      gif := TGIFImage.Create;
      IdHTTP1.Get('http://diamondrp.ru/secpic.php', ms);
      ms.Position := 0;
      gif.LoadFromStream(ms);
      Image1.Picture.Assign(gif);
      ms.Free;
      gif.Free;
    end;
    
    end.
    
    В чем ошибка?
     
  2. M_script

    M_script Members of Antichat

    Joined:
    4 Nov 2004
    Messages:
    2,581
    Likes Received:
    1,317
    Reputations:
    1,557
    Не ошибка, а исключение. Там авторизация через httpS.
     
  3. RedFern.89

    RedFern.89 Member

    Joined:
    20 Jan 2010
    Messages:
    575
    Likes Received:
    48
    Reputations:
    0
    Как исправить, чтобы ее не было?
     
  4. M_script

    M_script Members of Antichat

    Joined:
    4 Nov 2004
    Messages:
    2,581
    Likes Received:
    1,317
    Reputations:
    1,557
    Работать через https, а не http
     
  5. RedFern.89

    RedFern.89 Member

    Joined:
    20 Jan 2010
    Messages:
    575
    Likes Received:
    48
    Reputations:
    0
    Все равно тоже самое
     
  6. M_script

    M_script Members of Antichat

    Joined:
    4 Nov 2004
    Messages:
    2,581
    Likes Received:
    1,317
    Reputations:
    1,557
    Code:
       try
          IdHTTP1.Get('ТУТССЫЛКА');
        except
          ShowMessage(HTTP.Response.Location);
        end;
    Что пишет?
     
  7. RedFern.89

    RedFern.89 Member

    Joined:
    20 Jan 2010
    Messages:
    575
    Likes Received:
    48
    Reputations:
    0
    HTTP/1.1 302 Found
     
  8. M_script

    M_script Members of Antichat

    Joined:
    4 Nov 2004
    Messages:
    2,581
    Likes Received:
    1,317
    Reputations:
    1,557
    Не там вставил код. Должна быть ссылка.
     
  9. banned

    banned Banned

    Joined:
    20 Nov 2006
    Messages:
    3,324
    Likes Received:
    1,193
    Reputations:
    252