Autor Beitrag
wolle-
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 128

XP Prof, Suse 9.2
D7
BeitragVerfasst: Fr 28.01.05 22:50 
Hallo, ich habe mir schon einiges mit Delphi auseinander gesetzt,
habe Delphi 7 und ein eigendes Tool entwickelt was ich irgendwie auch nicht
rausgeben kann weil ich sonst stunk mit chef bekomme!

Ich habe folgendes Problem, alles läuft bis auf den Login,
Ich bekomme es nicht so hin das beim starten des Tools erst Passwort + Username eingegeben werden muss / wovon es nicht nur einen sonder 3 - 4 geben sollte.

Habe versucht das HauptFrame on Create auf HIDE zu stellen und die Password abfrage zu starten, erfolglos! Zeiterror.

Also wer mir helfen kann, vielen dank!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TAboutBox4.Edit1Change(Sender: TObject);
begin
    if Edit1.Text = 'wolle' then begin
ShowWindow(Form1..Handle, SW_SHOW);
end
else
begin
close;
end;


mfg wolle

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Fr 28.01.05 23:05 
Menüleiste-->Projekt-->Optionen

Da nimmst du deine Hauptform raus und läßt nur die Form mit der Benutzername und Kennwort Abfrage automatisch erstellen. Wenn richtig, dann Abfrage Form ausblenden, Hauptform erzeugen, anzeigen und Abfrageform schließen. Fertig.

_________________
Ciao, Sprint.
wolle- Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 128

XP Prof, Suse 9.2
D7
BeitragVerfasst: Fr 28.01.05 23:06 
Danke für deine schnelle Antwort!!! Werde ich direkt mal ausprobieren
Aber ich bekomme es noch nicht hin, dass mehrere benutzer + Passwörter funktionieren!
Schaffe nur mit PSW

Edit:

Nun habe ich das in den Project Optionen rausgenommen nun kommt sobald ich ein Password eingebe bzw ein buchstabe änder sofort

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
---------------------------
Prog Name
---------------------------
Zugriffsverletzung bei Adresse 004A8D0A in Modul 'admintool.exe'. Lesen von Adresse 000002F8.
---------------------------
OK   
---------------------------

Kann es sein das ich die Form1 erst createn muss und wenn ja, wie ?

Hilfe!
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Fr 28.01.05 23:26 
Es macht irgendwie nicht viel Sinn, wenn Benutzername und Kennwörter in der EXE stehen und auch noch unverschlüsselt sind. Aber hier mal ein kleiner Ansatz wie das Ganze aussehen könnte um verschiedene Strings miteinander zuvergleichen.
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
procedure TForm1.Button1Click(Sender: TObject);
type
  TLoginData = record
    Username: String;
    Password: String;
  end;
const
  LoginData: array[0..1] of TLoginData = (
    (Username : 'PeterPan'; Password : 'xyz123'),
    (Username : 'PeterLustig'; Password : '666'));
var
  I: Integer;
  CanLogin: Boolean;
begin

  CanLogin := False;

  for I := Low(LoginData) to High(LoginData) do
    if Edit1.Text = LoginData[I].Username then
    begin
      if Edit2.Text = LoginData[I].Password then
        CanLogin := True;
      Break;
    end;

  if CanLogin then
    ShowMessage('Super, Mario.')
  else
    ShowMessage('Du darfst hier nicht rein.');

end;

_________________
Ciao, Sprint.
wolle- Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 128

XP Prof, Suse 9.2
D7
BeitragVerfasst: Fr 28.01.05 23:29 
Super!!!
Hast du eine Lösung wie es nicht so in der Exe steht?
Ich bin noch nicht so experte dachte vielleicht aus mysql auslesen aber das habe ich dann garnicht verstanden!

Zitat:
Menüleiste-->Projekt-->Optionen

Da nimmst du deine Hauptform raus und läßt nur die Form mit der Benutzername und Kennwort Abfrage automatisch erstellen. Wenn richtig, dann Abfrage Form ausblenden, Hauptform erzeugen, anzeigen und Abfrageform schließen. Fertig.


