! WHO.BAS Security program for jobs attached to modems
!       JAMES A. JARBOE IV
!       1401 19TH STREET
!       HUNTSVILLE, TX  77340
!
! Dear AMOS AIDS,
!         This is a simple security program for entry onto your system
!         through a modem. The job attached to the modem must be forced
!         to run WHO, then just let it sit until someone calls up.
!         The first six letters of the variable CODES(x) must be the
!         user's name (the variable NAME$). This chains to a command file in
!         [2,2] which will log that person into their correct account
!         if they use their secret code (SEC$ variable the last four characters
!         of CODE$(x)).  SECRETCODE is for the operator to get out of WHO if
!         there is any need since a control C is error trapped.
!         SECRET is the user name and CODE is the user code
!         Example of command file to chain to
!               ;KLR.CMD logs into KENNETH'S letter writing account
!               :S
!               SET NOCTRLC
!               XY=0
!               DEL*
!               LOG DSK1:50,50
!               :R
!               RUN WORDPR
!
!
!         Since our programs are menu driven and error trapped, when the
!         user exits the menu the WHO program is chained to run for the
!         next user who calls.
!               WHO.BAS is not a fancy program nor as foolproof as other
!               security programs, but it works for us.
!
!
!
ON ERROR GOTO FIX                       ! traps control C
MAP1 NAME$,S,6                          ! user's name and command file to chain to
MAP1 SEC$,S,4                           ! user's code
MAP1 PASS$,S,10                         ! user's name+code
MAP1 CODES(10),S,10                     ! security code names (10) can be changed
       CODES(1)="SECRETCODE"           ! NAME$+SEC$ must = CODES to pass
       CODES(2)="KLR   01  "           ! security
       CODES(3)="SUE   02  "           ! the first six characters are user NAME
       CODES(4)="KAREN 03  "           ! the last four characters are user CODE
       CODES(5)="JAMES 04  "
  XCALL NOECHO                         ! calls noecho so input cannot be seen
TOP:
       PRINT TAB(-1,0);                        ! clears screen
       INPUT"Please enter user name ",NAME$
       IF NAME$="" THEN GOTO TOP
       ?:?
       INPUT"Please enter user code ",SEC$
       PASS$=UCS(NAME$)+SPACE$(6-LEN(NAME$))
       SEC$=UCS(SEC$)
       IF LEN(NAME$)> 6 THEN GOTO TOP
       IF LEN(SEC$)> 4 THEN GOTO TOP
       FOR I=1 TO 10                   ! 10 must be changed to whatever CODES #'s there are
       IF PASS$+SEC$=CODES(I) THEN I=10:NEXT I : GOTO OK
       NEXT I
       PRINT TAB(20,1);chr$(7);:input"Sorry User not on file                  CR TO CONTINUE",i$
       GOTO TOP
OK:
       CHAIN "DSK0:"+NAME$+".CMD[2,2]"
FIX:
       RESUME TOP