home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / f / faq-s.zip / MAINMENU.PAS < prev    next >
Pascal/Delphi Source File  |  1991-05-04  |  77KB  |  2,732 lines

  1. {$R-,S-,I-,D-,F+,V-,B-,N-,L+ }
  2. {$M 65500,0,0 }
  3.  
  4. unit mainmenu;
  5.  
  6. interface
  7.  
  8. uses crt,dos,
  9.      gentypes,configrt,statret,textret,userret,mailret,modem,
  10.      gensubs,subs1,subs2,subs3,windows,chatstuf,mainr1,mainr2,overret1;
  11.  
  12. var userqr,userlistqr:integer;
  13.     u,uu:userrec;
  14.     totalused,totalidle,totalup,totaldown,totalmins,callsday,
  15.     totaldisk,totalfree,filesizes,x,y,z:real;
  16.     a,b,c:integer;
  17.     totalfiles:integer;
  18.     dofiles:boolean;
  19.  
  20. function ansiyn (str:string):boolean;
  21. procedure calcuserqr;
  22. procedure calcuserlistqr;
  23. procedure editusers;
  24. procedure zapspecifiedusers;
  25. procedure summonsysop;
  26. procedure offfaq;
  27. procedure listusers;
  28. procedure transfername;
  29. procedure editnews;
  30. procedure delerrlog;
  31. procedure feedback;
  32. procedure settime;
  33. procedure changepwd;
  34. procedure requestraise;
  35. procedure makeuser;
  36. procedure infoformhunt;
  37. procedure donations;
  38. procedure viewsyslog;
  39. procedure delsyslog;
  40. procedure changecon (con:char);
  41. procedure showsystemstatus;
  42. procedure showallforms;
  43. procedure showallsysops;
  44. procedure bbslist;
  45. procedure searchphone;
  46. procedure timebank;
  47. {procedure modifycon;}
  48. procedure readerrlog;
  49. procedure showad;
  50. procedure setlastcall;
  51. procedure removeallforms;
  52. procedure readfeedback;
  53. procedure yourstatus;
  54. procedure topposter;
  55. procedure spacespace (i:integer);
  56.  
  57. implementation
  58.  
  59. function ansiyn (str:string):boolean;
  60. var b:boolean;
  61.     c:char;
  62.     str2:string;
  63.     i,ii:integer;
  64.  
  65. begin
  66. ii:=wherey;
  67. i:=2;
  68. repeat
  69. str2:=str+'? ';
  70. printxy2 (1,ii,^P+str2);
  71. printxy2 (length(str2)+1,ii,^R+'Yes');
  72. printxy2 (length(str2)+6,ii,^R+'No');
  73. if i=1 then begin
  74. ansicolor (31);
  75. printxy2 (length(str2)+1,ii,'Yes');
  76. end;
  77. if i=2 then begin
  78. ansicolor (31);
  79. printxy2 (length(str2)+6,ii,'No');
  80. end;
  81. c:=upcase(readkey);
  82. if c='Y' then i:=1;
  83. if c='N' then i:=2;
  84. if c=#13 then begin
  85. case i of
  86.   1:b:=true;
  87.   2:b:=false;
  88.  end;
  89. end;
  90. until (c=#13);
  91. ansiyn:=b;
  92. end;
  93.  
  94. procedure calcuserqr;
  95. begin
  96.  with u do begin
  97.   userqr := qrmultifactor*(u.uploads+u.nbu)-u.downloads;
  98.  end;
  99. end;
  100.  
  101. procedure calcuserlistqr;
  102. begin
  103.  with uu do begin
  104.   userlistqr := qrmultifactor*(uu.uploads+uu.nbu)-uu.downloads;
  105.  end;
  106. end;
  107.  
  108. procedure editusers;
  109. var eunum:integer;
  110.     matched:boolean;
  111.  
  112.   procedure elistusers (getspecs:boolean);
  113.   var cnt,f,l:integer;
  114.       us:userspecsrec;
  115.  
  116.     procedure listuser;
  117.     begin
  118.       write (cnt:4,' ');
  119.       tab (u.handle,31);
  120.       write (u.level:6,' ');
  121.       if useqr then begin
  122.        calcuserqr;
  123.        tab (strr(userqr),8);
  124.       end;
  125.       writeln (u.nbu:6,u.numon:6,postcallratio(u):7:2)
  126.     end;
  127.  
  128.   begin
  129.     if getspecs
  130.       then if selectspecs(us)
  131.         then exit
  132.         else
  133.           begin
  134.             f:=1;
  135.             l:=numusers
  136.           end
  137.       else parserange (numusers,f,l);
  138.     seek (ufile,f);
  139.     matched:=false;
  140.     write (^B^M^M' ID# Name                            Level ');
  141.     if useqr then write ('QR         ');
  142.     writeln ('Posts Calls PCR');
  143.     for cnt:=f to l do begin
  144.       read (ufile,u);
  145.       if (not getspecs) or fitsspecs(u,us) then begin
  146.         listuser;
  147.         matched:=true
  148.       end;
  149.       handleincoming;
  150.       if break then exit
  151.     end;
  152.     if not matched then
  153.       if getspecs
  154.         then writeln (^B^M'No users match specifications!')
  155.         else writeln (^B^M'No users found in that range!')
  156.   end;
  157.  
  158. begin
  159.   repeat
  160.     writestr (^M'[User to Edit] [?,??/List]:');
  161.     if (length(input)=0) or (match(input,'Q')) then exit;
  162.     if input[1]='?'
  163.       then elistusers (input='??')
  164.       else begin
  165.         eunum:=lookupuser (input);
  166.         if eunum=0
  167.           then writestr ('User not found!')
  168.           else edituser (eunum)
  169.       end
  170.   until hungupon
  171. end;
  172.  
  173. procedure zapspecifiedusers;
  174. var us:userspecsrec;
  175.     confirm:boolean;
  176.     u:userrec;
  177.     cnt:integer;
  178.     done:boolean;
  179. begin
  180.   if selectspecs (us) then exit;
  181.   writestr ('Confirm each deletion individually? [y/n]: *');
  182.   if length(input)=0 then exit;
  183.   confirm:=yes;
  184.   if not confirm then begin
  185.     writestr (^M'Confirm each users? [y/n]: *');
  186.     if not yes then exit
  187.   end;
  188.   for cnt:=1 to numusers do begin
  189.     seek (ufile,cnt);
  190.     read (ufile,u);
  191.     if (length(u.handle)>0) and fitsspecs (u,us) then begin
  192.       if confirm
  193.         then
  194.           begin
  195.             done:=false;
  196.             repeat
  197.               writestr ('Delete '+u.handle+' [Y/N/X/E]: ');
  198.               if length(input)>0 then case upcase(input[1]) of
  199.                 'Y':begin
  200.                       done:=true;
  201.                       writeln ('[Deleting '+u.handle+']');
  202.                       deleteuser (cnt)
  203.                     end;
  204.                 'N':done:=true;
  205.                 'X':exit;
  206.                 'E':begin
  207.                       edituser(cnt);
  208.                       writeln;
  209.                       writeln
  210.                     end
  211.               end
  212.             until done
  213.           end
  214.         else
  215.           begin
  216.             writeln ('[Deleting '+u.handle+']');
  217.             if break then begin
  218.               writestr ('Aborted!');
  219.               exit
  220.             end;
  221.             deleteuser (cnt)
  222.           end
  223.     end
  224.   end
  225. end;
  226.  
  227. procedure summonsysop;
  228. var tf:text;
  229.    cnt:integer;
  230.      k:char;
  231. begin
  232.   chatmode:=not chatmode;
  233.   bottomline;
  234.   if chatmode
  235.     then
  236.       if sysopisavail
  237.         then
  238.           begin
  239.             writehdr ('Page '+sysopname);
  240.             writestr ('Enter a reason to chat: &');
  241.             chatreason:=input;
  242.             if length(input)=0 then begin
  243.               chatmode:=false;
  244.               exit
  245.             end;
  246.             writelog (1,3,chatreason);
  247.             if not sblaster then begin
  248.             assign (tf,textfiledir+'Chatcall');
  249.             reset (tf);
  250.             if ioresult=0 then begin
  251.               while (not (eof(tf) or hungupon)) and chatmode do
  252.                 begin
  253.                   read (tf,k);
  254.                   nobreak:=true;
  255.                   if ord(k)=7 then summonbeep else writechar (k);
  256.                   if keyhit then begin
  257.                     k:=bioskey;
  258.                     clearbreak;
  259.                     chat1 (false)
  260.                   end
  261.                 end;
  262.               textclose (tf)
  263.             end;
  264.            end else begin
  265.   soundblaster ('CHATCALL.VOC');
  266.   end;
  267.   {nosound;
  268.   write (^P'[');
  269.   for cnt:=1 to 25 do begin
  270.   write(^G^G^G^G^G^G^G^G^S'.'); delay (50);
  271.   if keyhit then begin
  272.      k:=bioskey;
  273.      clearbreak;
  274.      chat1 (false);
  275.      end end; writeln(^P']');
  276.   nosound; end;}
  277.             if chatmode
  278.               then writestr ('Use [C] again to turn off page.')
  279.               else unsplit
  280.           end
  281.         else
  282.           begin
  283.             if length(notavailstr)=0 then
  284.             writestr ('Sorry, '+sysopname+
  285.                       ' isn''t available right now!') else
  286.             writeln (notavailstr);
  287.             chatmode:=false;
  288.             writelog (1,2,'')
  289.           end
  290.     else writestr ('Page off.  Use [C] to turn it back on.');
  291.   clearbreak
  292. end;
  293.  
  294. {procedure offfaq;
  295. var q,n:integer;
  296.     tn:file of integer;
  297.     yesno:boolean;
  298.     m:message;
  299. begin
  300.   writehdr ('Log off BBS');
  301.   yesno:=ansiyn (^P'Log off '^R+longname+^P);
  302.   if yesno then begin
  303.     if ulvl<msgnextlvl then begin
  304.       if exist (textfiledir+'GoodBye') then;
  305.       printfile (textfiledir+'GoodBye');
  306.      disconnect;
  307.      end;
  308.     yesno:=ansiyn (^P'Leave a message to the next user');
  309.     if yesno then begin
  310.       titlestr:='Auto-Message';
  311.       sendstr:='Next User';
  312.       q:=editor(m,false,'Auto-Message');
  313.       sendstr:='';
  314.       if q>=0 then begin
  315.         if tonext>=0 then deletetext (tonext);
  316.         tonext:=q;
  317.         writestatus
  318.       end
  319.     end;
  320.     printfile (textfiledir+'Goodbye');
  321.     disconnect;
  322.   end
  323. end;}
  324.  
  325. procedure offfaq;
  326. var q,n:integer;
  327.     tn:file of integer;
  328.     m:message;
  329. begin
  330.   writehdr ('Log off BBS');
  331.   writestr ('Log off '^R+longname+^P'? [y/n]: *');
  332.   if yes then begin
  333.     if ulvl<msgnextlvl then begin
  334.       if exist (textfiledir+'GoodBye') then;
  335.       printfile (textfiledir+'GoodBye');
  336.      disconnect;
  337.      end;
  338.     writestr (^S'Leave a message to the next user? *');
  339.     if yes then begin
  340.       titlestr:='Auto-Message';
  341.       sendstr:='Next User';
  342.       q:=editor(m,false,'Auto-Message');
  343.       sendstr:='';
  344.       if q>=0 then begin
  345.         if tonext>=0 then deletetext (tonext);
  346.         tonext:=q;
  347.         writestatus
  348.       end
  349.     end;
  350.     printfile (textfiledir+'Goodbye');
  351.     disconnect;
  352.   end
  353. end;
  354.  
  355. procedure listusers;
  356. var cnt,u1,u2:integer;
  357. begin
  358.   if ulvl<listuserlvl then begin
  359.    reqlevel (listuserlvl);
  360.    exit;
  361.   end;
  362.   writehdr ('List Users');
  363.   parserange (numusers,u1,u2);
  364.   if u1=0 then exit;
  365.   write (^B^P'['^S'Name'^P']                           ['^S'Level'^P'] ['^S'Note'^P']');
  366.   if useqr then writeln (^P'                          ['^S'QR'^P']  ')
  367.   else writeln;
  368.   if break then exit;
  369.   if asciigraphics in urec.config then
  370.    write (^B^R'───────────────────────────────────────────────') else
  371.    write (^B^R'-----------------------------------------------');
  372.   if (useqr) then begin
  373.    if asciigraphics in urec.config then
  374.     write (^B^R'────────────────────────────────') else
  375.     write (^B^R'--------------------------------');
  376.   end;
  377.   writeln;
  378.   if break then exit;
  379.   for cnt:=u1 to u2 do
  380.     begin
  381.       seek (ufile,cnt);
  382.       read (ufile,uu);
  383.       che;
  384.       if length(uu.handle)>0 then begin
  385.         periods:=false;
  386.         write (^P'['^S);
  387.         tab (uu.handle,30);
  388.         if break then exit;
  389.         write (^P'] ['^S);
  390.         periods:=false;
  391.         tab (strr(uu.level),5);
  392.         if break then exit;
  393.         write (^P'] ['^S);
  394.         periods:=false;
  395.         tab (uu.note,29);
  396.         write (^P']');
  397.         if break then exit;
  398.         if useqr then begin
  399.          calcuserlistqr;
  400.          write (^P' ['^S);
  401.          tab (strr(userlistqr),4);
  402.          write (^P']');
  403.          if break then exit;
  404.         end;
  405.        writeln;
  406.       end
  407.     end
  408. end;
  409.  
  410. procedure transfername;
  411. var un,nlvl,ntime,tmp:integer;
  412.     u:userrec;
  413.     qaz:lstr;
  414. begin
  415.   writehdr ('Transfer User');
  416.   if tempsysop then begin
  417.     writeln (usr,'(Disabling Temporary Sysop Access)');
  418.     ulvl:=regularlevel;
  419.     tempsysop:=false
  420.   end;
  421.   writestr ('User to transfer to:');
  422.   if length(input)=0 then exit;
  423.   un:=lookupuser(input);
  424.   if unum=un then begin
  425.     writestr ('That would be a waste of CPU time...');
  426.     exit;
  427.    end;
  428.   if un=0 then begin
  429.     writestr ('No such user.');
  430.     exit
  431.   end;
  432.   seek (ufile,un);
  433.   read (ufile,u);
  434.   if ulvl<sysoplevel then if not checkpassword(u) then begin
  435.     writelog (1,5,u.handle);
  436.     exit
  437.   end;
  438.   writelog (1,4,u.handle);
  439.   updateuserstats (false);
  440.   ntime:=0;
  441.   if datepart(u.laston)<>datepart(now) then begin
  442.     tmp:=ulvl;
  443.     if tmp<1 then tmp:=1;
  444.     if tmp>100 then tmp:=100;
  445.     ntime:=usertime[tmp]
  446.   end;
  447.   if u.timetoday<10
  448.     then if issysop or (u.level>=sysoplevel)
  449.       then
  450.         begin
  451.           writestr ('The user has '+strr(u.timetoday)+' min(s) left!');
  452.           writestr ('New time left:');
  453.           ntime:=valu(input)
  454.         end
  455.       else
  456.         if u.timetoday>0
  457.       then writeln (^P'WARNING:'^R' You have ',u.timetoday,' minutes left!')
  458.           else
  459.             begin
  460.               writestr ('Sorry, that user doesn''t have any time left!');
  461.               exit
  462.             end;
  463.   unum:=un;
  464.   readurec;
  465.   if ntime<>0 then begin
  466.     urec.timetoday:=ntime;
  467.     writeurec
  468.   end;
  469. end;
  470.  
  471.  
  472. Procedure editnews;
  473.   Var nn,numnews:Integer;
  474.     nf:File Of newsrec;
  475.     News:newsrec;
  476.   Procedure getnn(txt:mstr);
  477.     Begin
  478.       writestr(^S+'News number to '+^R+txt+^S+':');
  479.       nn:=valu(Input);
  480.       If (nn<1) Or (nn>numnews) Then nn:=0
  481.     End;
  482.  
  483.   Procedure delnews;
  484.     Var cnt:Integer;
  485.       r:Integer;
  486.       NTmp:newsrec;
  487.     Begin
  488.       If nn=0 Then getnn('delete');
  489.       If nn<>0 Then Begin
  490.         Seek(nf,nn-1);
  491.         Read(nf,Ntmp);che;
  492.         deletetext(Ntmp.Location);
  493.         numnews:=FileSize(nf)-1;
  494.         For cnt:=nn To numnews Do
  495.           Begin
  496.             Seek(nf,cnt);
  497.             Read(nf,nTmp);
  498.             Seek(nf,cnt-1);
  499.             Write(nf,Ntmp)
  500.           End;
  501.         Seek(nf,numnews);
  502.         Truncate(nf)
  503.       End
  504.     End;
  505.  
  506.   Procedure listnews;
  507.     Var cnt:Integer;
  508.       r,sector:Integer;
  509.       q:buffer;
  510.       l:anystr;
  511.       k:Char;
  512.       Ntmp:newsrec;
  513.     Begin
  514.       clearbreak;
  515.       WriteLn (^S'  News    Min    Max          Title ');
  516.       WriteLn (^S' Number  Level  Level');
  517.       WriteLn;
  518.  
  519.       For cnt:=1 To numnews Do Begin
  520.         Seek(nf,cnt-1);
  521.         Read(nf,ntmp);
  522.         r:=ntmp.location;
  523.         Seek(tfile,r);
  524.         Read(tfile,q);
  525.  
  526.         Write( Cnt:5 , '    ' , ntmp.level:5,'  ',ntmp.maxlevel:5, ' ');
  527.         r:=1;
  528.         k:=' ';
  529.         l:='';
  530.         Writeln (ntmp.title);
  531. {        While (Ord(k)<>13) And Not hungupon Do Begin
  532.           k:=q[r];
  533.           r:=r+1;
  534.           If (k=#0) Or (r>sectorsize) Then k:=Chr(13);
  535.           l:=l+k
  536.         End;
  537.         Write(l);}
  538.         If break Then exit
  539.       End;
  540. {      WriteLn                }
  541.     End;
  542.  
  543.   Procedure viewnews;
  544.     Var r:Integer;
  545.       Ntmp:newsrec;
  546.     Begin
  547.       If nn=0 Then getnn('view');
  548.       If nn<>0 Then Begin
  549.         Seek(nf,nn-1);
  550.         Read(nf,nTmp);che;
  551.         r:=ntmp.location;
  552.         WriteLn(^M'News #',nn,' ''',ntmp.title,''' From :',ntmp.from);
  553.         WriteLn('Date: ',Datestr(ntmp.when),' Level [',ntmp.level,'-',ntmp.maxlevel,']');
  554.         printtext(r)
  555.       End
  556.     End;
  557.  
  558.  
  559.   Procedure adddnews;
  560.     Begin
  561.       Close(nf);
  562.       addnews;
  563.       Assign(nf,bbsdatadir+'News.dat');
  564.       Reset(nf)
  565.     End;
  566.  
  567.   Var q:Integer;
  568.   Begin
  569.     Assign(nf,bbsdatadir+'News.dat');
  570.     Reset(nf);
  571.     writehdr ('New Edit');
  572.     If IOResult<>0 Then writestr('No news!  Use [A] to add some!') Else Begin
  573.       Repeat
  574.         numnews:=FileSize(nf);
  575.         Write(^B^M'News entries: ',numnews);
  576.         q:=menu ('News Edit','NEWS','ADLVQ?');
  577.         nn:=valu(Copy(Input,2,255));
  578.         If (nn<1) Or (nn>numnews) Then nn:=0;
  579.         Case q Of
  580.           1:adddnews;
  581.           2:delnews;
  582.           3:listnews;
  583.           4:viewnews;
  584.           6:begin
  585. writeln ('C╔═════════════════════════════════════╗Hs');
  586. writeln ('uC║ News Section                        ║Hs');
  587. writeln ('uC╚═════════════════════════════════════╝HHC╔════s');
  588. writeln ('u═════════════════════════════════╗HC║ [A]  s');
  589. writeln ('uAdd News                       ║HC║ [Ds');
  590. writeln ('u]  Delete News                    ║HC║ [s');
  591. writeln ('uL]  List News                      ║Hs');
  592. writeln ('uC║ [Q]  Quit                           s');
  593. writeln ('u║HC║ [V]  View News               s');
  594. writeln ('u       ║HC║ [?]  View This Menu   s');
  595. writeln ('u              ║HC╚═══════════════════════════════A');
  596. writeln ('C══════╝');
  597. writeln;
  598. pause;
  599.            end;
  600.         End;
  601.         If numnews=0 Then Begin
  602.           Close(nf);
  603.           Erase(nf);
  604.           q:=5
  605.         End
  606.       Until (q=5) Or hungupon
  607.     End;
  608.     Close(nf)
  609.   End;
  610.  
  611.  
  612. {procedure editnews;
  613. var nn,numnews:integer;
  614.     nf:file of integer;
  615.  
  616.   procedure getnn (txt:mstr);
  617.   begin
  618.     writestr ('News number to '+txt+':');
  619.     nn:=valu(input);
  620.     if (nn<1) or (nn>numnews) then nn:=0
  621.   end;
  622.  
  623.   procedure delnews;
  624.   var cnt:integer;
  625.       r:integer;
  626.   begin
  627.     if nn=0 then getnn ('delete');
  628.     if nn<>0 then begin
  629.       seek (nf,nn-1);
  630.       read (nf,r); che;
  631.       deletetext (r);
  632.       numnews:=filesize(nf)-1;
  633.       for cnt:=nn to numnews do
  634.         begin
  635.           seek (nf,cnt);
  636.           read (nf,r);
  637.           seek (nf,cnt-1);
  638.           write (nf,r)
  639.         end;
  640.       seek (nf,numnews);
  641.       truncate (nf)
  642.     end
  643.   end;
  644.  
  645.   procedure listnews;
  646.   var cnt:integer;
  647.       r,sector:integer;
  648.       q:buffer;
  649.       l:anystr;
  650.       k:char;
  651.   begin
  652.     clearbreak;
  653.     for cnt:=1 to numnews do begin
  654.       seek (nf,cnt-1);
  655.       read (nf,r);
  656.       seek (tfile,r);
  657.       read (tfile,q);
  658.       write (strr(cnt)+'. ');
  659.       r:=1;
  660.       k:=' ';
  661.       l:='';
  662.       while (ord(k)<>13) and not hungupon do begin
  663.         k:=q[r];
  664.         r:=r+1;
  665.         if (k=#0) or (r>sectorsize) then k:=chr(13);
  666.         l:=l+k
  667.       end;
  668.       writeln (l);
  669.       if break then exit
  670.     end;
  671.     writeln
  672.   end;
  673.  
  674.   procedure viewnews;
  675.   var r:integer;
  676.   begin
  677.     if nn=0 then getnn ('view');
  678.     if nn<>0 then begin
  679.       seek (nf,nn-1);
  680.       read (nf,r); che;
  681.       printtext (r)
  682.     end
  683.   end;
  684.  
  685.   procedure adddnews;
  686.   begin
  687.     addnews;
  688.     assign (nf,bbsdatadir+'News.dat');
  689.     close (nf);
  690.     reset (nf)
  691.   end;
  692.  
  693. var q:integer;
  694. begin
  695.   assign (nf,bbsdatadir+'News.dat');
  696.   reset (nf);
  697.   if ioresult<>0 then writestr ('No news!  Use [A] to add some!') else begin
  698.     repeat
  699.       numnews:=filesize(nf);
  700.       write (^B^M'News entries: ',numnews);
  701.       q:=menu ('News Edit','NEWS','ADLVQ?');
  702.       nn:=valu(copy(input,2,255));
  703.       if (nn<1) or (nn>numnews) then nn:=0;
  704.       case q of
  705.         1:adddnews;
  706.         2:delnews;
  707.         3:listnews;
  708.         4:viewnews
  709.         6:begin
  710. writeln ('C╔═════════════════════════════════════╗Hs');
  711. writeln ('uC║ News Section                        ║Hs');
  712. writeln ('uC╚═════════════════════════════════════╝HHC╔════s');
  713. writeln ('u═════════════════════════════════╗HC║ [A]  s');
  714. writeln ('uAdd News                       ║HC║ [Ds');
  715. writeln ('u]  Delete News                    ║HC║ [s');
  716. writeln ('uL]  List News                      ║Hs');
  717. writeln ('uC║ [Q]  Quit                           s');
  718. writeln ('u║HC║ [V]  View News               s');
  719. writeln ('u       ║HC║ [?]  View This Menu   s');
  720. writeln ('u              ║HC╚═══════════════════════════════A');
  721. writeln ('C══════╝');
  722. writeln;
  723. pause;
  724.            end;
  725.       end;
  726.       if numnews=0 then begin
  727.         close (nf);
  728.         erase (nf);
  729.         writestr ('No more news!  Use [A] to add some.');
  730.         q:=5
  731.       end
  732.     until (q=5) or hungupon
  733.   end;
  734.   close (nf)
  735. end; }
  736.  
  737. procedure delerrlog;
  738. var e:text;
  739.     i:integer;
  740. begin
  741.   writehdr ('Delete Error Log');
  742.   writestr ('Delete Error Log [y/n]:');
  743.   if not yes then exit;
  744.   assign (e,bbsdatadir+'errlog.dat');
  745.   reset (e);
  746.   i:=ioresult;
  747.   if ioresult=1
  748.     then writeln (^M'No error log!')
  749.     else begin
  750.       textclose (e);
  751.       erase (e);
  752.       writestr ('Error log deleted.');
  753.       if ioresult>1
  754.         then writeln ('I/O error ',i,' deleting error log!');
  755.       writelog (2,2,'')
  756.     end
  757. end;
  758.  
  759. procedure feedback;
  760. var m:mailrec;
  761.     me:message;
  762. begin
  763.   writehdr ('Feedback');
  764.   writestr ('Leave Feedback to '+sysopname+' [y/n]: *');
  765.   if not yes then exit;
  766.   sendstr:='Sysop';
  767.   m.line:=editor(me,false,'Feedback');
  768.   if m.line<0 then exit;
  769.   m.title:=me.title;
  770.   m.sentby:=unam;
  771.   m.anon:=false;
  772.   m.when:=now;
  773.   addfeedback (m);
  774.   writestr ('Feedback sent.')
  775. end;
  776.  
  777. procedure settime;
  778. var t:integer;
  779.     n:longint;
  780.     r:registers;
  781.     d:datetime;
  782. begin
  783.   writehdr ('Set Date/Time');
  784.   writestr ('Current Time: '+timestr(now));
  785.   writestr ('Current Date: '+datestr(now));
  786.   writestr ('Enter new time:');
  787.   if length(input)<>0
  788.     then begin
  789.       t:=timeleft;
  790.       unpacktime (timeval(input),d);
  791.       r.ch:=d.hour;
  792.       r.cl:=d.min;
  793.       r.dh:=0;
  794.       r.dl:=0;
  795.       r.ah:=$2d;
  796.       intr ($21,r);
  797.       if r.al=$ff then writestr ('Invalid time!');
  798.       settimeleft (t)
  799.     end;
  800.   writestr ('Enter new date:');
  801.   if length(input)<>0
  802.     then begin
  803.       unpacktime (dateval(input),d);
  804.       r.dl:=d.day;
  805.       r.dh:=d.month;
  806.       r.cx:=d.year;
  807.       r.ah:=$2b;
  808.       intr ($21,r);
  809.       if r.al=$ff then writestr ('Invalid date!')
  810.     end;
  811.   writelog (2,4,'')
  812. end;
  813.  
  814. procedure changepwd;
  815. var t:sstr;
  816. begin
  817.   buflen:=15;
  818.   echodot:=true;
  819.   write ('Choose your new password now - Return/have one generated: ');
  820.   if getpassword
  821.     then begin
  822.       echodot:=false;
  823.       writeurec;
  824.       writestr ('Password changed.');
  825.       writelog (1,1,'')
  826.     end else begin
  827.       echodot:=false;
  828.       writestr ('No change.');
  829.  end;
  830. end;
  831.  
  832. procedure requestraise;
  833. var t:text;
  834.     q:lstr;
  835.     p,l1,l2:integer;
  836.     s1,s2:sstr;
  837.     me:message;
  838.     m:mailrec;
  839. label nope,found;
  840. begin
  841.   assign (t,textfiledir+'Raisereq');
  842.   reset (t);
  843.   if ioresult<>0 then goto nope;
  844.   printtexttopoint (t);
  845.   while not eof(t) do begin
  846.     readln (t,q);
  847.     p:=pos('-',q);
  848.     if p>0
  849.       then
  850.         begin
  851.           s1:=copy(q,1,p-1);
  852.           s2:=copy(q,p+1,255)
  853.         end
  854.       else
  855.         begin
  856.           s1:=copy(q,1,15);
  857.           s2:=s1
  858.         end;
  859.     val (s1,l1,p);
  860.     if p=0 then val (s2,l2,p);
  861.     if p<>0 then begin
  862.       textclose (t);
  863.       error ('Invalid range in RAISEREQ: %1','',q);
  864.       exit
  865.     end;
  866.     if (ulvl>=l1) and (ulvl<=l2) then goto found;
  867.     skiptopoint (t)
  868.   end;
  869.   nope:
  870.   error ('No text for level %1','',strr(ulvl));
  871.   textclose (t);
  872.   p:=ioresult;
  873.   exit;
  874.   found:
  875.   printtexttopoint (t);
  876.   textclose (t);
  877.   if hungupon then exit;
  878.   titlestr:='Raise Request';
  879.   pause;
  880.   sendstr:='Sysop';
  881.   m.line:=editor (me,false,'Raise Request');
  882.   sendstr:='';
  883.   if m.line<0 then exit;
  884.   m.anon:=false;
  885.   m.title:='Raise Request (Now Level '+strr(ulvl)+')';
  886.   m.sentby:=unam;
  887.   m.when:=now;
  888.   addfeedback (m);
  889. end;
  890.  
  891. procedure makeuser;
  892. var u:userrec;
  893.     i,un,ln:integer;
  894. begin
  895.   writehdr ('Add a User');
  896.   writestr ('Name:');
  897.   if length(input)=0 then exit;
  898.   if lookupuser(input)<>0 then begin
  899.     writestr ('Sorry!  Already exists!');
  900.     exit
  901.   end;
  902.   u.handle:=input;
  903.   writestr ('Password:');
  904.   u.password:=input;
  905.   writestr ('Level:');
  906.   if length(input)=0 then exit;
  907.   u.level:=valu(input);
  908.   u.note:=newusernote;
  909.   for i:=1 to 5 do begin
  910.   u.defcon[i]:=defconfm[i];
  911.   u.defcon[i+5]:=defconfx[i];
  912.   end;
  913.   un:=adduser(u);
  914.   if un=-1 then begin
  915.     writestr ('Sorry, no room for new users!');
  916.     exit
  917.   end;
  918.   ln:=u.level;
  919.   if ln<1 then ln:=1;
  920.   if ln>100 then ln:=100;
  921.   u.timetoday:=usertime[ln];
  922.   writeufile (u,un);
  923.   writestr ('User added as #'+strr(un)+'.');
  924.   writelog (2,8,u.handle)
  925. end;
  926.  
  927. procedure infoformhunt;
  928. begin
  929.   writestr ('User to search for [CR/All users]:');
  930.   writeln (^M);
  931.   showinfoforms (input)
  932. end;
  933.  
  934. procedure donations;
  935. var fn:lstr;
  936. begin
  937.   writehdr ('Donations');
  938.   fn:=textfiledir+'Donation';
  939.   if exist (fn)
  940.     then printfile (fn)
  941.     else begin
  942.       writestr ('I''m sorry, no information is currently available.');
  943.       if issysop
  944.         then writestr (
  945. 'Sysop:  To create donation information text, make a file called '+fn)
  946.     end
  947. end;
  948.  
  949. procedure viewsyslog;
  950. var n:integer;
  951.     l:logrec;
  952.  
  953.   function lookupsyslogdat (m,s:integer):integer;
  954.   var cnt:integer;
  955.   begin
  956.     for cnt:=1 to numsyslogdat do with syslogdat[cnt] do
  957.       if (menu=m) and (subcommand=s) then begin
  958.         lookupsyslogdat:=cnt;
  959.         exit
  960.       end;
  961.     lookupsyslogdat:=0
  962.   end;
  963.  
  964.   function firstentry:boolean;
  965.   begin
  966.     firstentry:=(l.menu=0) and (l.subcommand in [1..2])
  967.   end;
  968.  
  969.   procedure backup;
  970.   begin
  971.     while n<>0 do begin
  972.       n:=n-1;
  973.       seek (logfile,n);
  974.       read (logfile,l);
  975.       if firstentry then exit
  976.     end;
  977.     n:=-1
  978.   end;
  979.  
  980.   procedure showentry (includedate:boolean);
  981.   var q:lstr;
  982.       p:integer;
  983.   begin
  984.     q:=syslogdat[lookupsyslogdat(l.menu,l.subcommand)].text;
  985.     p:=pos('%',q);
  986.     if p<>0 then q:=copy(q,1,p-1)+l.param+copy(q,p+1,255);
  987.     if includedate then q:=q+' on '+datestr(l.when);
  988.  
  989.     q:=timestr(l.when)+' - '+q;
  990.     writeln (q)
  991.   end;
  992.  
  993. var b:boolean;
  994. begin
  995.   writehdr ('View System Log');
  996.   writeln ('Press [Space] to advance to the previous caller, [X] to abort.');
  997.   writeln;
  998.   writelog (2,6,'');
  999.   n:=filesize(logfile);
  1000.   repeat
  1001.     clearbreak;
  1002.     writeln (^M);
  1003.     backup;
  1004.     if n=-1 then exit;
  1005.     seek (logfile,n);
  1006.     read (logfile,l);
  1007.     showentry (true);
  1008.     b:=false;
  1009.     while not (eof(logfile) or break or xpressed or b) do begin
  1010.       read (logfile,l);
  1011.       b:=firstentry;
  1012.       if not b then showentry (false);
  1013.     end
  1014.   until xpressed
  1015. end;
  1016.  
  1017. procedure delsyslog;
  1018. begin
  1019.   writehdr ('Delete System Log');
  1020.   writestr ('Delete the System Log [y/n]:');
  1021.   if not yes then exit;
  1022.   close (logfile);
  1023.   rewrite (logfile);
  1024.   writeln (^M'Deleted.');
  1025.   writelog (2,7,unam)
  1026. end;
  1027.  
  1028. procedure changecon (con:char);
  1029.  
  1030. procedure listcon (k:char);
  1031. var i:integer;
  1032. begin
  1033. writehdr ('Conference List');
  1034.   if ascii then begin
  1035.   writeln (^R'┌───┬───────────────────────────────────────────────────────────┐');
  1036.   writeln (^R'│ '^S'# '^R'│ '^S'Conference Name                                           '^R'│');
  1037.   writeln (^R'├───┼───────────────────────────────────────────────────────────┤');
  1038.   end else begin
  1039.   writeln (^R'+---+-----------------------------------------------------------+');
  1040.   writeln (^R'| '^S'# '^R'| '^S'Conference Name                                           '^R'|');
  1041.   writeln (^R'|---|-----------------------------------------------------------|');
  1042.   end;
  1043.   for i:=1 to 5 do begin
  1044.   if (k='M') then if (urec.defcon[i]) and (length(confm[i])>0) then begin
  1045.   if ascii then write (^R'│ ') else write (^R'| ');
  1046.   tab (^S+strr(i),3);
  1047.   if ascii then write (^R'│ ') else write (^R'| ');
  1048.   tab (^S+confm[i],59);
  1049.   if ascii then writeln (^R'│') else writeln (^R'|');
  1050.   end;
  1051.   if (k='X') then if (urec.defcon[i+5]) and (length(confx[i])>0) then begin
  1052.   if ascii then write (^R'│ ') else write (^R'| ');
  1053.   tab (^S+strr(i),3);
  1054.   if ascii then write (^R'│ ') else write (^R'| ');
  1055.   tab (^S+confx[i],59);
  1056.   if ascii then writeln (^R'│') else writeln (^R'|');
  1057.   end;
  1058.   end;
  1059.   if ascii then
  1060.   writeln (^R'└───┴───────────────────────────────────────────────────────────┘')
  1061.   else writeln (^R'+---+-----------------------------------------------------------+');
  1062.   writeln;
  1063. end;
  1064.  
  1065. var n:char;
  1066.     c:byte;
  1067. begin
  1068. if (conn<0) or (conn>5) then conn:=1;
  1069. if (useconf) then begin
  1070. c:=conn;
  1071. repeat
  1072. buflen:=1;
  1073. writestr (^R'Enter Conference # '^P'['^S'?'^P'/'^R'List'^P']'^S': *');
  1074. n:=upcase(input[1]);
  1075. case n of
  1076. '?':listcon (con);
  1077. '1':if con='M' then
  1078.     if (not urec.defcon[1]) or (length(confm[1])<1)
  1079.     then writeln (^R^M'No Such Conference!') else begin
  1080.     conn:=1; exit; end else
  1081.     if con='X' then
  1082.     if (not urec.defcon[6]) or (length(confx[1])<1)
  1083.     then writeln (^R^M'No Such Conference!') else begin
  1084.     conn:=1; exit; end;
  1085. '2':if con='M' then
  1086.     if (not urec.defcon[2]) or (length(confm[2])<1)
  1087.     then writeln (^R^M'No Such Conference!') else begin
  1088.     conn:=2; exit; end else
  1089.     if con='X' then
  1090.     if (not urec.defcon[7]) or (length(confx[2])<1)
  1091.     then writeln (^R^M'No Such Conference!') else begin
  1092.     conn:=2; exit; end;
  1093. '3':if con='M' then
  1094.     if (not urec.defcon[3]) or (length(confm[3])<1)
  1095.     then writeln (^R^M'No Such Conference!') else begin
  1096.     conn:=3; exit; end else
  1097.     if con='X' then
  1098.     if (not urec.defcon[8]) or (length(confx[3])<1)
  1099.     then writeln (^R^M'No Such Conference!') else begin
  1100.     conn:=3; exit; end;
  1101. '4':if con='M' then
  1102.     if (not urec.defcon[4]) or (length(confm[4])<1)
  1103.     then writeln (^R^M'No Such Conference!') else begin
  1104.     conn:=4; exit; end else
  1105.     if con='X' then
  1106.     if (not urec.defcon[9]) or (length(confx[4])<1)
  1107.     then writeln (^R^M'No Such Conference!') else begin
  1108.     conn:=4; exit; end;
  1109. '5':if con='M' then
  1110.     if (not urec.defcon[5]) or (length(confm[5])<1)
  1111.     then writeln (^R^M'No Such Conference!') else begin
  1112.     conn:=5; exit; end else
  1113.     if con='X' then
  1114.     if (not urec.defcon[10]) or (length(confx[5])<1)
  1115.     then writeln (^R^M'No Such Conference!') else begin
  1116.     conn:=5; exit; end;
  1117. end;
  1118. until ((n='1') and (length(confm[1])>0) and (urec.defcon[1])) or
  1119.       ((n='1') and (length(confx[1])>0) and (urec.defcon[6])) or
  1120.       ((n='2') and (length(confm[2])>0) and (urec.defcon[2])) or
  1121.       ((n='2') and (length(confx[2])>0) and (urec.defcon[7])) or
  1122.       ((n='3') and (length(confm[3])>0) and (urec.defcon[3])) or
  1123.       ((n='3') and (length(confx[3])>0) and (urec.defcon[8])) or
  1124.       ((n='4') and (length(confm[4])>0) and (urec.defcon[4])) or
  1125.       ((n='4') and (length(confx[4])>0) and (urec.defcon[9])) or
  1126.       ((n='5') and (length(confm[5])>0) and (urec.defcon[5])) or
  1127.       ((n='5') and (length(confx[5])>0) and (urec.defcon[10]));
  1128.  end else begin conn:=0; exit; end;
  1129. end;
  1130.  
  1131. procedure showsystemstatus;
  1132. var totalused,totalidle,totalup,totaldown,totalmins,callsday:real;
  1133.     yiyiyi:integer;
  1134.     drv:array [1..15] of boolean;
  1135.  
  1136.   procedure diskcalcs;
  1137.   var cnt,cnt2,curarea:integer;
  1138.       ar,area:arearec;
  1139.       ud:udrec;
  1140.       inscan,showit,fast:boolean;
  1141.  
  1142.   procedure assignud;
  1143.   var con1:byte;
  1144.   begin
  1145.     for con1:=1 to 5 do
  1146.     assign (udfile,datadir+'AREA'+strr(curarea)+'.'+strr(con1))
  1147.   end;
  1148.  
  1149.   const beenaborted:boolean=false;
  1150.  
  1151.   function aborted:boolean;
  1152.   begin
  1153.     if beenaborted then begin
  1154.       aborted:=true;
  1155.       exit
  1156.     end;
  1157.     aborted:=xpressed or hungupon;
  1158.     if xpressed then begin
  1159.       beenaborted:=true;
  1160.       writeln (^B'Aborted!')
  1161.     end
  1162.   end;
  1163.  
  1164.   procedure setarea (n:integer);
  1165.   begin
  1166.     curarea:=n;
  1167.     seek (afile,n-1);
  1168.     read (afile,area);
  1169.     close (udfile);
  1170.     assignud;
  1171.     close (udfile);
  1172.     reset (udfile);
  1173.     if ioresult<>0 then rewrite (udfile);
  1174.   end;
  1175.  
  1176.   procedure checkdrive (dv:char);
  1177.   var n:byte;
  1178.       tempdisk,tempfree:real;
  1179.  
  1180.     procedure writefreespace (dr:byte);
  1181.     var r:registers;
  1182.         csize:real;
  1183.  
  1184.       function unsigned (i:integer):real;
  1185.       begin
  1186.         if i>=0 then unsigned:=i else unsigned:=65536.0+i
  1187.       end;
  1188.  
  1189.     begin
  1190.       r.ah:=$36;
  1191.       r.dl:=dr;
  1192.       intr ($21,r);
  1193.       if r.ax=-1 then exit;
  1194.       csize:=unsigned(r.ax)*unsigned(r.cx);
  1195.       tempfree:=(csize*unsigned(r.bx))/1000;
  1196.       tempdisk:=(csize*unsigned(r.dx))/1000;
  1197.     end;
  1198.  
  1199.  
  1200.   begin
  1201.     if (ord(dv)<65) or (ord(dv)>79) then exit;
  1202.     n:=ord(dv)-64;
  1203.     writefreespace(n);
  1204.     if not drv[n] then begin
  1205.       drv[n]:=true;
  1206.       totaldisk:=totaldisk+tempdisk;
  1207.       totalfree:=totalfree+tempfree;
  1208.     end;
  1209.   end;
  1210.  
  1211.   function getfname (path:lstr; name:mstr):lstr;
  1212.   var l:lstr;
  1213.   begin
  1214.     l:=path;
  1215.     if length(l)<>0 then if not (upcase(l[length(l)]) in [':','\'])
  1216.       then l:=l+'\';
  1217.     l:=l+name;
  1218.     getfname:=l
  1219.   end;
  1220.  
  1221.   var con1:byte;
  1222.   begin
  1223.     totalfiles:=0;
  1224.     filesizes:=0;
  1225.     totaldisk:=0;
  1226.     totalFree:=0;
  1227.     for cnt:=1 to 15 do drv[cnt]:=false;
  1228.     for con1:=1 to 5 do begin
  1229.     assign (afile,datadir+'Areadir.'+strr(con1));
  1230.     if exist (datadir+'Areadir.'+strr(con1)) then begin
  1231.      reset (afile);
  1232.      if filesize (afile)<0 then exit
  1233.     end
  1234.     else rewrite (afile);
  1235.     end;
  1236.     cnt:=1;
  1237.     while (cnt<=filesize(afile)) do begin
  1238.       seek (afile,cnt-1);
  1239.       read (afile,ar);
  1240.       checkdrive (upcase(ar.xmodemdir[1]));
  1241.       setarea (cnt);
  1242.       for cnt2:=filesize (udfile) downto 1 do begin
  1243.         seek (udfile,cnt2-1);
  1244.         read (udfile,ud);
  1245.         checkdrive (upcase(ud.path[1]));
  1246.         if aborted then begin
  1247.           totalfiles:=0;
  1248.           filesizes:=0;
  1249.           totaldisk:=0;
  1250.           totalfree:=0;
  1251.           exit;
  1252.         end;
  1253.         if exist (getfname(ud.path,ud.filename)) then begin
  1254.           totalfiles:=totalfiles+1;
  1255.           filesizes:=filesizes+ud.filesize;
  1256.         end;
  1257.       end;
  1258.       cnt:=cnt+1;
  1259.     end;
  1260.     filesizes:=filesizes/1000;
  1261.   end;
  1262.  
  1263.   procedure percent (prompt:mstr; top,bot:real);
  1264.   var p:real;
  1265.   begin
  1266.     write (prompt);
  1267.     if bot<1 then begin
  1268.       writeln ('N/A');
  1269.       exit
  1270.     end;
  1271.     p:=round(1000*top/bot)/10;
  1272.     writeln (p:0:1,'%')
  1273.   end;
  1274.  
  1275. procedure modemstatus;
  1276.  
  1277. function getbaudstr (var q:baudset):lstr;
  1278. var w:lstr;
  1279.     cnt:baudratetype;
  1280. begin
  1281.   w[0]:=chr(0);
  1282.   for cnt:=firstbaud to lastbaud do
  1283.     if cnt in q then w:=w+strlong(baudarray[cnt])+' ';
  1284.   if length(w)=0 then w:='None';
  1285.   getbaudstr:=w
  1286. end;
  1287.  
  1288.   begin
  1289.   writehdr ('Modem Status');
  1290.   writeln (^R'COM Port'^P':               '^S+strr(usecom));
  1291.   writeln (^R'Characters Sent'^P':        '^S+strlong(bsent));
  1292.   writeln (^R'Characters Received'^P':    '^S+strlong(brecv));
  1293.   writeln (^R'Current Baud Rate'^P':      '^S+strlong(baudrate));
  1294.   writeln (^R'Default Baud Rate'^P':      '^S+strlong(defbaudrate));
  1295.   writeln (^R'Supported Baud Rates'^P':   '^S+getbaudstr(supportedrates));
  1296.   writeln (^R'Downloaded Baud Rates'^P':  '^S+getbaudstr(downloadrates));
  1297.   write   (^R'Connected with MNP/ARQ'^P': ');
  1298.   if arq then writeln (^S'Yes') else writeln (^S'No');
  1299.   writeln (^R'Modem Routines/Version'^P': '^S'FAQ/PibaSync Version '+ver);
  1300.   writeln (^R);
  1301.   end;
  1302.  
  1303. label last;
  1304. var ozzy,anarky:anystr;
  1305.     c:char;
  1306.     metallica:integer;
  1307. begin
  1308.   writehdr ('BBS Statistics');
  1309.   repeat
  1310.   writestr (^S'M'^R'odem Status  '^S'S'^R'ystem Status  '^S'Q'^R'uit'^P': '^U'*');
  1311.   c:=upcase(input[1]);
  1312.   case c of
  1313.   'M':begin modemstatus; c:=#0; end;
  1314.   'S':begin
  1315.   writehdr ('System Status');
  1316.   dofiles:=false;
  1317.   totalused:=numminsused.total+elapsedtime(numminsused);
  1318.   totalidle:=numminsidle.total;
  1319.   totalup:=totalidle+numminsused.total;
  1320.   totalmins:=1440.0*(numdaysup-1.0)+timer;
  1321.   totaldown:=totalmins-totalup;
  1322.   callsday:=round(10*numcallers/numdaysup)/10;
  1323.   {writestr ('Calculate Disk Storages & File Area Stats? [y/n]: *');
  1324.   writeln;
  1325.   if yes then begin
  1326.    writeln ('Calculating.');
  1327.    dofiles:=true;
  1328.    diskcalcs;
  1329.   end;}
  1330.   ozzy:=ver+' - '+parsedate(date);
  1331.   writeln ('[FAQ Version]:       '^S,ozzy);
  1332.   writeln ('[Time & Date]:       '^S,timestr(now),', ',datestr(now));
  1333.   writeln ('[Calls today]:       '^S,callstoday);
  1334.   writeln ('[Total callers]:     '^S,numcallers:0:0);
  1335.   writeln ('[Total days up]:     '^S,numdaysup);
  1336.   writeln ('[Calls per day]:     '^S,callsday:0:1);
  1337.   writeln ('[Total mins in use]: '^S,numminsused.total:0:0);
  1338.   writeln ('[Total mins idle]:   '^S,totalidle:0:0);
  1339.   writeln ('[Mins file xfer]:    '^S,numminsxfer.total:0:0);
  1340.   writeln ('[Total mins up]:     '^S,totalup:0:0);
  1341.   writeln ('[Total mins down]:   '^S,totaldown:0:0);
  1342.   percent ('[% BBS is in use]:   '^S,totalused,totalmins);
  1343.   percent ('[% BBS is idle]:     '^S,totalidle,totalmins);
  1344.   percent ('[% BBS is up]:       '^S,totalup,totalmins);
  1345.   percent ('[% BBS is down]:     '^S,totaldown,totalmins);
  1346.   {if dofiles then begin
  1347.   percent ('[% Space Unused]:    '^S,totalfree,totaldisk);
  1348.   percent ('[% Space Used]:      '^S,(totaldisk-totalfree),totaldisk);
  1349.   percent ('[% Storage Online]:  '^S,filesizes,totaldisk);
  1350.   writeln ('[Files Online]:      '^S,totalfiles);
  1351.   writeln ('[Files Storage]:     '^S,streal (filesizes/1000),' Megabytes');
  1352.   writeln ('[Total Storage]:     '^S,streal (totaldisk/1000),' Megabytes');
  1353.   writeln ('[Upload Space]:      '^S,streal (totalfree/1000),' Megabytes');
  1354.   write   ('[Drives Online]:     '^S);
  1355.   for yiyiyi:=1 to 15 do
  1356.    if drv[yiyiyi] then write ('['+chr(yiyiyi+64),']: ');
  1357.   end;
  1358.   writeln (^R);}
  1359.   c:=#0;
  1360.   end;
  1361.   end;
  1362.   until (c='Q') or (c='q');
  1363. end;
  1364.  
  1365. procedure showallforms;
  1366. begin
  1367.   showinfoforms ('')
  1368. end;
  1369.  
  1370. procedure showallsysops;
  1371. var n:integer;
  1372.     u:userrec;
  1373.     q:set of configtype;
  1374.     s:configtype;
  1375.  
  1376.   procedure showuser;
  1377.   const sectionnames:array [udsysop..databasesysop] of string[20]=
  1378.          ('File transfer','Bulletin section','Voting booths',
  1379.           'E-mail section','Doors','Main Menu','Databases');
  1380.   var s:configtype;
  1381.   begin
  1382.     writeln (#27'[2J');
  1383.     writeln (^R'┌─────────┬──────────────────────────────┐');
  1384.     writeln ('│'^P'Name'^R'     │                              │');
  1385.     Writeln ('│'^P'Level'^R'    │                              │');
  1386.     Writeln ('│'^P'Password'^R' │                              │');
  1387.     writeln (^R'└─────────┴──────────────────────────────┘');
  1388.     printxy (12,3,^S+u.handle);
  1389.     printxy (12,4,strr(u.level));
  1390.     printxy (12,5,u.password);
  1391.  
  1392.     writestr (^M'Edit user? [y/n]: *');
  1393.     if yes then edituser (n)
  1394.   end;
  1395.  
  1396. begin
  1397.   q:=[];
  1398.   for s:=udsysop to databasesysop do q:=q+[s];
  1399.   for n:=1 to numusers do begin
  1400.     seek (ufile,n);
  1401.     read (ufile,u);
  1402.     if (u.level>=sysoplevel) or (q*u.config<>[]) then showuser
  1403.   end
  1404. end;
  1405.  
  1406. procedure bbslist;
  1407. var card,ugbot,p:lstr;
  1408.     b:bbsrec;
  1409.  
  1410.    function numbbses:integer;
  1411.    begin
  1412.      numbbses:=filesize(blfile)
  1413.    end;
  1414.  
  1415.    procedure seekblfile (n:integer);
  1416.    begin
  1417.      seek (blfile,n-1);
  1418.    end;
  1419.  
  1420.    function numbbs:integer;
  1421.    begin
  1422.     numbbs:=filesize (blfile);
  1423.    end;
  1424.  
  1425.    procedure getstring (t:lstr; var m; buf:integer);
  1426.    var q:lstr absolute m;
  1427.        mm:lstr;
  1428.    begin
  1429.      writeln (^R'Old ',t,': '^S,q,^R);
  1430.      buflen:=buf;
  1431.      writestr ('Enter new '+t+' [CR/no change]:');
  1432.      mm:=input;
  1433.      if length(mm)<>0 then q:=mm;
  1434.      writeln
  1435.    end;
  1436.  
  1437.     procedure listbbs;
  1438.     var cnt,b1,b2:integer;
  1439.         showedz:boolean;
  1440.     begin
  1441.      writehdr ('BBS List');
  1442.      reset (blfile);
  1443.      if ioresult<>0 then begin
  1444.       writeln ('There are no BBS''s in the list.  Add one!');
  1445.       exit;
  1446.      end
  1447.      else begin
  1448.      parserange (numbbs,b1,b2);
  1449.      writestr ('Show Extended BBS Descriptions? [Y/n]: *');
  1450.      writeln;
  1451.      showedz:=true;
  1452.      if (upcase(input[1])='N') then showedz:=false;
  1453.      if b1>0 then
  1454.      for cnt:=b1 to b2 do
  1455.      begin
  1456.       seekblfile (cnt);
  1457.       read (blfile,b);
  1458.       write (^R'['^S);
  1459.       tab (b.number,12);
  1460.       write (^R' '^P);
  1461.       tab (b.name,48);
  1462.       write (^R' '^U);
  1463.       tab (b.maxbaud,4);
  1464.       write (^R' '^P);
  1465.       tab (b.ware,8);
  1466.       writeln (^R']');
  1467.       if showedz then
  1468.       begin
  1469.        write (^R':'^U);
  1470.        tab (b.extdesc,77);
  1471.        writeln (^R'');
  1472.       end;
  1473.      end;
  1474.     end;
  1475.     end;
  1476.  
  1477.   function getbnum (txt:mstr):integer;
  1478.   var n:integer;
  1479.   begin
  1480.     getbnum:=0;
  1481.     repeat
  1482.       writeln;
  1483.       writestr ('BBS Number to '+txt+' [?/List]:');
  1484.       if length(input)=0 then exit;
  1485.       if upcase(input[1])='?'
  1486.         then listbbs
  1487.         else begin
  1488.           n:=valu(input);
  1489.           if (n<1) or (n>numbbs) then begin
  1490.             writestr (^M'Number out of range!');
  1491.             exit
  1492.           end;
  1493.           seekblfile (n);
  1494.           read (blfile,b);
  1495.           getbnum:=n;
  1496.           exit
  1497.         end
  1498.     until hungupon
  1499.   end;
  1500.  
  1501.     procedure addbbs;
  1502.     begin
  1503.      writehdr ('Add a BBS');
  1504.      writeln (^R'Phone Number [12 Characters Max]');
  1505.      writeln (^R' [------------]');
  1506.      buflen:=12;
  1507.      writestr (': &');
  1508.      b.number:=input;
  1509.      writeln;
  1510.      writeln (^R'Enter BBS Name [48 Characters Max]');
  1511.      writeln (^R' [------------------------------------------------]');
  1512.      buflen:=48;
  1513.      writestr (': &');
  1514.      b.name:=input;
  1515.      writeln;
  1516.      writeln (^R'Maximum Baud [4 Digits] (ie 2400,4800,9600,19.2)');
  1517.      writeln (^R' [----]');
  1518.      buflen:=4;
  1519.      writestr (': &');
  1520.      b.maxbaud:=input;
  1521.      writeln;
  1522.      writeln (^R'BBS Software [8 Characters Max] (ie FAQ,TCS,Celerity)');
  1523.      writeln (^R' [--------]');
  1524.      buflen:=8;
  1525.      writestr (': &');
  1526.      b.ware:=input;
  1527.      writeln;
  1528.      writeln (^R'Extended BBS Description [77 Characters Max - CR for none]');
  1529.      writeln(^R' [-------------------------------------------------------------------------]');
  1530.      buflen:=77;
  1531.      writestr (': &');
  1532.      b.extdesc:=input;
  1533.      b.leftby:=unam;
  1534.      b.when:=now;
  1535.      if (length(b.number)>0) and (length(b.name)>0) and (length(b.maxbaud)>0)
  1536.      and (length(b.ware)>0) then begin
  1537.       if not exist (bbsdatadir+'BBSList.dat') then rewrite (blfile);
  1538.       seekblfile (numbbses+1);
  1539.       write (blfile,b);
  1540.       writeln (^M^S'Entry Added!'^R^M);
  1541.       writelog (6,1,b.name);
  1542.      end else
  1543.      writeln (^M^S'Entry incomplete!'^R^M);
  1544.      end;
  1545.  
  1546.   procedure changebbs;
  1547.   var q,spock:integer;
  1548.       doodzdomain:char;
  1549.       phortune:boolean;
  1550.  
  1551.    procedure showbbs (b:bbsrec);
  1552.    begin
  1553.    writeln (^M^R'['^S'1'^R'] BBS Name:     '^S,b.name,
  1554.             ^M^R'['^S'2'^R'] BBS Number:   '^S,b.number,
  1555.             ^M^R'['^S'3'^R'] Max Baud:     '^S,b.maxbaud,
  1556.             ^M^R'['^S'4'^R'] BBS Software: '^S,b.ware,
  1557.             ^M^R'['^S'5'^R'] Extended BBS Description:',
  1558.             ^M^R': '^S,b.extdesc,
  1559.             ^M^R'['^S'Q'^R'] Quit');
  1560.    end;
  1561.  
  1562.    begin
  1563.        reset (blfile);
  1564.        if ioresult<>0 then begin
  1565.        writeln ('There are no BBS''s in the list.  Add one!');
  1566.        exit;
  1567.        end;
  1568.        writehdr ('Change an Entry');
  1569.        phortune:=false;
  1570.        repeat
  1571.        writestr (^M'Entry to Change [?/List]: &');
  1572.        if input[1]='?' then listbbs else begin
  1573.        spock:=valu(input);
  1574.        if spock<1 then exit;
  1575.        if spock>numbbs then exit;
  1576.        seekblfile (spock);
  1577.        read (blfile,b);
  1578.        if (not (match (b.leftby,unam))) and (ulvl<sysoplevel) then begin
  1579.         writeln (^M'You didn''t post that entry!'^M);
  1580.         exit;
  1581.        end;
  1582.        phortune:=true;
  1583.        writelog (16,3,b.name);
  1584.        repeat
  1585.        showbbs (b);
  1586.        writestr ('[Edit BBS List Command] [?/Help]: *');
  1587.        doodzdomain:=upcase(input[1]);
  1588.        case doodzdomain of
  1589.         '1':getstring ('BBS Name',b.name,48);
  1590.         '2':getstring ('BBS Number',b.number,12);
  1591.         '3':getstring ('Maximum Baud',b.maxbaud,4);
  1592.         '4':getstring ('BBS Software',b.ware,8);
  1593.         '5':begin
  1594.              writeln ('Old Extended BBS Description:');
  1595.              writeln (': ',b.extdesc);
  1596.              writeln ('Enter new Extended BBS Description [CR/no change]:');
  1597.              buflen:=77;
  1598.              writestr (': &');
  1599.              if length(input)<>0 then b.extdesc:=input;
  1600.              writeln
  1601.             end;
  1602.         'Q':;
  1603.        end;
  1604.        until doodzdomain='Q';
  1605.        seekblfile (spock);
  1606.        write (blfile,b);
  1607.        end;
  1608.        until phortune;
  1609.       end;
  1610.  
  1611.   procedure deletebbs;
  1612.   var i,n,cnt:integer;
  1613.       c:char;
  1614.       maniaclame:boolean;
  1615.   begin
  1616.    reset (blfile);
  1617.    if ioresult<>0 then begin
  1618.    writeln ('There are no BBS''s in the list.  Add one!');
  1619.    exit;
  1620.    end;
  1621.    writehdr ('Delete an Entry');
  1622.    n:=getbnum ('Delete');
  1623.    if n=0 then exit;
  1624.    seekblfile (n);
  1625.    read (blfile,b);
  1626.    if not issysop then
  1627.    if not match(b.leftby,unam) then begin
  1628.     writeln;
  1629.     writeln ('You didn''t enter that!');
  1630.     writeln;
  1631.     exit;
  1632.    end;
  1633.    writeln;
  1634.    writeln (^R'['^S,b.name,^R'] ['^S,b.number,^R']');
  1635.    writeln;
  1636.    writestr ('Delete this entry? [y/n]: *');
  1637.    if not yes then exit;
  1638.    writelog (6,2,b.name);
  1639.     for cnt:=n to numbbs-1 do begin
  1640.       seekblfile (cnt+1);
  1641.       read (blfile,b);
  1642.       seekblfile (cnt);
  1643.       write (blfile,b)
  1644.     end;
  1645.     seekblfile (numbbs);
  1646.     truncate (blfile);
  1647.    { writelog ('Deleted BBS Entry "',b.leftby,'"'); }
  1648.   end;
  1649.  
  1650.   procedure searchbbstext;
  1651.   var x:integer;
  1652.       ariescool:boolean;
  1653.       s:anystr;
  1654.       bb:bbsrec;
  1655.   begin
  1656.    reset (blfile);
  1657.    if ioresult<>0 then begin
  1658.    writeln ('There are no BBS''s in the list.  Add one!');
  1659.    exit;
  1660.    end;
  1661.    writehdr ('Search for Text in BBS List');
  1662.    writeln ('Enter text to search for:');
  1663.    writestr (': &');
  1664.    writeln;
  1665.    if length(input)=0 then exit;
  1666.    s:=input;
  1667.    s:=upstring(s);
  1668.    for x:=1 to numbbs do begin
  1669.     ariescool:=false;
  1670.     seekblfile (x);
  1671.     read (blfile,bb);
  1672.     if pos(s,upstring(bb.number))<>0 then ariescool:=true;
  1673.     if pos(s,upstring(bb.name))<>0 then ariescool:=true;
  1674.     if pos(s,upstring(bb.maxbaud))<>0 then ariescool:=true;
  1675.     if pos(s,upstring(bb.ware))<>0 then ariescool:=true;
  1676.     if pos(s,upstring(bb.extdesc))<>0 then ariescool:=true;
  1677.     if ariescool=true then begin
  1678.      write (^R'['^S);
  1679.      tab (bb.number,12);
  1680.      write (^R' '^P);
  1681.      tab (bb.name,48);
  1682.      write (^R' '^U);
  1683.      tab (bb.maxbaud,4);
  1684.      write (^R' '^P);
  1685.      tab (bb.ware,8);
  1686.      writeln (^R']');
  1687.      write (^R':'^U);
  1688.      tab (bb.extdesc,77);
  1689.      writeln (^R'');
  1690.     end;
  1691.    end;
  1692.   end;
  1693.  
  1694.   procedure newscanbbs;
  1695.   var cnt:integer;
  1696.       bb:bbsrec;
  1697.   begin
  1698.     reset (blfile);
  1699.     if ioresult<>0 then begin
  1700.     writeln ('There are no BBS''s in the list.  Add one!');
  1701.     exit;
  1702.     end;
  1703.     writehdr ('BBS List Newscan');
  1704.     for cnt:=1 to numbbs do begin
  1705.      seekblfile (cnt);
  1706.      read (blfile,bb);
  1707.      if (bb.when>laston) then begin
  1708.       write (^R'['^S);
  1709.       tab (bb.number,12);
  1710.       write (^R' '^P);
  1711.       tab (bb.name,48);
  1712.       write (^R' '^U);
  1713.       tab (bb.maxbaud,4);
  1714.       write (^R' '^P);
  1715.       tab (bb.ware,8);
  1716.       writeln (^R']');
  1717.       write (^R':'^U);
  1718.       tab (bb.extdesc,77);
  1719.       writeln (^R'');
  1720.     end;
  1721.   end;
  1722.   end;
  1723.  
  1724.   procedure sortbbs;
  1725.   begin
  1726.     reset (blfile);
  1727.     if ioresult<>0 then begin
  1728.     writeln ('There are no BBS''s in the list.  Add one!');
  1729.     exit;
  1730.     end
  1731.   end;
  1732.  
  1733.   procedure converttextfile;
  1734.   var x:integer;
  1735.       t:text;
  1736.   begin
  1737.       reset (blfile);
  1738.       if ioresult<>0 then begin
  1739.       writeln ('There are no BBS''s in the list.  Add one!');
  1740.       exit;
  1741.       end;
  1742.       assign (t,bbsdatadir+'BBSLIST.TXT');
  1743.       rewrite (t);
  1744.       textclose (t);
  1745.   end;
  1746.  
  1747.   procedure bbslistsysop;
  1748.   begin
  1749.      if ulvl<sysoplevel then begin
  1750.       reqlevel (sysoplevel);
  1751.       exit;
  1752.      end;
  1753.      writelog (6,4,unam);
  1754.      writeln;
  1755.      repeat
  1756.       ugbot:=' ';
  1757.       writeln  (^R'['^S'D'^R'] Delete an Entry');
  1758.       writeln  (^R'['^S'C'^R'] Change an Entry');
  1759.       writeln  (^R'['^S'S'^R'] Sort Entries');
  1760.       writeln  (^R'['^S'Q'^R'] Quit');
  1761.       writeln;
  1762.       writestr ('[BBS List Sysop Command]: *');
  1763.       ugbot:=upstring(input);
  1764.       case ugbot[1] of
  1765.        'D':deletebbs;
  1766.        'C':changebbs;
  1767.        'S':sortbbs;
  1768.       end;
  1769.      until (ugbot[1]='Q');
  1770.     end;
  1771.  
  1772. label exit;
  1773. var q:integer;
  1774. begin
  1775.     assign (blfile,bbsdatadir+'BBSList.dat');
  1776.     if exist (bbsdatadir+'BBSList.dat') then reset (blfile);
  1777.     writehdr ('BBS List');
  1778.     repeat
  1779.      q:=menu ('BBS List','BBSLIST','LADC%QNS?');
  1780.      writeln;
  1781.      case q of
  1782.       1:listbbs;
  1783.       2:addbbs;
  1784.       3:deletebbs;
  1785.       4:changebbs;
  1786.       5:bbslistsysop;
  1787.       6:goto exit;
  1788.       7:newscanbbs;
  1789.       8:searchbbstext;
  1790.       9:begin
  1791. writeln ('C╔═════════════════════════════════════╗Hs');
  1792. writeln ('uC║ BBS List Section                    ║Hs');
  1793. writeln ('uC╚═════════════════════════════════════╝HHC╔════s');
  1794. writeln ('u═════════════════════════════════╗HC║ [A]  s');
  1795. writeln ('uAdd BBS Entry to List          ║HC║ [Cs');
  1796. writeln ('u]  Change BBS Entry               ║HC║ [s');
  1797. writeln ('uD]  Delete BBS Entry from List     ║Hs');
  1798. writeln ('uC║ [L]  List BBS Entries               s');
  1799. writeln ('u║HC║ [N]  Newscan BBS Entries     s');
  1800. writeln ('u       ║HC║ [Q]  Quit             s');
  1801. writeln ('u              ║HC║ [S]  Search BBSs');
  1802. writeln ('u Entries for Text    ║HC║ [%]  BBSs');
  1803. writeln ('u List Sysop Section         ║HC║ [?]  s');
  1804. writeln ('uView This Menu                 ║HC╚═════════A');
  1805. writeln ('C════════════════════════════╝');
  1806. write (^B^R' '^M);
  1807. pause;
  1808.            end;
  1809.       end;
  1810.      until (hungupon) or (q=6);
  1811.     exit:
  1812.     close (blfile);
  1813. end;
  1814.  
  1815. procedure searchphone;
  1816. var temp:sstr;
  1817.     user:userrec;
  1818.     cnt,int:integer;
  1819. begin
  1820. int:=0;
  1821. writeln (^R'Phone Number without dashes'^P', '^R'slashes'^P', '^R'etc'^P'.');
  1822. buflen:=15;
  1823. writestr (^P': '^U'*');
  1824. if length(input)<10 then exit;
  1825. temp:=input;
  1826. writeln;
  1827. for cnt:=1 to numusers do begin
  1828. seek (ufile,cnt);
  1829. read (ufile,user);
  1830. if match(temp,user.phonenum) then begin
  1831. writeln (^R'User with #'^S+user.phonenum+^P': '^R'#'^S,cnt,' '+user.handle,^M);
  1832. int:=int+1;
  1833. end; end;
  1834. writeln (^R'# of Users found with Phone Number'^P': '^S,int);
  1835. write (^B^R);
  1836. end;
  1837.  
  1838. procedure timebank;
  1839. var q:char;
  1840.  
  1841.   procedure setuplocal;
  1842.   var i:integer;
  1843.   begin
  1844.     assign(bnkfile,bbsdatadir+'TIMEBANK.DAT');
  1845.     if not exist(bbsdatadir+'timebank.dat') then begin
  1846.                     rewrite(bnkfile);
  1847.                     acct.balance:=0;
  1848.                     acct.lastw:=0;
  1849.                     acct.lastt:=' ';
  1850.                     acct.lasta:=0;
  1851.                     for i:=1 to 1200 do write(bnkfile,acct);
  1852.                     end;
  1853.     reset(bnkfile); seek(bnkfile,unum-1);
  1854.     read(bnkfile,acct);
  1855. end;
  1856.  
  1857. procedure writebank;
  1858. begin
  1859.     seek(bnkfile,unum-1); write(bnkfile,acct);
  1860. end;
  1861.  
  1862. procedure showbalance;
  1863. begin
  1864.     writeln('Account #'+strr(unum)+' - '+unam); writeln;
  1865.     writeln('Current balance : '^S,acct.balance,^R' minutes.');
  1866.         writeln('Maximum deposit : '^S,strr(maxdeposit));
  1867.       write('Last Transaction: '^S);
  1868.       case acct.lastt of
  1869.         'W'    : write('Withdrawal');
  1870.         'D'    : write('Deposit');
  1871.         else begin
  1872.             writeln('None');
  1873.             writeln;
  1874.             exit;
  1875.             end;
  1876.         end;
  1877. writeln(^R' of '^P,acct.lasta,^R' minutes on '^P,datestr(acct.lastw),^R);
  1878.     writeln;
  1879. end;
  1880.  
  1881. procedure deposit;
  1882. var amt:integer;
  1883. begin
  1884.     writeln;
  1885.     if urec.timetoday <= 5 then begin
  1886.         writeln('You have only ',urec.timetoday,' now!');
  1887.         exit;
  1888.         end;
  1889.  
  1890.     if acct.balance = maxdeposit then begin
  1891.     writeln('The time bank only insures you up to '+strr(maxdeposit)+' minutes!');
  1892.                 exit;
  1893.                 end;
  1894.     showbalance;
  1895.     writestr('Deposit how many minutes? &');
  1896.     amt:=valu(input); writeln;
  1897.     if amt <= 0 then exit;
  1898.     if amt > urec.timetoday then begin
  1899.             writeln('You haven''t got that much left!');
  1900.             exit;
  1901.             end;
  1902.     if amt+acct.balance > maxdeposit then begin
  1903. writeln('The time bank will only insure up to '+strr(maxdeposit)+' minutes, would you settle for');
  1904.  write ('depositing only '+strr(maxdeposit-acct.balance)+' minutes instead? ');
  1905.  writestr('&');
  1906.  
  1907.       if upcase(input[1])<>'Y' then exit;
  1908.       amt:=maxdeposit-acct.balance;
  1909.       end;
  1910.     acct.lasta:=amt;
  1911.     acct.lastw:=now;
  1912.     acct.lastt:='D';
  1913.     acct.balance:=acct.balance+amt;
  1914.     urec.timetoday:=urec.timetoday-amt;
  1915.     writebank;
  1916.     writeln(^S,amt,^R' minutes added to your account.');
  1917. end;
  1918.  
  1919. procedure withdraw;
  1920. var amt:integer;
  1921. begin
  1922.     writeln;
  1923.     if acct.balance <= 0 then acct.balance:=0;
  1924.     if acct.balance = 0 then begin
  1925.     writeln('You have nothing to withdraw!');
  1926.                 exit;
  1927.                 end;
  1928.     showbalance;
  1929.     writestr('Withdraw how many minutes? &');
  1930.     amt:=valu(input); writeln;
  1931.     if amt <= 0 then exit;
  1932.     if amt > acct.balance then begin
  1933.         writeln('You haven''t got that much in your account.');
  1934.             exit;
  1935.             end;
  1936.  
  1937.     acct.lasta:=amt;
  1938.     acct.lastw:=now;
  1939.     acct.lastt:='W';
  1940.     acct.balance:=acct.balance-amt;
  1941.     urec.timetoday:=urec.timetoday+amt;
  1942.     writebank;
  1943.     writeln(^S,amt,^R' minutes added to today''s time.');
  1944. end;
  1945.  
  1946. begin
  1947.   if (usetimebank) then begin
  1948.   setuplocal;
  1949.   repeat
  1950.         showbalance;
  1951.         writeln (^P'['^S'D'^P'] '^R'Deposit Time');
  1952.         writeln (^P'['^S'W'^P'] '^R'Withdraw Time');
  1953.         writeln (^P'['^S'Q'^P'] '^R'Quit');
  1954.     writestr(^M^P'['^R'Time Bank Menu'^P']'^S': '^U'*');
  1955.         q:=upcase(input[1]);
  1956.     case q of
  1957.         'W': withdraw;
  1958.         'D': deposit;
  1959.         end
  1960.       until (q='q') or (q='Q') or (hungupon)
  1961.   end else begin writeln ('Timebank is not configured.'); exit; end;
  1962. end;
  1963.  
  1964. {procedure modifycon;
  1965. var choice:char;
  1966. choice1,choice2,choice3,choice4,choice5:char;
  1967.  
  1968. procedure writeconfig;
  1969. var q:file of configsettype;
  1970. begin
  1971.   assign (q,'SETUP.CFG');
  1972.   rewrite (q);
  1973.   write (q,configset);
  1974.   close (q)
  1975. end;
  1976.  
  1977. begin
  1978. repeat
  1979. writehdr ('Modify Conferences');
  1980. writeln (^R'['^S'A'^R'] Conference #1: '^S+conf1);
  1981. writeln (^R'['^S'B'^R'] Conference #2: '^S+conf2);
  1982. writeln (^R'['^S'C'^R'] Conference #3: '^S+conf3);
  1983. writeln (^R'['^S'D'^R'] Conference #4: '^S+conf4);
  1984. writeln (^R'['^S'E'^R'] Conference #5: '^S+conf5);
  1985. writeln (^R'['^S'Q'^R'] Quit:');
  1986. writestr (^M^P'['^R'Conference Sysop Command'^P']'^S': *');
  1987.  choice:=upcase(input[1]);
  1988.  if choice='A' then begin
  1989. repeat
  1990. writeln (^M^R'['^S'A'^R'] Conference #1 Name    : '^S+conf1);
  1991. writeln (^R'['^S'B'^R'] Conference #1 Sponsor : '^S+con1spon);
  1992. writeln (^R'['^S'C'^R'] Conference #1 Entry PW: '^S+con1pw);
  1993. writeln (^R'['^S'Q'^R'] Quit:');
  1994. writestr (^M^P'['^R'Conference Modify Command'^P']'^S': *');
  1995.  choice1:=upcase(input[1]);
  1996. if choice1='A' then begin writestr ('Input: *'); conf1:=input; end;
  1997. if choice1='B' then begin writestr ('Input: *'); con1spon:=input; end;
  1998. if choice1='C' then begin writestr ('Input: *'); con1pw:=input; end;
  1999. until (choice1='Q');
  2000. writeconfig;
  2001. end;
  2002.  if choice='B' then begin
  2003. repeat
  2004. writeln (^M^R'['^S'A'^R'] Conference #2 Name    : '^S+conf2);
  2005. writeln (^R'['^S'B'^R'] Conference #2 Sponsor : '^S+con2spon);
  2006. writeln (^R'['^S'C'^R'] Conference #2 Entry PW: '^S+con2pw);
  2007. writeln (^R'['^S'Q'^R'] Quit:');
  2008. writestr (^M^P'['^R'Conference Modify Command'^P']'^S': *');
  2009.  choice2:=upcase(input[1]);
  2010. if choice2='A' then begin writestr ('Input: *'); conf2:=input; end;
  2011. if choice2='B' then begin writestr ('Input: *'); con2spon:=input; end;
  2012. if choice2='C' then begin writestr ('Input: *'); con2pw:=input; end;
  2013. until (choice2='Q');
  2014. writeconfig;
  2015. end;
  2016.  if choice='C' then begin
  2017. repeat
  2018. writeln (^M^R'['^S'A'^R'] Conference #3 Name    : '^S+conf3);
  2019. writeln (^R'['^S'B'^R'] Conference #3 Sponsor : '^S+con3spon);
  2020. writeln (^R'['^S'C'^R'] Conference #3 Entry PW: '^S+con3pw);
  2021. writeln (^R'['^S'Q'^R'] Quit:');
  2022. writestr (^M^P'['^R'Conference Modify Command'^P']'^S': *');
  2023.  choice3:=upcase(input[1]);
  2024. if choice3='A' then begin writestr ('Input: *'); conf3:=input; end;
  2025. if choice3='B' then begin writestr ('Input: *'); con3spon:=input; end;
  2026. if choice3='C' then begin writestr ('Input: *'); con3pw:=input; end;
  2027. until (choice3='Q');
  2028. writeconfig;
  2029. end;
  2030.  if choice='D' then begin
  2031. repeat
  2032. writeln (^M^R'['^S'A'^R'] Conference #4 Name    : '^S+conf4);
  2033. writeln (^R'['^S'B'^R'] Conference #4 Sponsor : '^S+con4spon);
  2034. writeln (^R'['^S'C'^R'] Conference #4 Entry PW: '^S+con4pw);
  2035. writeln (^R'['^S'Q'^R'] Quit:');
  2036. writestr (^M^P'['^R'Conference Modify Command'^P']'^S': *');
  2037.  choice4:=upcase(input[1]);
  2038. if choice4='A' then begin writestr ('Input: *'); conf4:=input; end;
  2039. if choice4='B' then begin writestr ('Input: *'); con4spon:=input; end;
  2040. if choice4='C' then begin writestr ('Input: *'); con4pw:=input; end;
  2041. until (choice4='Q');
  2042. writeconfig;
  2043. end;
  2044.  if choice='E' then begin
  2045. repeat
  2046. writeln (^M^R'['^S'A'^R'] Conference #5 Name    : '^S+conf5);
  2047. writeln (^R'['^S'B'^R'] Conference #5 Sponsor : '^S+con5spon);
  2048. writeln (^R'['^S'C'^R'] Conference #5 Entry PW: '^S+con5pw);
  2049. writeln (^R'['^S'Q'^R'] Quit:');
  2050. writestr (^M^P'['^R'Conference Modify Command'^P']'^S': *');
  2051. choice5:=upcase(input[1]);
  2052. if choice5='A' then begin writestr ('Input: *'); conf5:=input; end;
  2053. if choice5='B' then begin writestr ('Input: *'); con5spon:=input; end;
  2054. if choice5='C' then begin writestr ('Input: *'); con5pw:=input; end;
  2055. until (choice5='Q');
  2056. writeconfig;
  2057. end;
  2058. until (choice='Q');
  2059. writeconfig;
  2060. end;}
  2061.  
  2062. procedure readerrlog;
  2063. begin
  2064.   writehdr ('Read Error Log');
  2065.   if exist (bbsdatadir+'Errlog.dat')
  2066.     then printfile (bbsdatadir+'Errlog.dat')
  2067.     else writestr ('No error file!')
  2068. end;
  2069.  
  2070. procedure showad;
  2071. var fn:lstr;
  2072. begin
  2073.   writehdr ('Advertisement');
  2074.   fn:=textfiledir+'FAQ.Ad';
  2075.   if exist (fn) then printfile (fn) else begin
  2076.   writeln (^M'No Advertisement.'^M);
  2077.   writeln (usr,'Sysop: To make one, create a file called FAQ.AD in your Menus Directory.'^M);
  2078.   end;
  2079. end;
  2080.  
  2081. procedure setlastcall;
  2082.  
  2083.   function digit (k:char):boolean;
  2084.   begin
  2085.     digit:=ord(k) in [48..57]
  2086.   end;
  2087.  
  2088.   function validtime (inp:sstr):boolean;
  2089.   var c,s,l:integer;
  2090.       d1,d2,d3,d4:char;
  2091.       ap,m:char;
  2092.   begin
  2093.     validtime:=false;
  2094.     l:=length(inp);
  2095.     if (l<7) or (l>8) then exit;
  2096.     c:=pos(':',inp);
  2097.     if c<>l-5 then exit;
  2098.     s:=pos(' ',inp);
  2099.     if s<>l-2 then exit;
  2100.     d2:=inp[c-1];
  2101.     if l=7
  2102.       then d1:='0'
  2103.       else d1:=inp[1];
  2104.     d3:=inp[c+1];
  2105.     d4:=inp[c+2];
  2106.     ap:=upcase(inp[s+1]);
  2107.     m:=upcase(inp[s+2]);
  2108.     if d1='1' then if d2>'2' then d2:='!';
  2109.     if (d1>='0') and (d1<='1') and digit(d2) and (d3>='0') and (d3<='5')
  2110.        and digit(d4) and ((ap='A') or (ap='P')) and (m='M')
  2111.          then validtime:=true
  2112.   end;
  2113.  
  2114.   function validdate (inp:sstr):boolean;
  2115.   var k,l:char;
  2116.  
  2117.     function gchar:char;
  2118.     begin
  2119.       if length(inp)=0 then begin
  2120.         gchar:='?';
  2121.         exit
  2122.       end;
  2123.       gchar:=inp[1];
  2124.       delete (inp,1,1)
  2125.     end;
  2126.  
  2127.   begin
  2128.     validdate:=false;
  2129.     k:=gchar;
  2130.     l:=gchar;
  2131.     if not digit(k) then exit;
  2132.     if l='/'
  2133.       then if k='0'
  2134.         then exit
  2135.         else
  2136.       else begin
  2137.         if k>'1' then exit;
  2138.         if not digit(l) then exit;
  2139.         if (l>'2') and (k='1') then exit;
  2140.         l:=gchar;
  2141.         if l<>'/' then exit
  2142.       end;
  2143.     k:=gchar;
  2144.     l:=gchar;
  2145.     if l='/'
  2146.       then if k='0'
  2147.         then exit
  2148.         else
  2149.       else begin
  2150.         if k>'3' then exit;
  2151.         if not digit(l) then exit;
  2152.         if (k='3') and (l>'1') then exit;
  2153.         l:=gchar;
  2154.         if l<>'/' then exit
  2155.       end;
  2156.     if digit(gchar) and digit(gchar) then validdate:=true
  2157.   end;
  2158.  
  2159. begin
  2160.   writehdr ('Set Last Call');
  2161.   writeln (^M'Your last call was: '^S+datestr(laston),' at '+timestr(laston));
  2162.   writestr (^M'Enter new date [mm/dd/yy]:');
  2163.   if length(input)>0
  2164.     then if validdate (input)
  2165.       then laston:=dateval(input)+timepart(laston)
  2166.       else writestr ('Invalid date!');
  2167.   writestr (^M'Enter new time [hh:mm am/pm]:');
  2168.   if length(input)>0
  2169.     then if validtime(input)
  2170.       then laston:=timeval(input)+datepart(laston)
  2171.       else writestr ('Invalid time!')
  2172. end;
  2173.  
  2174. procedure removeallforms;
  2175. var ndel,cygnus:integer;
  2176.     u:userrec;
  2177.  
  2178. procedure eraseinfo1;
  2179. var cnt:integer;
  2180. begin
  2181.   ndel:=0;
  2182.   for cnt:=1 to numusers do begin
  2183.    if (cnt mod 10)=0 then write (cnt,', ');
  2184.    seek (ufile,cnt);
  2185.    read (ufile,u);
  2186.    if u.infoform1>=0 then begin
  2187.      deletetext (u.infoform1);
  2188.      u.infoform1:=-1;
  2189.      seek (ufile,cnt);
  2190.      write (ufile,u);
  2191.      ndel:=ndel+1
  2192.    end
  2193.   end;
  2194. end;
  2195.  
  2196. procedure eraseinfo2;
  2197. var cnt:integer;
  2198. begin
  2199.   ndel:=0;
  2200.   for cnt:=1 to numusers do begin
  2201.    if (cnt mod 10)=0 then write (cnt,', ');
  2202.    seek (ufile,cnt);
  2203.    read (ufile,u);
  2204.    if u.infoform2>=0 then begin
  2205.      deletetext (u.infoform2);
  2206.      u.infoform2:=-1;
  2207.      seek (ufile,cnt);
  2208.      write (ufile,u);
  2209.      ndel:=ndel+1
  2210.    end
  2211.   end;
  2212. end;
  2213.  
  2214. procedure eraseinfo3;
  2215. var cnt:integer;
  2216. begin
  2217.   ndel:=0;
  2218.   for cnt:=1 to numusers do begin
  2219.    if (cnt mod 10)=0 then write (cnt,', ');
  2220.    seek (ufile,cnt);
  2221.    read (ufile,u);
  2222.    if u.infoform3>=0 then begin
  2223.      deletetext (u.infoform3);
  2224.      u.infoform3:=-1;
  2225.      seek (ufile,cnt);
  2226.      write (ufile,u);
  2227.      ndel:=ndel+1
  2228.    end
  2229.   end;
  2230. end;
  2231.  
  2232. procedure eraseinfo4;
  2233. var cnt:integer;
  2234. begin
  2235.   ndel:=0;
  2236.   for cnt:=1 to numusers do begin
  2237.    if (cnt mod 10)=0 then write (cnt,', ');
  2238.    seek (ufile,cnt);
  2239.    read (ufile,u);
  2240.    if u.infoform4>=0 then begin
  2241.      deletetext (u.infoform4);
  2242.      u.infoform4:=-1;
  2243.      seek (ufile,cnt);
  2244.      write (ufile,u);
  2245.      ndel:=ndel+1
  2246.    end
  2247.   end;
  2248. end;
  2249.  
  2250. procedure eraseinfo5;
  2251. var cnt:integer;
  2252. begin
  2253.   ndel:=0;
  2254.   for cnt:=1 to numusers do begin
  2255.    if (cnt mod 10)=0 then write (cnt,', ');
  2256.    seek (ufile,cnt);
  2257.    read (ufile,u);
  2258.    if u.infoform5>=0 then begin
  2259.      deletetext (u.infoform5);
  2260.      u.infoform5:=-1;
  2261.      seek (ufile,cnt);
  2262.      write (ufile,u);
  2263.      ndel:=ndel+1
  2264.    end
  2265.   end;
  2266. end;
  2267.  
  2268. begin
  2269.   writehdr ('Erase Infoform[s]');
  2270.   writestr ('Erase ALL of which Info-Form? [#1-5]: *');
  2271.   if (valu(input)<1) or (valu(input)>5) then exit;
  2272.   cygnus:=valu(input);
  2273.   writestr ('Erase ALL # '+strr(valu(input))+' Info-Forms -- Are you sure [y/n]? *');
  2274.   if not yes then exit;
  2275.   writeurec;
  2276.   writestr (^M'Erasing.  please stand by.');
  2277.   ndel:=0;
  2278.   case cygnus of
  2279.    1:eraseinfo1;
  2280.    2:eraseinfo2;
  2281.    3:eraseinfo3;
  2282.    4:eraseinfo4;
  2283.    5:eraseinfo5;
  2284.   end;
  2285.   writeln ('Done.');
  2286.   writestr (^M'All # '+strr(cygnus)+' Infoforms erased.');
  2287.   writestr (strr(ndel)+' Users Processed.');
  2288.   readurec
  2289. end;
  2290.  
  2291. procedure readfeedback;
  2292. var ffile:file of mailrec;
  2293.     m:mailrec;
  2294.     me:message;
  2295.     cur:integer;
  2296.  
  2297.   function nummessages:integer;
  2298.   begin
  2299.     nummessages:=filesize(ffile)
  2300.   end;
  2301.  
  2302.   function checkcur:boolean;
  2303.   begin
  2304.     if length(input)>1 then cur:=valu(copy(input,2,255));
  2305.     if (cur<1) or (cur>nummessages) then begin
  2306.       writestr (^M'Message out of range!');
  2307.       cur:=0;
  2308.       checkcur:=true
  2309.     end else begin
  2310.       checkcur:=false;
  2311.       seek (ffile,cur-1);
  2312.       read (ffile,m)
  2313.     end
  2314.   end;
  2315.  
  2316.   procedure readnum (n:integer);
  2317.   begin
  2318.     cur:=n;
  2319.     input:='';
  2320.     if checkcur then exit;
  2321.     writeln (^B^M'Message: '^S,cur,
  2322.                ^M'Title:   '^S,m.title,
  2323.                ^M'Sent by: '^S,m.sentby,
  2324.                ^M'Sent on: '^S,datestr(m.when),' at ',timestr(m.when),^M);
  2325.     if break then exit;
  2326.     printtext (m.line)
  2327.   end;
  2328.  
  2329.   procedure writecurmsg;
  2330.   begin
  2331.     if (cur<1) or (cur>nummessages) then cur:=0;
  2332.     write (^B^R^M'Current msg: '^S);
  2333.     if cur=0 then write ('None') else begin
  2334.       seek (ffile,cur-1);
  2335.       read (ffile,m);
  2336.       write (m.title,' by ',m.sentby)
  2337.     end
  2338.   end;
  2339.  
  2340.   procedure delfeedback;
  2341.   var cnt:integer;
  2342.   begin
  2343.     if checkcur then exit;
  2344.     deletetext (m.line);
  2345.     for cnt:=cur to nummessages-1 do begin
  2346.       seek (ffile,cnt);
  2347.       read (ffile,m);
  2348.       seek (ffile,cnt-1);
  2349.       write (ffile,m)
  2350.     end;
  2351.     seek (ffile,nummessages-1);
  2352.     truncate (ffile);
  2353.     cur:=cur-1
  2354.   end;
  2355.  
  2356.   procedure editusr;
  2357.   var n:integer;
  2358.   begin
  2359.     if checkcur then exit;
  2360.     n:=lookupuser (m.sentby);
  2361.     if n=0
  2362.       then writestr ('User disappeared!')
  2363.       else edituser (n)
  2364.   end;
  2365.  
  2366.   procedure infoform;
  2367.   begin
  2368.     if checkcur then exit;
  2369.     showinfoforms (m.sentby)
  2370.   end;
  2371.  
  2372.   procedure nextfeedback;
  2373.   begin
  2374.     cur:=cur+1;
  2375.     if cur>nummessages then begin
  2376.       writestr (^M'Sorry, no more feedback!');
  2377.       cur:=0;
  2378.       exit
  2379.     end;
  2380.     readnum (cur)
  2381.   end;
  2382.  
  2383.   procedure readagain;
  2384.   begin
  2385.     if checkcur then exit;
  2386.     readnum (cur)
  2387.   end;
  2388.  
  2389.   procedure replyfeedback;
  2390.   begin
  2391.     if checkcur then exit;
  2392.     sendmailto (m.sentby,false)
  2393.   end;
  2394.  
  2395.   procedure listfeedback;
  2396.   var cnt:integer;
  2397.   begin
  2398.     if nummessages=0 then exit;
  2399.     thereare (nummessages,'piece of feedback','pieces of feedback');
  2400.     if break then exit;
  2401.     writeln (^M'Num Title                          Left by'^M);
  2402.     seek (ffile,0);
  2403.     for cnt:=1 to nummessages do begin
  2404.       read (ffile,m);
  2405.       tab (strr(cnt),4);
  2406.       if break then exit;
  2407.       tab (m.title,31);
  2408.       writeln (m.sentby);
  2409.       if break then exit
  2410.     end
  2411.   end;
  2412.  
  2413.   Var q:Integer;
  2414.   Label exit;
  2415.   Begin
  2416.     Assign(ffile,bbsdatadir+'Feedback.dat');
  2417.     Reset(ffile);
  2418.     If IOResult<>0 Then Rewrite(ffile);
  2419.     cur:=0;
  2420.     Repeat
  2421.       If nummessages=0 Then Begin
  2422.         writestr('Sorry, no feedback!');
  2423.         GoTo exit
  2424.       End;{listfeed}
  2425.       writecurmsg;
  2426.  
  2427.       q:=menu ('Feedback','FEED','Q#DEIR_AL?');
  2428.       If q<0
  2429.       Then readnum(-q)
  2430.       Else Case q Of
  2431.         3:delfeedback;
  2432.         4:editusr;
  2433.         5:infoform;
  2434.         6:replyfeedback;
  2435.         7:nextfeedback;
  2436.         8:readagain;
  2437.         9:listfeedback;
  2438.        10:begin
  2439. writeln ('C╔═════════════════════════════════════╗Hs');
  2440. writeln ('uC║ Feedback Section                    ║Hs');
  2441. writeln ('uC╚═════════════════════════════════════╝HHC╔════s');
  2442. writeln ('u═════════════════════════════════╗HC║ [A]  s');
  2443. writeln ('uRead Feedback Again            ║HC║ [Ds');
  2444. writeln ('u]  Delete Feedback                ║HC║ [s');
  2445. writeln ('uE]  Edit User                      ║Hs');
  2446. writeln ('uC║ [I]  Infoforms                      s');
  2447. writeln ('u║HC║ [L]  List Feedback           s');
  2448. writeln ('u       ║HC║ [Q]  Quit             s');
  2449. writeln ('u              ║HC║ [R]  Reply to Fs');
  2450. writeln ('ueedback              ║HC║ [#]  Reas');
  2451. writeln ('ud Feedback File             ║HC║ [CRs');
  2452. writeln ('uRead Next Feedback             ║HC║ [?s');
  2453. writeln ('u]  View This Menu                 ║HC╚═A');
  2454. writeln ('C════════════════════════════════════╝');
  2455. write (^B^R' '^M);
  2456. pause;
  2457.            end;
  2458.  
  2459.       End
  2460.     Until (q=1) Or hungupon;
  2461. exit:
  2462.     Close(ffile)
  2463.   End;
  2464.  
  2465.      procedure stat;
  2466.      begin
  2467.      ansicolor (urec.statcolor)
  2468.      end;
  2469.  
  2470.      procedure prompt;
  2471.      begin
  2472.      ansicolor (urec.promptcolor)
  2473.      end;
  2474.  
  2475.      procedure yourstatus;
  2476.   var cnt,gnumsgs,gnufiles,gnugfiles,gnudbases,clicheline:integer;
  2477.      var u:userrec;
  2478.      begin
  2479.   if ansigraphics in urec.config
  2480.     then write (direct,#27'[2J');
  2481.      gnumsgs:=(messages-urec.lastmessages);
  2482.      gnufiles:=(ups-urec.lastups);
  2483.      gnugfiles:=(gfilez-urec.lastgfiles);
  2484.      gnudbases:=(dbases-urec.lastdbases);
  2485.      if gnumsgs<1 then gnumsgs:=0;
  2486.      if gnufiles<1 then gnufiles:=0;
  2487.      if gnugfiles<1 then gnugfiles:=0;
  2488.      if gnudbases<1 then gnudbases:=0;
  2489.      urec.lastmessages:=messages;
  2490.      urec.lastups:=ups;
  2491.      urec.lastgfiles:=gfilez;
  2492.      urec.lastdbases:=dbases;
  2493.      ansicolor (urec.promptcolor);
  2494.      writeln ('                         ╒═════════════════════╕');
  2495.      write ('                    ╒════╡ ');
  2496.      ansicolor (urec.statcolor);
  2497.      write ('FAQ '+ver+'/ '+date+'');
  2498.      ansicolor (urec.promptcolor);
  2499.      writeln (' ╞════╕');
  2500.      writeln (^P'                    │    ╘═════════════════════╛    │');
  2501.      write (^P'                    │ '^R'User Name  : '); ansicolor (urec.statcolor); tab (unam,17);
  2502.      ansicolor (urec.promptcolor); writeln (^P'│');
  2503.      write (^P' ┌─┤ '^R'New Status '^P'├─┐ │ '^R'User Level : ');
  2504.      ansicolor (urec.statcolor); tab (strr(ulvl),17);
  2505.      ansicolor (urec.promptcolor); writeln (^P'│');
  2506.      write (^P' │'^R'Messages : '); stat; if gnumsgs<1 then tab ('None',5) else tab (strr(gnumsgs),5);
  2507.      write (^P'│ │ '^R'Xfer Level : ');
  2508.      stat; tab (strr(urec.udlevel),17); prompt; writeln ('│ ┌─┤ '^R'File  Xfer '^P'├─┐');
  2509.      write (^P' │'^R'Databases: '); stat; if gnudbases<1 then tab ('None',5) else tab (strr(gnudbases),5);
  2510.      write (^P'│ │ '^R'Time Today : ');
  2511.      stat; tab (strr(urec.timetoday),17); prompt; write (^P'│ │'^R'Num U/Ls : '^S); if urec.uploads<1 then tab ('None',5)
  2512.      else tab (strr(urec.uploads),5);
  2513.      writeln (^P'│');
  2514.      write (^P' │'^R'Files    : '); stat; if gnufiles<1 then tab ('None',5) else tab (strr(gnufiles),5);
  2515.      write (^P'│ │ '^R'# of Calls : ');
  2516.      stat; tab (strr(urec.numon),17); prompt; write (^P'│ │'^R'Num D/Ls : '^S); if urec.downloads<1 then tab ('None',5)
  2517.      else tab (strr(urec.uploads),5);
  2518.      writeln (^P'│');
  2519.      write (^P' │'^R'G-Files  : '); stat; if gnugfiles<1 then tab ('None',5) else tab (strr(gnugfiles),5);
  2520.      write (^P'│ │ '^R'Mail Status: ');
  2521.      stat;
  2522.      cnt:=getnummail (unum);
  2523.      if cnt<1 then tab ('None',17) else tab (strr(cnt),17);
  2524.      prompt; write (^P'│ │'^R'F. Points: '^S); if urec.udpoints<1 then tab ('None',5) else tab (strr(urec.udpoints),5);
  2525.      writeln (^P'│');
  2526.      write (^P' │'^R'Hack A.  : '); stat; if urec.hack=0 then tab ('None',5) else tab (strr(urec.hack),5);
  2527.      write (^P'│ │ '^R'Last On    : ');
  2528.      stat;
  2529.           if laston<>0 then
  2530.      tab (datestr(laston),17) else
  2531.      tab ('None ',17);
  2532.      subs1.laston:=laston;
  2533.      laston:=now;
  2534.      prompt;
  2535.      writeln (^P'│ └────────────────┘');
  2536.      write (^P' └────────────────┘ │ '^R'Last Caller: '); stat; tab (getlastcaller,17); prompt; writeln ('│');
  2537.    { if useqr then begin }
  2538.      calcqr;
  2539.      write (^P'                    │ '^R'Rating     : '); stat; tab (strr(qr),17); prompt; writeln ('│');
  2540.    { end; }
  2541.      write (^P'                    │ '^R'Comments   : '); stat; tab (urec.note,17); prompt; writeln ('│');
  2542.      writeln (^P'                    ╘═══════════════════════════════╛');
  2543.      writeln;
  2544.    end;
  2545.  
  2546. procedure topposter;
  2547.       type HighestPCR=record
  2548.              Name:mstr;
  2549.              PCR:longint;
  2550.              end;
  2551.   var a,b,c,d,e,cnt,UptoDown:longint;
  2552.   done:boolean;
  2553.       TMPrec:userrec;
  2554.       Posters:array [1..5] of highestpcr;
  2555.       LamePosters:array [1..5] of highestpcr;
  2556.       Uploaders:array [1..5] of highestpcr;
  2557.       LameUploaders:array [1..5] of highestpcr;
  2558.       Downloaders:array [1..5] of highestpcr;
  2559.       LameDownloaders:array [1..5] of highestpcr;
  2560.  
  2561.       TmpPost:highestpcr;
  2562.  
  2563.  
  2564.      begin
  2565.      Writehdr ('Calculating Statistics');
  2566.  
  2567.        for cnt:=1 to 5 do begin
  2568.         Posters[cnt].pcr:=maxint;
  2569.         posters[cnt].name:='';
  2570.         lamePosters[cnt].pcr:=0;
  2571.         lameposters[cnt].name:='';
  2572.         Downloaders[cnt].pcr:=maxint;
  2573.         downloaders[cnt].name:='';
  2574.         lamedownloaders[cnt].pcr:=0;
  2575.         lamedownloaders[cnt].name:='';
  2576.                uploaders[cnt].pcr:=maxint;
  2577.         uploaders[cnt].name:='';
  2578.         lameuploaders[cnt].pcr:=0;
  2579.         lameuploaders[cnt].name:='';
  2580.  
  2581.        end;
  2582.      for cnt:=1 to numusers do begin
  2583.       seek(ufile,cnt);
  2584.       read(ufile,TmpRec);
  2585.  
  2586.         if tmprec.numon>1 then begin
  2587.  
  2588.         if tmprec.numon>0 then  d:=(tmprec.nbu*100) div tmprec.numon else d:=0;
  2589.  
  2590.  
  2591.  
  2592.       if d>0 then  begin
  2593.                           done:=false;
  2594.                 for e:=1 to 5 do begin
  2595.                  if (done=false) and (posters[e].pcr<d) then begin  { sort }
  2596.                     if e<5 then begin
  2597.                       for a:=4 downto e do begin
  2598.                         posters[a+1]:=posters[a];
  2599.                       end;
  2600.                     end;
  2601.                    posters[e].pcr:=d;
  2602.                    posters[e].name:=tmprec.handle;
  2603.                   Done:=true;
  2604.                  end;
  2605.          end;
  2606.        end;
  2607.  
  2608.         begin
  2609.                           done:=false;
  2610.                 for e:=1 to 5 do begin
  2611.                  if (done=false) and (lameposters[e].pcr>d) then begin  { sort }
  2612.                     if e>1 then begin
  2613.                       for a:=4 downto e do begin
  2614.                         lameposters[a+1]:=lameposters[a];
  2615.                       end;
  2616.                     end;
  2617.                    lameposters[e].pcr:=d;
  2618.                    lameposters[e].name:=tmprec.handle;
  2619.                   Done:=true;
  2620.                  end;
  2621.          end;
  2622.        end;
  2623.  
  2624. d:=tmprec.upk;
  2625.  
  2626.       if d>0 then  begin
  2627.                           done:=false;
  2628.                 for e:=1 to 5 do begin
  2629.                  if (done=false) and (Uploaders[e].pcr<d) then begin  { sort }
  2630.                     if e<5 then begin
  2631.                       for a:=4 downto e do begin
  2632.                         Uploaders[a+1]:=uploaders[a];
  2633.                       end;
  2634.                     end;
  2635.                    uploaders[e].pcr:=d;
  2636.                    uploaders[e].name:=tmprec.handle;
  2637.                   Done:=true;
  2638.                  end;
  2639.          end;
  2640.        end;
  2641.  
  2642.         begin
  2643.                           done:=false;
  2644.                 for e:=1 to 5 do begin
  2645.                  if (done=false) and (lameuploaders[e].pcr>d) then begin  { sort }
  2646.                     if e>1 then begin
  2647.                       for a:=4 downto e do begin
  2648.                         lameuploaders[a+1]:=lameuploaders[a];
  2649.                       end;
  2650.                     end;
  2651.                    lameuploaders[e].pcr:=d;
  2652.                    lameuploaders[e].name:=tmprec.handle;
  2653.                   Done:=true;
  2654.                  end;
  2655.          end;
  2656.        end;
  2657. d:=tmprec.downk;
  2658.  
  2659.       if d>0 then  begin
  2660.                           done:=false;
  2661.                 for e:=1 to 5 do begin
  2662.                  if (done=false) and (downloaders[e].pcr<d) then begin  { sort }
  2663.                     if e<5 then begin
  2664.                       for a:=4 downto e do begin
  2665.                         downloaders[a+1]:=downloaders[a];
  2666.                       end;
  2667.                     end;
  2668.                    downloaders[e].pcr:=d;
  2669.                    downloaders[e].name:=tmprec.handle;
  2670.                   Done:=true;
  2671.                  end;
  2672.          end;
  2673.        end;
  2674.  
  2675.         begin
  2676.                           done:=false;
  2677.                 for e:=1 to 5 do begin
  2678.                  if (done=false) and (lamedownloaders[e].pcr>d) then begin  { sort }
  2679.                     if e>1 then begin
  2680.                       for a:=4 downto e do begin
  2681.                         lamedownloaders[a+1]:=lamedownloaders[a];
  2682.                       end;
  2683.                     end;
  2684.                    lamedownloaders[e].pcr:=d;
  2685.                    lamedownloaders[e].name:=tmprec.handle;
  2686.                   Done:=true;
  2687.                  end;
  2688.          end;
  2689.        end;
  2690.  
  2691.       end;
  2692.      end;
  2693. clearscr;
  2694. writeln(^R'┌─'^P'['^S' Top Five Posters'^P' ]'^R'────────────────┐┌─'^P'['^S' Top Five Lowest Posters'^P' ]'^R'─────────┐');
  2695. writeln(^R'│'^S'User Name             Post Call Ratio'^S'││'^S'User Name             Post Call Ratio'^S'│');
  2696. writeln(^R'│'^S'1.                           '^P'[      ]'^R'││'^S'1.                           '^P'[      ]'^R'│');
  2697. writeln(^R'│'^S'2.                           '^P'[      ]'^R'││'^S'2.                           '^P'[      ]'^R'│');
  2698. writeln(^R'│'^S'3.                           '^P'[      ]'^R'││'^S'3.                           '^P'[      ]'^R'│');
  2699. writeln(^R'│'^S'4.                           '^P'[      ]'^R'││'^S'4.                           '^P'[      ]'^R'│');
  2700. writeln(^R'│'^S'5.                           '^P'[      ]'^R'││'^S'5.                           '^P'[      ]'^R'│');
  2701. writeln(^R'└─────────────────────────────────────┘└─────────────────────────────────────┘');
  2702.    movexy(4,3);write(posters[1].name);
  2703.    movexy(4,4);write(posters[2].name);
  2704.    movexy(4,5);write(posters[3].name);
  2705.    movexy(4,6);write(posters[4].name);
  2706.    movexy(4,7);write(posters[5].name);
  2707.    movexy(32,3);write(posters[1].pcr:5,'%');
  2708.    movexy(32,4);write(posters[2].pcr:5,'%');
  2709.    movexy(32,5);write(posters[3].pcr:5,'%');
  2710.    movexy(32,6);write(posters[4].pcr:5,'%');
  2711.    movexy(32,7);write(posters[5].pcr:5,'%');
  2712.    movexy(43,3);write (lameposters[1].name);
  2713.    movexy(43,4);write (lameposters[2].name);
  2714.    movexy(43,5);write (lameposters[3].name);
  2715.    movexy(43,6);write (lameposters[4].name);
  2716.    movexy(43,7);write (lameposters[5].name);
  2717.    movexy(71,3);write (lameposters[1].pcr:5,'%');
  2718.    movexy(71,4);write (lameposters[2].pcr:5,'%');
  2719.    movexy(71,5);write (lameposters[3].pcr:5,'%');
  2720.    movexy(71,6);write (lameposters[4].pcr:5,'%');
  2721.    movexy(71,7);write (lameposters[5].pcr:5,'%');
  2722.   movexy(1,14);writestr(^R'Press '^P'['^S'Return'^P']'^S': '^U'*');
  2723.   end;
  2724.  
  2725. procedure spacespace (i:integer);
  2726. var ii:integer;
  2727. begin
  2728. for ii:=1 to i do write (' ');
  2729. end;
  2730.  
  2731. end.
  2732.