Mal dazu, Hauptform erzeugen habe ich versucht mir Form1.create(application)
Abfrage form ausblenden habe ich mit ShowWindow(AboutBox4.Handle, SW_HIDE);
und wie schliesse ich ect ? Nu komme ich nicht mehr mit! Muss schwer zu sein mir zu antworten, aber sorry ich versuche es nur zu verstehen, hoffe um dein Verständniss!

Danke
wolle- Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 128

XP Prof, Suse 9.2
D7
BeitragVerfasst: Sa 29.01.05 00:02 
Teils Teils selber beantwortet, sieht nun so aus

Admintool

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
program admintool;

uses
  Forms,
  admin in 'admin.pas' {Form1},
  Unit1 in 'Unit1.pas' {Frame1: TFrame},
  about in 'about.pas' {AboutBox},
  Unit2 in 'Unit2.pas' {AboutBox1},
  hpadmin in 'icons\hpadmin.pas' {AboutBox2},
  ftp in 'ftp.pas' {AboutBox3},
  psw in 'psw.pas' {AboutBox4};

{$R *.res}

begin
  Application.Initialize;
  Application.Title := 'CSN - Administrator';
  Application.CreateForm(TAboutBox4, AboutBox4);
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.



Und der Code von dem psw abfrage teil ist:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
unit psw;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls;

type
  TAboutBox4 = class(TForm)
    Edit1: TEdit;
    Label4: TLabel;
    Edit2: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  AboutBox4: TAboutBox4;

implementation

uses admin;

{$R *.dfm}



procedure TAboutBox4.Button1Click(Sender: TObject);
type
  TLoginData = record
    Username: String;
    Password: String;
  end;
const
  LoginData: array[0..1] of TLoginData = (
    (Username : 'wolle'; Password : 'test'),
    (Username : 'PeterLustig'; Password : '666'));
var
  I: Integer;
  CanLogin: Boolean;
begin


  CanLogin := False;


  for I := Low(LoginData) to High(LoginData) do
    if Edit1.Text = LoginData[I].Username then
    begin
      if Edit2.Text = LoginData[I].Password then
        CanLogin := True;
      Break;
    end;


  if CanLogin then
ShowWindow(Form1.Handle, SW_SHOW)
  else
   Label4.Caption := 'Du darfst hier nicht rein.';


end;


Nun gebe ich mein User und psw ein, er blendet auch das Hauptprog ein, aber die buttons, toolbars ect nicht? Wisst ihr woran das liegen kann?

thx
mfg wolle

Ich Editire mich nochmal:


Gebe Password ein, Haupt startet, keine coolbar - bzw toolbar, nur oben die Menubar! Kann nicht mit dem X oben rechts schliessen oder sonstiges, die ComboBox ist auch nicht da. Hat das einen bestimmten Grund?
thx

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
wolle- Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 128

XP Prof, Suse 9.2
D7
BeitragVerfasst: Sa 29.01.05 01:15 
Zitat:
Moderiert von Christian S.: Code- durch Delphi-Tags ersetzt.


wie bitte?
oerm *vor wand guck*
Was ist gemeint!
ScorpionKing
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1150

Win XP

BeitragVerfasst: Sa 29.01.05 07:42 
wolle- hat folgendes geschrieben:
Zitat:
Moderiert von Christian S.: Code- durch Delphi-Tags ersetzt.


wie bitte?
oerm *vor wand guck*
Was ist gemeint!


dieses "moderiert von christian s. code- durch delphi-tags ersetzt." heißt, dass Christian deine Code-Tags, durch Delphi-Tags ersetzt hat!

_________________
Aus dem Urlaub zurück!
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Sa 29.01.05 12:43 
Für Deine Passwortabfrage würde ich eine Accessdatenbank nehmen, die Du irgendwo zentral ablegst und dann mit den ADO-Komponenten drauf zugreifst.
wolle- Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 128

XP Prof, Suse 9.2
D7
BeitragVerfasst: Sa 29.01.05 13:21 
bis11 weisst du wo es irgendwo so ein Beispiel oder so gibt, damit habe ich leider garkeine erfahrung!
Wäre echt dankbar!

Habe immernoch das problem das wenn ich die Form1 create, dann die buttons und toolbars nicht sichtbar sind :(

Danke wolle