Advertisement
hosttimer

cadastra usuário e senha novos delphi

Dec 14th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.58 KB | None | 0 0
  1. unit caduser;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, PngBitBtn;
  8.  
  9. type
  10.   TForm2 = class(TForm)
  11.     Edit1: TEdit;
  12.     Edit2: TEdit;
  13.     Label1: TLabel;
  14.     Label2: TLabel;
  15.     Label3: TLabel;
  16.     Button2: TButton;
  17.     PngBitBtn1: TPngBitBtn;
  18.     procedure FormCreate(Sender: TObject);
  19.     procedure Button2Click(Sender: TObject);
  20.     procedure PngBitBtn1Click(Sender: TObject);
  21.   private
  22.     { Private declarations }
  23.   public
  24.     { Public declarations }
  25.   end;
  26.  
  27. var
  28.   Form2: TForm2;
  29.  
  30. implementation
  31.  
  32. {$R *.dfm}
  33.  
  34. uses U_dados, ucriptografia;
  35.  
  36. procedure TForm2.Button2Click(Sender: TObject);
  37. begin
  38. CLOSE;
  39. end;
  40.  
  41. procedure TForm2.FormCreate(Sender: TObject);
  42. begin
  43.     dm.Qlogin.close;
  44.     dm.Qlogin.SQL.Clear;
  45.     dm.Qlogin.SQL.Add('Select * from login');
  46. end;
  47.  
  48. procedure TForm2.PngBitBtn1Click(Sender: TObject);
  49.  begin
  50. if Trim(edit1.Text) = '' then
  51.   begin
  52.     Application.MessageBox('Preencha o campo senha.','Atenção',MB_OK+MB_ICONWARNING);
  53.     edit1.SetFocus;
  54.     Abort;
  55.   end;
  56.   if Trim(edit2.Text) = '' then
  57.   begin
  58.     Application.MessageBox('Preencha o campo usuario.','Atenção',MB_OK+MB_ICONWARNING);
  59.     edit2.SetFocus;
  60.     Abort;
  61.     end;
  62. dm.Qlogin.Open;
  63. dm.Qlogin.Insert;
  64. dm.Qloginusuario.Value:=edit1.Text;
  65. dm.Qloginsenha.Value:=cript('C', edit2.Text);
  66. dm.Qlogin.Edit;
  67. dm.Qlogin.Post;
  68. ShowMessage('SUA SENHA E SEU USUARIO FORMA SALVOS COM SUCESSO');
  69. edit1.Text:='';
  70. edit2.Text:='';
  71. end;
  72.  
  73. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement