procedure FormCreate(Sender: TObject);
private
B_halt: bool;
I_logo: integer;
{ Private declarations }
public
{ Public declarations }
end;
var
LoginForm: TLoginForm;
implementation
uses MainUnit, LogoUnit;
{$R *.dfm}
procedure TLoginForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
var
S_temppass: string;
begin
inherited;
if b_halt then
begin
query_pass.Close;
query_pass.Free;
application.Terminate;
exit;
end
else b_halt := true;
S_temppass := E_password.text;
USERNAME := L_name.Caption;
if (E_id.Text = '') or (L_name.Caption = '未知用户') then //用户名为空
begin
messagedlg('用户错误', mterror, [mbok], 0);
E_id.SetFocus;
canclose := false;
exit;
end //end if
else //用户名非空
begin
with query_pass do
begin
first;
while not eof do //检查用户名与密码
begin
if (USERNAME = fieldbyname('USERname').asstring) and
(S_tempPass = fieldbyname('Psd').asstring) then
begin
USERRIGHTSNAME := fieldbyname('rightsname').AsString;
USERRIGHTS := fieldbyname('rights').AsString;
break;
end;
next;
end; //end while
if eof then //用户名与密码不符
begin
inc(I_logo);
if I_logo >= 3 then
begin
messagedlg('您已尝试超过 3 次,系统将停止运行!', mterror, [mbok], 0);
query_pass.Close;
query_pass.Free;
application.Terminate;
end
else
begin
messagedlg('用户名与密码不符,请检查后重新输入。' + #13 + #13
+ '你还有 ' + inttostr(3 - I_logo) + ' 次机会!', mterror, [mbok], 0);
e_password.SetFocus;
e_password.SelectAll;
 
首页 上一页 4 5 6 7 8 9 10 下一页 尾页 7/16/16
商品销售管理系统文档(七)由毕业论文网(www.huoyuandh.com)会员上传。