home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / internet / net commander 1.0 / ISP / SCRPTLST / SCRUZNET.CMD < prev    next >
Encoding:
Text File  |  1996-03-05  |  3.2 KB  |  176 lines

  1. #        Login.cmd for Scruz-Net
  2. #
  3. #    ***     WARNING: YOU MUST DELETE EVERYTHING ABOVE THIS LINE!!     ***
  4. #    ***     Note: You may also need to delete lines from the end of   ***
  5. #    ***           this file                                           ***
  6. ##############################################################################
  7. #
  8. # login.cmd v95.9.28
  9. # Neil Magedman <neil@scruz.net>
  10. # Based loosely on the login.cmd that comes with the standard
  11. # twsk20b.zip package
  12. #
  13.  
  14.  
  15. ###
  16. # Constants
  17. ###
  18.  
  19. $userprompt = "ogin:"
  20. $passprompt = "ssword:"
  21. $your_address_is = "to "
  22.  
  23.  
  24. ###
  25. # Check for first timers...
  26. ###
  27. if ![load $setup_run]
  28.   display \n\nYou must first run the setup script, Dialler|setup.cmd.\n
  29.   display (Go to the "Dialler" menu and select "setup.cmd")\n
  30.   abort
  31. end
  32.  
  33.  
  34.  
  35. ###
  36. # set up some connection variables
  37. ###
  38.  
  39. if (![load $phone_number]) | ($phone_number = "")
  40.   query $phone_number Enter the number to dial
  41. end
  42.  
  43. if (![load $username]) | ($username = "")
  44.   username "Enter your login username"
  45. end
  46.  
  47. if (![load $password]) | ($password = ""
  48. )
  49.   password "Enter your login password"
  50. end
  51.  
  52. if ![load $modeminit]
  53.   $modeminit = "at"
  54. end
  55.  
  56. if ![load %attempts]
  57.   %attempts = 10
  58. end
  59.  
  60.  
  61.  
  62. ###
  63. # Reset (and test) modem
  64. ###
  65.  
  66. output "atz"\r
  67. if ! [input 10 OK\n]
  68.   display "Modem is not responding"\n
  69.   abort
  70. end
  71.  
  72.  
  73.  
  74. ###
  75. # Send initialization string
  76. ###
  77.  
  78. output $modeminit\r
  79. input 10 OK\n
  80.  
  81.  
  82.  
  83. ###
  84. # redial until connected
  85. ###
  86.  
  87. %n = 1
  88. repeat
  89.  
  90.   if %n > %attempts
  91.     display \n\n
  92.     display *** Scruznet maintains a no busy signal policy.\n
  93.     display *** If you are receiving busy signals, please notify Scruznet.\n\n
  94.     abort
  95.   end
  96.  
  97.   # Dial
  98.   display Cycle %n:\n
  99.   if %n > 1
  100.     sleep 3
  101.   end
  102.   outputecho 40 "atdt"$phone_number\r
  103.   read 60 $modem_response
  104.  
  105.   %n = %n + 1
  106. until pos("CONNECT", $modem_response)
  107.  
  108.  
  109.  
  110. ###
  111. # Log in
  112. ###
  113.  
  114. wait 30 dcd             # wait for connection to stabilize
  115. %logged_in = 0          # boolean - are we in?
  116. %failed_logins = 0      # counter - abort after three 
  117. repeat
  118.  
  119.   input 30 $userprompt
  120.   output $username\r
  121.   input 30 $passprompt
  122.   output 
  123. $password
  124.   outputecho \r
  125.  
  126.  
  127.   if [expect 10 "Invalid Login"]
  128.     %failed_logins = %failed_logins + 1
  129.     if %failed_logins = 3
  130.       display \n\n\n\7\7\7*** Wrong name and/or password.  Aborting! ***\n\n\n
  131.       set dtr off
  132.       abort
  133.     end
  134.     repeat
  135.       username "Enter your login username"
  136.     until $username <> ""
  137.     repeat
  138.       password "Enter your login password"
  139.     until $password <> ""
  140.  
  141.   else
  142.     %logged_in = 1
  143.   end
  144.  
  145. until %logged_in
  146.  
  147.  
  148.  
  149. ###
  150. # we are now logged in!!  Yippy Skippy!
  151. # Establish slip/ppp mode
  152. ###
  153.  
  154. if ! %ppp
  155.   input 30 $your_address_is
  156.   address 30
  157. end
  158.  
  159. input 30 begin
  160. online
  161.  
  162.  
  163. display \n\n\7\7\7
  164. display ***************************************************************\n
  165. display Connection established!  You may now run your winsock programs.\n
  166. display ***************************************************************\n\n
  167.  
  168.  
  169. ###
  170. # fin
  171. ###
  172.  
  173.  
  174. ###########################################################################
  175. #    ***     WARNING: YOU MUST DELETE EVERYTHING BELOW THIS LINE!!     ***#