home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Underground
/
UNDERGROUND.ISO
/
password
/
passwd3.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-07-28
|
3KB
|
114 lines
program PASSWORD_TYPE3;
Uses Crt, Design;
type PasswordType = record
page : byte;
text : string[20];
end;
var pwords: array[1..10] of PasswordType;
pword : PasswordType;
password : string;
PasswordCheck : boolean;
Pw_index : byte;
procedure Enter_list;
var li : integer;
begin
for li := 1 to 10 do begin
save_screen;
window(10,8,60,9,' Change password ',black,7);
writexy(13,10,'Please enter password ');
write(li,' of 10 of the list');
writexy(13,12,'Page of the password in the manual: ');
readln(pwords[li].page);
writexy(13,14,'Password :');
readln(pwords[li].text);
restore_screen;
textcolor(7);
textbackground(black);
end;
end;
procedure Save_list;
var pwf : file;
begin
assign(pwf,'Passtyp3.DAT');
rewrite(pwf,10*sizeof(PasswordType));
blockwrite(pwf,pwords,1);
close(pwf);
end;
procedure Load_password(Idx : byte);
var pwf : file;
begin
assign(pwf,'Passtyp3.DAT');
reset(pwf,1);
seek(pwf,Idx*sizeof(PasswordType));
blockread(pwf,pword,sizeof(PasswordType));
close(pwf);
save_screen;
window(10,8,45,7,'',black,7);
writexy(12,10,'Please enter the password on page ');
write(pword.page,'');
writexy(12,12,'Password: ');
readln(password);
restore_screen;
end;
procedure CheckPassword;
begin
if password = pword.text then
PasswordCheck := true
else
PasswordCheck := false;
end;
procedure RespondPassword;
begin
save_screen;
window(10,8,40,7,'',black,7);
If PasswordCheck then begin
writexy(13,11,'Password correct - Access granted');
end else begin
writexy(13,11,'Password WRONG ! - No Access !');
end;
repeat until keypressed; readkey;
restore_screen;
textcolor(7);
textbackground(black);
end;
procedure Menu;
var choice : byte;
begin
repeat
clrscr;
writexy(10,1,'Example program for password type 3 (c) ''94 by DATA BECKER');
writexy(20,4,'M E N U');
writexy(20,5,'~~~~~~~');
writexy(15,6,'1) Enter password list');
writexy(15,8,'2) Password query');
writexy(15,10,'3) End');
writexy(15,13,'Your choice: ');
readln(choice);
if choice = 1 then begin
Enter_list;
Save_list;
end;
if choice = 2 then begin;
Pw_index := random(10)+1;
Load_password(Pw_Index);
CheckPassword;
RespondPassword;
end;
until choice = 3;
end;
begin
textcolor(7);
textbackground(black);
Menu;
end.