unit authorization;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, Mask, Main,dmu;

type
  TfmAuthorization = class(TForm)
    edt1: TEdit;
    BitBtn1: TBitBtn;
    edt2: TEdit;
    BitBtn2: TBitBtn;
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmAuthorization: TfmAuthorization;

implementation

{$R *.dfm}

procedure TfmAuthorization.BitBtn2Click(Sender: TObject);
begin
fmAuthorization.Close;
end;

procedure TfmAuthorization.BitBtn1Click(Sender: TObject);
begin
  dm.tbl4.First;
while not dm.tbl4.Eof do
  begin
  if (edt1.Text=dm.tbl4.FieldByName('Имя пользователя').AsString) and (edt2.Text = dm.tbl4.FieldByName('Пароль').AsString)
  then
  begin
  fmAuthorization.Visible:=false;
  fmMain.Show;
  if dm.tbl4.FieldByName('privileges').AsBoolean then
    begin
    fmMain.pgc1.Pages[0].TabVisible:=True;
    fmMain.pgc1.Pages[1].TabVisible:=False;
    end
  else
    begin
    fmMain.pgc1.Pages[0].TabVisible:=False;
    fmMain.pgc1.Pages[1].TabVisible:=True;
    end;
    break;
  end;
  dm.tbl4.Next;
  if dm.tbl4.Eof then
    ShowMessage('Пара пользователь-логин не существуют. Проверьте правильность введенных Вами данных');
  end;
 
end;

end.
