unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, inifiles;
type
TForm2 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit3: TEdit;
Label3: TLabel;
Button1: TButton;
Label4: TLabel;
ComboBox1: TComboBox;
Label5: TLabel;
Edit4: TEdit;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
fio,a:string;
b,c:string;
f: textFile;
pref:integer;
Ini: Tinifile;
begin
Ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
fio:=Edit1.Text;
a:=Edit1.Text;
b:=Edit2.Text;
c:=Edit3.Text;
if b<>c then label4.Caption:='Пароли не совпадают.'
else label4.Caption:='Регистрация успешно завершина.';
case combobox1.itemindex of
0:pref:=1;
1:pref:=2;
2:pref:=3;
end;
Ini.WriteString('login','log',a);
Ini.Writestring('login','parol',b);
Ini.WriteInteger('login','pref',pref);
Form2.Close;
end;
end.
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, inifiles;
type
TForm3 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
uses Unit4;
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
var
a,b:string;
log,parol:string;
Ini: Tinifile;
c:integer;
f:string;
begin
Ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
a:=Ini.Readstring('login','log','default value');
b:= Ini.Readstring('login','parol','default value');
c:=Ini.Readinteger('login','pref',10);
str(c,f);
log:=edit1.Text;
parol:=edit2.text;
if (a=log) and (b=parol) then begin
Form4:=TForm4.Create(Application);
Form4.Caption:='Вход';
Form4.Visible:=true;
form4.Label1.Caption:='уровень доступа='+f;
end else label3.caption:='логин или пароль не верны';
end;
end.
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm4 = class(TForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
{$R *.dfm}
end.