Advertisement
Guest User

Untitled

a guest
Apr 6th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. unit Unit2;
  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;
  8.  
  9. type
  10. TFrmLogin = class(TForm)
  11. LblUserName: TLabel;
  12. LblPass: TLabel;
  13. EdtUser: TEdit;
  14. EdtPass: TEdit;
  15. BtnEnter: TButton;
  16. BtnBack: TButton;
  17. procedure BtnEnterClick(Sender: TObject);
  18. procedure BtnBackClick(Sender: TObject);
  19. private
  20. { Private declarations }
  21. public
  22. { Public declarations }
  23. end;
  24.  
  25. var
  26. FrmLogin: TFrmLogin;
  27.  
  28. implementation
  29.  
  30. {$R *.dfm}
  31. uses
  32. unit1, unit3;
  33. procedure TFrmLogin.BtnEnterClick(Sender: TObject);
  34. var
  35. Username, Password, User, Pass, Textstring : string;
  36. userfile : Textfile;
  37. done ,done2 : boolean;
  38. begin
  39. Assignfile (userfile, 'LoginDetails.txt');
  40. reset(userfile);
  41. username := EdtUser.text;
  42. Password := EdtPass.Text;
  43.  
  44. done := false;
  45. while ((done = false) AND (EOF(userfile)= false)) do
  46. Begin
  47. Readln(userfile, TextString);
  48. User := Textstring;
  49. Readln(userfile, TextString);
  50. pass := Textstring;
  51. if ((Username = User) AND (Password = Pass)) then
  52. begin
  53. showmessage (' Success');
  54. Done := True;
  55. close;
  56. FrmGraphMenu.show;
  57. end;
  58.  
  59. if (EOF(userFile)AND(done = False)) then
  60. begin
  61. Showmessage ('Try Again');
  62. end;
  63. //Readln
  64. End; //End of while
  65. CloseFile(UserFile);
  66. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement