home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / BBS_UTIL / RBTCH242.ZIP / EXAMPLE.ZIP / RSB2BYTE.ZIP / RSB2BYTE.MRG < prev    next >
Text File  |  1993-07-24  |  6KB  |  124 lines

  1. * ------------[ BLED merge (c) Ken Goosens ]-------------
  2. * Merge this against RBBSSUB2.BAS to produce RSB2BYTE.BAS
  3. * RBBS-PC 17.4 - RBBSSUB2.BAS:  Date 6-20-1992  Size 140946 bytes
  4. * ------------[ Created 06-20-1992 14:45:00 ]------------
  5. *  
  6. * REPLACING old line(s) by new
  7. 20096 ' $SUBTITLE: 'CheckRatio - subroutine to print ul/dl ratio'
  8. ' $PAGE
  9. '
  10. '  NAME    -- CheckRatio
  11. '
  12. '  INPUTS  --   PARAMETER                    MEANING
  13. '               TellUser           TELL USER THEIR RATIO
  14. '               ZDnlds             FILES DOWNLOADED
  15. '               ZDLBytes!          BYTES DOWNLOADED
  16. '               ZUplds             FILES UPLOADED
  17. '               ZULBytes!          BYTES UPLOADED
  18. '
  19. '  OUTPUTS --   ZOK                 -1 if okay to download, 0 otherwise
  20. '
  21. '  PURPOSE -- To determine whether the users violated
  22. '             their upload to download restriction
  23. '
  24.       SUB CheckRatio (TellUser) STATIC
  25.       ZOK = ZTrue
  26.       IF ZRatioRestrict# <= 0 OR (NOT ZEnforceRatios) OR ZFreeDnld THEN _
  27.          GOTO 20110
  28. '
  29. ' Detemine method of ratio checking.  Look ahead to amount downloaded
  30. '
  31.       IF ZByteMethod = 1 OR ZByteMethod = 3 THEN _
  32.          Method$ = "Bytes" : _
  33.          ULWork# = ZULBytes! : _
  34.          DLWork# = ZDLBytes! + ZNumDnldBytes!
  35.       IF ZByteMethod = 0 OR ZByteMethod = 2 THEN _
  36.          Method$ = "Files" : _
  37.          ULWork# = ZUplds : _
  38.          DLWork# = ZDnlds + ZDownFiles
  39.       IF ULWork# < ZInitialCredit# THEN _
  40.          ULWork# = ZInitialCredit#
  41.       IF ZByteMethod = 2 THEN _
  42.          Today# = ZRatioRestrict# - ZDLToday! - ZDownFiles
  43.       IF ZByteMethod = 3 THEN _
  44.          Today# = ZRatioRestrict# - ZBytesToday! - ZNumDnldBytes!
  45. '
  46.       Ratio# = 0
  47.       RatioSuffix$ = ":0"
  48.       IF ULWork# > 0 THEN _
  49.          Ratio# = (DLWork# / ULWork#) : _
  50.          RatioSuffix$ = ":1"
  51. * -----------------[ first line different ]---------------
  52.       IF ZByteMethod > 1 THEN                                            ' DGS070301-DS
  53.      IF ZBytesToday! > 0 THEN _                                      ' DGS070301-DS
  54.         DGSTemp! = ZBytesToday!                                      ' DGS070301-DS
  55.      DGSTemp! = DGSTemp! + ZNumDnldBytes!                            ' DGS070301-DS
  56.          ZOutTxt$ = "Today Downloaded Files: " + STR$(ZDLToday! + ZDownFiles) + _
  57.               "  Bytes:" + STR$(DGSTemp!)                                ' DGS070301-DS
  58.          DGSTemp! = 0                                                    ' DGS071701-DS
  59.          ZSubParm = 5                                                    ' DGS070301-DS
  60.          CALL TPut                                                       ' DGS070301-DS
  61.          CALL SkipLine (1)                                               ' DGS070301-DS
  62.          GOTO 20100                                                      ' DGS070301-DS
  63.       END IF                                                             ' DGS070301-DS
  64.       WasX$ = STR$(Ratio#)
  65.       X = INSTR(WasX$,".")
  66.       IF X > 0 THEN _
  67.          WasX$ = LEFT$(WasX$,X+1)
  68.       ZOutTxt$ = Method$ + " Downloaded:" + STR$(DLWork#) + _
  69.               " Uploaded:" + _
  70.               STR$(ULWork#) + _
  71.               " Ratio:" + _
  72.               WasX$ + _
  73.               RatioSuffix$
  74.       ZSubParm = 5
  75.       CALL TPut
  76. '
  77. '  CHECK TO SEE IF THE USER HAS VIOLATED THEIR UL/DL RESTRICTION
  78. '
  79. 20100 IF NOT (ZRatioRestrict# > 0 AND TellUser) THEN _
  80.          EXIT SUB
  81.       IF ZByteMethod <= 1 THEN _
  82.          GOTO 20105
  83.       IF Today# < 0 THEN                                               ' DGS070301-DS
  84.          ZOutTxt$ = "Sorry, Daily download limit of"                   ' DGS070301-DS
  85.      IF ZBytesToday! < 0 THEN                                      ' DGS070301-DS
  86.           ZOutTxt$ = ZOutTxt$ + STR$(ZRatioRestrict# - ZBytesToday!) ' DGS070301-DS
  87.      ELSE                                                          ' DGS070301-DS
  88.           ZOutTxt$ = ZOutTxt$ + STR$(ZRatioRestrict#)              ' DGS070301-DS
  89.      END IF                                                        ' DGS070301-DS
  90.      ZOutTxt$ = ZOutTxt$  + " " + Method$ + " Reached"             ' DGS070301-DS
  91.          ZOK = ZFalse                                                  ' DGS070301-DS
  92.      ZNumDnldBytes! = 0                                            ' DGS070301-DS
  93.       ELSE ZOutTxt$ = "Download balance:" + _
  94.                 STR$(Today#) + _
  95.                 " " + _
  96.                 Method$                                                ' DGS070301-DS
  97.            ZOK = ZTrue                                                 ' DGS070301-DS
  98.       END IF                                                           ' DGS070301-DS
  99.       ZSubParm = 5
  100.       CALL TPut
  101.       CALL SkipLine(1)
  102.       EXIT SUB
  103. '
  104. 20105 IF Ratio# > ZRatioRestrict# OR ULWork# = 0 THEN _
  105.          ZOK = ZFalse : _
  106.          ZOutTxt$ = "Sorry, DL/UL ratio of" + _
  107.               STR$(ZRatioRestrict#) + _
  108.               ":1 " + _
  109.               Method$ + " exceeded" : _
  110.          ZSubParm = 5 : _
  111.          CALL TPut : _
  112.          ZOutTxt$ = "Minimum upload of" + _
  113.               STR$(INT(((DLWork# - (ULWork# * ZRatioRestrict#)) _
  114.               / ZRatioRestrict#) + 1)) + _
  115.               + " " + Method$ + " required to download" : _            ' DGS070301-DS
  116.           ZDownFiles = 0 _                                         ' DGS070301-DS
  117.       ELSE ZOutTxt$ = "Balance remaining before upload required:" + _
  118.                 STR$(INT((ULWork# * ZRatioRestrict#)-DLWork#)) + _
  119.                 " " + Method$
  120.       ZSubParm = 5
  121.       CALL TPut
  122.       CALL SkipLine (1)
  123. 20110 END SUB
  124.