home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l196 / 3.ddi / PASSWRD.BA$ / PASSWRD.bin
Encoding:
Text File  |  1990-06-24  |  1.2 KB  |  51 lines

  1. DECLARE FUNCTION CertifiedOperator% ()
  2. CONST FALSE = 0, True = NOT FALSE
  3.  
  4. IF CertifiedOperator = FALSE THEN
  5.     PRINT "Connection Refused."
  6.     END
  7. END IF
  8.  
  9. PRINT "Connected to Network."
  10. 'Main program continues here.
  11. '  .
  12. '  .
  13. '  .
  14. END
  15.  
  16. FUNCTION CertifiedOperator%
  17. ON LOCAL ERROR GOTO Handler
  18. 'Count the number of times the operator tries to sign on.
  19. Attempts% = 0
  20.  
  21. TryAgain:
  22. 'Assume the operator has valid credentials.
  23. CertifiedOperator = True
  24. 'Keep track of bad entries.
  25. Attempts% = Attempts% + 1
  26. IF Attempts% > 3 THEN ERROR 255
  27. 'Check out the operator's credentials.
  28. INPUT "Enter Account Number"; Account$
  29. IF LEFT$(Account$, 4) <> "1234" THEN ERROR 200
  30. INPUT "Enter Password"; Password$
  31. IF Password$ <> "Swordfish" THEN ERROR 201
  32. EXIT FUNCTION
  33.  
  34. Handler:
  35. SELECT CASE ERR
  36.     'Start over if account number doesn't have "1234" in it.
  37.     CASE 200
  38.         PRINT "Illegal account number. Please re-enter."
  39.         RESUME TryAgain
  40.     'Start over if the password is wrong.
  41.     CASE 201
  42.         PRINT "Wrong password. Please re-enter both items."
  43.         RESUME TryAgain
  44.     'Return false if operator makes too many mistakes.
  45.     CASE 255
  46.         CertifiedOperator% = FALSE
  47.         EXIT FUNCTION
  48. END SELECT
  49.  
  50. END FUNCTION
  51.