📄 checkuser.~pas
字号:
unit checkuser;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, SUIForm, SUIButton, StdCtrls, SUIEdit, DB, DBTables;
type
Tcheckuserform = class(TForm)
suiform1: TsuiForm;
Label1: TLabel;
Label2: TLabel;
suiButton1: TsuiButton;
suiButton2: TsuiButton;
Table1: TTable;
Edit1: TEdit;
Edit2: TEdit;
Table1Name: TStringField;
Table1Password: TStringField;
Table1Department: TStringField;
Table1Time: TDateField;
Table1Right_1: TBooleanField;
Table1Right_2: TBooleanField;
Table1Right_3: TBooleanField;
procedure suiButton2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure suiButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
checkuserform: Tcheckuserform;
i:integer;
implementation
uses main1;
{$R *.dfm}
procedure Tcheckuserform.suiButton2Click(Sender: TObject);
begin
close;
end;
procedure Tcheckuserform.FormActivate(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
username:='';
password:='';
edit1.SetFocus;
i:=3;
end;
procedure Tcheckuserform.suiButton1Click(Sender: TObject);
begin
username:=edit1.Text;
password:=edit2.Text;
table1.DatabaseName:='DBMS';
table1.TableName:='operator';
Table1.Active:=false;
//检测操作员是否存在
if (username<>'') and (i>0) then
begin
table1.Active:=true;
table1.EditKey;
table1.FieldByName('name').AsString:=username;
table1.GotoKey;
if (table1.FieldByName('name').AsString=username) and
(table1.FieldByName('password').AsString=password) then
begin //95
right_1:=table1.FieldByName('right_1').AsBoolean;
right_2:=table1.FieldByName('right_2').AsBoolean;
right_3:=table1.FieldByName('right_3').AsBoolean;
table1.Active:=false;
i:=-1;
if right_1=true then
begin
main.N2.Enabled:=true;
main.N5.Enabled:=true;
end;
if right_2=true then
begin
main.N4.Enabled:=true;
main.N14.Enabled:=true;
end;
if right_3=true then
main.N7.Enabled:=true;
main.ShowModal;
close;
end
else begin
application.MessageBox('用户名或密码错误,请检查后重试!','提示信息',
MB_OK);
i:=i-1;
edit1.Text:='';
edit2.Text:='';
edit1.SetFocus;
end;
end;
if i=0 then
//3次输入错误退出
begin
application.MessageBox('用户或密码错误,请退出!','提示信息',MB_OK);
close;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -