home *** CD-ROM | disk | FTP | other *** search
/ Hacker Chronicles 2 / HACKER2.BIN / 453.NETLOGIN.PAS < prev    next >
Pascal/Delphi Source File  |  1989-10-29  |  6KB  |  250 lines

  1. procedure clear_window(on : boolean);
  2. begin
  3.   if (on) then
  4.             begin
  5.               brite_blanks;
  6.               auxcolor;
  7.             end
  8.           else
  9.             begin
  10.               norm_blanks;
  11.               normcolor;
  12.             end;
  13. end;
  14.  
  15. procedure login;
  16. var i : integer;
  17.     old_x, old_y : integer;
  18.     test_prefix : pre_str;
  19.     test_area : char;
  20.     test_suffix : post_str;
  21.     key : char;
  22.  
  23.  procedure show_call(p : integer; brite : boolean);
  24.  begin
  25.    if NOT (p in [0..13]) then exit;
  26.    if brite = FALSE
  27.    then
  28.      auxcolor
  29.    else
  30.      brite_auxcolor;
  31.    gotoxy(x[p],y[p]);
  32.    case p of
  33.      0 : write(test_suffix:6);
  34.      1..13 : with net_list[call[p]]^ do
  35.                write(Trim(prefix) + area + suffix : 6) ;
  36.      end;
  37.    gotoxy(x[p],y[p]);
  38.  end;
  39.  
  40.   procedure all_ready_logged;
  41.   begin
  42.     window(32,8,79,16);
  43.     textcolor(status_f);
  44.     textbackground(norm_b);
  45.     gotoxy(30,1);
  46.     write('ALREADY LOGGED',#7);
  47.     delay(500);
  48.     gotoxy(30,1);
  49.     ClrEol;
  50.     window(1,1,80,25);
  51.   end;
  52.  
  53.  
  54.   procedure new_call;
  55.   var test_prefix : string[3];
  56.       test_area   : string[1];
  57.       test_name   : string[10];
  58.   begin
  59.     if (new_pntr = max_new) then
  60.     begin
  61.       window(32,8,79,16);
  62.       textcolor(status_f);
  63.       textbackground(status_b);
  64.       gotoxy(30,1); ClrEol; write('No NEW CALL memory left',#7);
  65.       normcolor;
  66.       window(1,1,80,25);
  67.     end
  68.     else
  69.     begin
  70.       window(32,8,79,16);
  71.       Set_Confirm_On;
  72.       test_prefix := '  ';
  73.       sayget(30,1,'Prefix ',test_prefix,_S,2,0);
  74.       picture('@!');
  75.       test_area := ' ';
  76.       sayget(30,2,'Area   ',test_area,_S,1,0);
  77.       picture('9');
  78.       test_name := '          ';
  79.       sayget(30,3,'Name   ',test_name,_S,10,0);
  80.       readgets;
  81.       Set_Confirm_Off;
  82.       normcolor;
  83.       if test_prefix = '  ' then
  84.         begin
  85.           gotoxy(30,1); ClrEol;
  86.           gotoxy(30,2); ClrEol;
  87.           gotoxy(30,3); ClrEol;
  88.           window(1,1,80,25);
  89.           exit;                 { this call is rejected }
  90.         end;
  91.       gotoxy(30,1); ClrEol;
  92.       gotoxy(30,2); ClrEol;
  93.       gotoxy(30,3); ClrEol;
  94.       if (new_there(test_prefix,test_area,test_suffix) = TRUE) then
  95.       begin
  96.         all_ready_logged;
  97.         exit;
  98.       end;
  99.       new_pntr := new_pntr + 1;
  100.       top_pntr := top_pntr + 1;
  101.       with checkins[top_pntr] do
  102.       begin
  103.         list_nbr := 1;
  104.         position := new_pntr;
  105.         hr_min   := copy(SystemTime,1,5);
  106.       end;
  107.       with new_list[new_pntr]^ do
  108.       begin
  109.         prefix    := test_prefix;
  110.         area      := test_area;
  111.         suffix    := test_suffix;
  112.         name      := test_name;
  113.         net_nbr   := 0;
  114.         log_date  := SystemDate;
  115.         xref      := top_pntr;
  116.         ClearRecord;
  117.         with NBase do
  118.         begin
  119.           _PREFIX  := prefix;
  120.           _AREA    := area;
  121.           _SUFFIX  := suffix;
  122.           _NAME    := name;
  123.           _LOGDATE := SystemDate;
  124.         end;
  125.         APPEND;
  126.         recnbr := RecNo;
  127.       end;
  128.       gotoxy(1,1); InsLine;
  129.       write(Trim(test_prefix) + test_area + test_suffix:6);
  130.       if (max_new - new_pntr = 5) then
  131.       begin
  132.         textcolor(status_f);
  133.         textbackground(norm_b);
  134.         gotoxy(25,2); write('Only 5 more new logins');
  135.         gotoxy(25,3); write('allowed.');
  136.       end;
  137.       window(1,1,80,25);
  138.       display_checkin(top_pntr);
  139.       if top_pntr = 1 then top_of_roster;
  140.       update_flag := TRUE;
  141.       status;
  142.     end;
  143.   end;
  144.  
  145.   procedure add_call;
  146.   begin
  147.     if net_list[call[call_count]]^.xref = 0
  148.     then
  149.     begin
  150.       top_pntr := top_pntr + 1;
  151.       with checkins[top_pntr] do
  152.       begin
  153.         list_nbr := 0;
  154.         position := call[call_count];
  155.         hr_min   := copy(SystemTime,1,5);
  156.         net_list[position]^.xref := top_pntr;
  157.         window(32,8,79,16);
  158.         normcolor;
  159.         gotoxy(1,1); InsLine;
  160.         with net_list[position]^ do
  161.         begin
  162.           write((Trim(prefix) + area + suffix):6,' ',name:10);
  163.           if (net_nbr <> 0) then
  164.             write(net_nbr:5);
  165.         end;
  166.         window(1,1,80,25);
  167.       end;
  168.       display_checkin(top_pntr);
  169.       if top_pntr = 1 then top_of_roster;
  170.       update_flag := TRUE;
  171.       status;
  172.     end
  173.     else
  174.       all_ready_logged;
  175.   end;
  176.  
  177. begin
  178.   old_x := WhereX; old_y := WhereY;
  179.   window(32,8,79,16);
  180.   normcolor;
  181.   ClrScr;
  182.   window(1,1,80,25);
  183. repeat
  184.   test_suffix := '   ';
  185.   clear_window(true);
  186.   sayget(x[0],y[0],'',test_suffix,_S,3,0);
  187.   picture('@!');
  188.   readgets;
  189.   if (test_suffix <> '   ') then
  190.   begin
  191.     gotoxy(32,2);
  192.     textcolor(status_f);
  193.     textbackground(border_b);
  194.     write('NuCall');
  195.     find_call(test_suffix);
  196.     show_call(0,FALSE);
  197.     key := #0;
  198.     if multiple > 0
  199.     then
  200.       begin
  201.         for call_count := 1 to multiple do
  202.           show_call(call_count,FALSE);
  203.         gotoxy(x[first],y[first]);
  204.         call_count := first;
  205.         show_call(first,TRUE);
  206.         repeat
  207.           key := readkey;
  208.           if key = #0 then
  209.             begin
  210.               key := readkey;
  211.               case key of
  212.                 #77 : { -> } begin
  213.                       if call_count < multiple then
  214.                       begin
  215.                         show_call(call_count, FALSE);
  216.                         call_count := call_count + 1;
  217.                         show_call(call_count,TRUE);
  218.                       end;
  219.                     end;
  220.                  #75 : { <- }
  221.                      begin
  222.                        if call_count > 0 then
  223.                        begin
  224.                          show_call(call_count,FALSE);
  225.                          call_count := call_count - 1;
  226.                          show_call(call_count,TRUE);
  227.                        end;
  228.                      end;
  229.                  end;
  230.                  key := #0;
  231.             end;
  232.       until (key in [#13,#27]);
  233.       end;
  234.   end;
  235.   if key <> #27 then
  236.     begin
  237.       if test_suffix > '   ' then
  238.         if (call_count = 0) OR (multiple = 0)
  239.           then new_call
  240.           else add_call;
  241.     end;
  242.   textcolor(border_f);
  243.   textbackground(border_b);
  244.   gotoxy(32,2);
  245.   write('SUFFIX');
  246. until (test_suffix = '   ');
  247.   clear_window(false);
  248.   gotoxy(old_x,old_y);
  249. end;
  250.