📄 u_login.pas
字号:
unit U_login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,U_crypt;
type
TF_login = class(TForm)
i_server_add: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
i_user: TEdit;
i_passwd: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
F_login: TF_login;
implementation
uses U_data, U_main;
{$R *.dfm}
procedure TF_login.Button1Click(Sender: TObject);
var
passwd,passwrd:string;
begin
with datam do
begin
conn.connected:=false;
conn.ConnectionString:='Provider=OraOLEDB.Oracle.1;Password=rsgl123;Persist Security Info=True;User ID=rsgl;Extended Properties="";Data Source='+i_server_add.Text;
try
conn.Open;
except
application.MessageBox('连接数据库失败!','连接失败',mb_ok);
application.Terminate ;
end;
T_user.Filter:='ID='+''''+i_user.Text+'''';
t_user.Filtered:=true;
t_user.Open;
if T_user.RecordCount=1 then
begin
passwd:=trim(i_passwd.Text);
if length(passwd)>5 then
begin
passwd:=copy(passwd+passwd,1,10);
passwd:=encrypt(passwd,123);
end;
passwrd:=trim(T_user['Passwd']);
showmessage(passwrd+#13+passwd);
if (passwrd=passwd) and (T_user.FieldByName('Authority').AsString='3') then
U_main.login:=true
else
application.MessageBox('请重新输入密码!','密码错误',mb_ok);
end
else
begin
application.MessageBox('请确认用户名大小写是否正确!','无此用户',mb_ok);
T_user.Close;
end;
end;
if U_main.login then F_login.Close;
end;
procedure TF_login.Button2Click(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -