unit Benuverw;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Buttons, TabNotBk, ComCtrls, ExtCtrls,
jpeg, DBTables,
DB;
type
TPVerwaltung =
class(TForm)
TabbedNotebook1: TTabbedNotebook;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BitBtn1: TBitBtn;
Table1: TTable;
DataSource1: TDataSource;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit4: TEdit;
GroupBox1: TGroupBox;
BitBtn2: TBitBtn;
Label8: TLabel;
Label9: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Label10: TLabel;
Label11: TLabel;
BitBtn3: TBitBtn;
Bevel1: TBevel;
Bevel2: TBevel;
Bevel3: TBevel;
Bevel4: TBevel;
Bevel5: TBevel;
Bevel6: TBevel;
Bevel7: TBevel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure TabbedNotebook1Change(Sender: TObject; NewTab: Integer;
var AllowChange: Boolean);
function key(eingabe:
string):
string;
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
PVerwaltung: TPVerwaltung;
implementation
{$R *.DFM}
procedure TPVerwaltung.BitBtn1Click(Sender: TObject);
var
Namen, eingabe:
string;
begin
Namen := Edit1.Text;
if length(Namen) < 2
then
begin
ShowMessage ('
Der Benutzernamen muß mindestens 2 Buchstaben haben');
Exit;
end
else
begin
if edit2.text = edit3.text
then
begin
eingabe := Edit2.Text;
if length(eingabe) > 9
then
begin
ShowMessage ('
Das Passwort darf höschtens 8 Buchstaben haben');
Exit;
end;
if length(eingabe) < 4
then
begin
ShowMessage ('
Das Passwort muß mindestens 4 Buchstaben haben');
Exit;
end
else
begin
{Speichern des Datensatzes}
with table1
do
begin
Append;
fields[1].Text := Namen;
fields[2].Text := key(eingabe);
ShowMessage('
Benutzer ' + Namen + '
angemeldet');
Post;
Edit1.Text := '
';
Edit2.Text := '
';
Edit3.Text := '
';
end;
{with table1 do}
end;
{else length(eingabe) < 4 then}
end {if edit2.text = edit3.text then}
else
begin
ShowMessage ('
Die Passwort-Eingaben stimmen nicht überein!');
Edit2.Text := '
';
Edit3.Text := '
';
end;
{else edit2.text = edit3.text then}
end;
{else length(Namen) < 2 then}
end;
{procedure TForm3.BitBtn1Click}
procedure TPVerwaltung.BitBtn2Click(Sender: TObject);
begin
Table1.First;
while not Table1.EOF = true
do
begin
if Combobox2.text = table1.fields[1].Text
then
begin
if key(Edit4.text) = table1.fields[2].text
then
begin
if MessageDlg('
Datensatz ' + ComboBox1.text + '
löschen?',
mtConfirmation, mbOkCancel, 0) = mrOK
then
begin
{Datensatz löschen}
table1.delete;
ComboBox1.text := '
';
Edit4.Text := '
';
exit;
end {if MessageDlg...}
else exit;
end
else
begin
ShowMessage('
Passwort falsch!');
exit;
end;
{else key(Edit4.text) = table1.fields[2].text then}
end;
Table1.Next;
end;
{while not Table1.EOF = true do}
ShowMessage('
Namen nicht gefunden!');
end;
{procedure TForm3.BitBtn2Click}
procedure TPVerwaltung.BitBtn3Click(Sender: TObject);
begin
Table1.First;
while not Table1.EOF = true
do
begin
if ComboBox2.text = table1.fields[1].Text
then
begin
if key(edit5.text) = table1.fields[2].text
then
begin
if Edit6.Text = Edit7.Text
then
begin
if length(Edit6.text) < 4
then
begin
ShowMessage ('
Das Passwort muß mindestens 4 Buchstaben haben');
exit;
end {if length(npw) < 4 then}
else
begin
{Passwort ändern}
with table1
do
begin
Edit;
fields[2].text := key(Edit6.text);
post;
end;
ShowMessage ('
Passwort geändert');
exit;
end;
{else length(Edit6.text) < 4 then}
end {if Edit6.Text = Edit7.Text}
else
begin
ShowMessage ('
Passwörter sind nicht identisch');
Edit6.Text := '
';
Edit7.Text := '
';
exit;
end;
{else Edit6.Text = Edit7.Text}
end {if key(edit5.text) = table1.fields[2].text}
else
begin
ShowMessage('
Passwort falsch!');
exit;
end;
{else ausgabe = table1.fields[2].text then}
end;
Table1.Next;
end;
{while not Table1.EOF = true do}
ShowMessage('
Namen nicht gefunden!');
end;
{procedure TForm3.BitBtn3Click}
procedure TPVerwaltung.TabbedNotebook1Change(Sender: TObject; NewTab: Integer;
var AllowChange: Boolean);
begin
Edit1.Text := '
';
Edit2.Text := '
';
Edit3.Text := '
';
Edit4.Text := '
';
Edit5.Text := '
';
Edit6.Text := '
';
Edit7.Text := '
';
Edit7.Text := '
';
end;
function TPVerwaltung.key(eingabe:
string):
string;
var
i: integer;
j, k: byte;
s:
string;
charly:
array[0..8]
of char;
begin
result := '
';
k := 1;
repeat
eingabe := eingabe + chr(55 + k);
k := k + 7;
until length(eingabe) = 9;
StrPCopy (charly, eingabe);
for i := 0
to 8
do
begin
j := ord(charly[i]);
j := j
xor (i*3+5);
str(j:3, s);
result := result + s;
end;
{for i := 1 to 8 do}
end;
{function key}
end.