Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   FREE PASCAL- habe ein Problem-Passworrt Programm (https://www.delphipraxis.net/156489-free-pascal-habe-ein-problem-passworrt-programm.html)

mcrool2010 3. Dez 2010 19:50

FREE PASCAL- habe ein Problem-Passworrt Programm
 
Hallo könnte mir jemand helfen?
also ich wollte, dass wenn man auf ein OK button klickt und das, was in der Edit Box mit dem übereinstimmt, was ich vor her als "Passwort" eingegeben hab man auf ein neues Fenster kommt, wenn es falsch ist auf ein anderes. Wie mach ich das? ich hab ein Fehler drin aber weiß nicht was?


hier mein Code:´
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin

if Edit1.text ='passwort123'
 then Form1.Hide;
  Form2.Show;
else if Edit.Text ='passwort1234'
then Form1.Hide;
  Form3.Show;
end;

Bummi 3. Dez 2010 19:54

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin

if Edit1.text ='passwort123' then
   begin
    Form1.Hide;
    Form2.Show;
   end
else if Edit.Text ='passwort1234' then
   begin
   Form1.Hide;
   Form3.Show;
   end;
end;

wobei Du wahrscheinlich (ich kenne den Rest Deines Codes nicht) Form1.Hide; auch einfach vorher einmalig machen kannst.

mcrool2010 3. Dez 2010 19:54

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
danke:)

mcrool2010 3. Dez 2010 19:59

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
ich hab es gerade ausprobiert und leider geht es immer noch nicht......
Delphi-Quellcode:
program project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, Unit1, LResources, Unit2, Unit3
  { you can add units after this };



begin
  {$I project1.lrs}
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.Run;
end.
es bleicb immer beim end. stecken

Bummi 3. Dez 2010 20:03

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
Leider kenne ich FREE PASCAL nicht, aus Delphisicht sieht das was ich sehe richtig aus....

himitsu 3. Dez 2010 20:05

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
Nach einem then/do wird eben immer nur ein Befehl/Block behandelt.
(Block = Begin bis End)

PS: diesen Passwortschutzabfrage knackt dir fast jeder in 10 Sekunden.

Passwörter nie im Klartext in der EXE abspeichern.

Passwörter gehören eigentlich nicht in eine EXE, aber wenn, dann sollten sie nur verschlüsselt oder als Hash vorliegen.
Wenn nicht, dann kann man mit einem einfachen Texteditor in die EXE reinschauen und kann das Passwort direkt ablesen.

Der eingegebene Text wird dann ebenfalls verschlüsselt/gehasht und dann verglichen.

[add]
Der gezeigte Code scheint OK, aber da wir nicht wissen was sonnst so passiert (in den anderen Units), kann dir so wohl keiner helfen.
Und was heißt bitte "bleibt stecken" ... gibt's irgendwelche Fehlermeldungen, welche du uns noch mitteilen möchtest?

Jens Hartmann 3. Dez 2010 20:08

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
Das dir der Fehler in der Projektdatei angezeigt wird, liegt daran, weil der Fehler vermutlich schon beim Compilieren auftritt. Setzt doch mal Haltepunkte und Zeig mal den Rest deines Codes.

Gruß Jens

mcrool2010 3. Dez 2010 20:10

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
ja also das "bleibt stecken bedeutet"

project1.lpr(22,1) Error: Can't create object file: C:\Users\...\Desktop\Lazarus1\PASSWORT\project1.ex e
project1.lpr(22,1) Fatal: Can't create executable C:\Users\...\Desktop\Lazarus1\PASSWORT\project1.ex e

mcrool2010 3. Dez 2010 20:12

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
sdlo das sind alle 3Units:

Delphi-Quellcode:
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  Unit2, StdCtrls, Unit3;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin

if Edit1.text ='passwort123' then
   begin
    Form1.Hide;
    Form2.Show;
   end
else if Edit1.Text ='passwort1234' then
   begin
   Form1.Hide;
   Form3.Show;
   end;
end;


initialization
  {$I unit1.lrs}

end.
Delphi-Quellcode:
unit Unit3;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls;

type

  { TForm3 }

  TForm3 = class(TForm)
    Label1: TLabel;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form3: TForm3;

implementation

initialization
  {$I unit3.lrs}

end.
Delphi-Quellcode:
program project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, Unit1, LResources, Unit2, Unit3
  { you can add units after this };



begin
  {$I project1.lrs}
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.Run;
end.
Delphi-Quellcode:
unit Unit2;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls;

type

  { TForm2 }

  TForm2 = class(TForm)
    Label1: TLabel;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form2: TForm2;

implementation

initialization
  {$I unit2.lrs}

end.

Jens Hartmann 3. Dez 2010 20:23

AW: FREE PASCAL- habe ein Problem-Passworrt Programm
 
Habe das ganze mal D2007 programmiert, damit geht´s. Wobei, beachte bitte die Hinweise von

Zitat:

Zitat von himitsu
PS: diesen Passwortschutzabfrage knackt dir fast jeder in 10 Sekunden.

Passwörter nie im Klartext in der EXE abspeichern.

Gruß Jens


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:22 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz