home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / MAIL.SWG / 0004_RemoteAccess User Viewer.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  3.7 KB  |  130 lines

  1. {
  2. AR> Could someone give me sample source code to access the RA USER FILE
  3. This should help get you started...
  4. }
  5. Program RA_User_Viewer;
  6. Uses Crt, Dos;
  7. {$I STRUCT.200}
  8. Var
  9.    UserRec : USERSrecord;
  10.    UserFile : File of USERSrecord;
  11.    SysPath,UserPath,ConfigPath : String;
  12.    SysRec: CONFIGrecord;
  13.    SysFile : File of CONFIGrecord;
  14.    X,a : Integer;
  15.    Done : Boolean;
  16.    Ch : Char;
  17.  
  18. Function FixPath(Path : String): String;
  19.     Begin
  20.     If Path[Length(Path)] <> '\' Then
  21.         Path := Path+'\';
  22.      FixPath := Path;
  23.     End;
  24. procedure drawscreen;
  25. begin;
  26.     textattr:=14;
  27.     gotoxy(25,1);
  28.    write(' Remote Access User Viewer');
  29.    textattr:=$01;
  30.    gotoxy(1,2);
  31.    for a:=1 to 80 do write('═');
  32.    gotoxy(1,23);
  33.    for a:=1 to 80 do write('─');
  34.    textattr:=15;
  35.    gotoxy(11,24);
  36.    Write('(PgUp) Last User     (PgDn) Next User     (ESC) Exit');
  37. end;
  38.  
  39. Begin
  40.    ClrScr;
  41.    SysPath := GetEnv('RA');           {[drive]:\RA}
  42.        SysPath := Fixpath(SysPath);   {[drive]:\RA\}
  43.        ConfigPath := SysPath + 'CONFIG.RA'; {[drive]:\RA\CONFIG.RA}
  44.    {$I-}
  45.    Assign(SysFile,ConfigPath);
  46.    Reset(SysFile);
  47.     {$I+}
  48.     If IOresult <> 0 then Begin
  49.     WriteLn(' Error Reading ',ConfigPath);
  50.     WriteLn(' Exiting with Errorlevel 1');
  51.     Halt(1);  {Exit at errorlevel 1,[drive]:\RA\CONFIG.RA not Found}
  52.     End;      {Is the enviroment variable set?}
  53.    read(SysFile,SysRec); {open up CONFIG.RA and find the Path to the}
  54.                          { Messsage base,(where users.bbs is stored) }
  55.    Close(SysFile);
  56.    UserPath := FixPath(SysRec.MsgBasePath); { here it is! }
  57.    UserPath:=UserPath + 'USERS.BBS';
  58.    {$I-}
  59.    Assign(UserFile,UserPath);
  60.    Reset(UserFile);
  61.    {$I+}
  62.     If IOresult <> 0 then Begin
  63.      WriteLn(' Error Reading ',UserPath);
  64.      WriteLn(' Exiting with Errorlevel 2');
  65.      Halt(2);{Exit At Errorlevel 2,[drive]:\Msgbase\Users.bbs not found}
  66.     End;
  67.    X := 0;
  68.    Done := False;
  69. Repeat
  70.    textattr:=$07;
  71.    ClrScr;
  72.    Seek(UserFile, X);
  73.    Read(UserFile, UserRec);
  74.    gotoxy(1,3);
  75.    with UserRec do
  76.    Begin
  77.    Writeln('User #    : ',X+1);
  78.    Writeln('Name      : ',Name);
  79.    Writeln('Handle    : ',Handle);
  80.    WriteLn('Security  : ',Security);
  81.    WriteLn('Location  : ',Location);
  82.    WriteLn('Data #    : ',DataPhone);
  83.    WriteLn('Home #    : ',VoicePhone);
  84.    WriteLn('Birthday  : ',BirthDate);
  85.    Write('Last Call : ',LastDate);
  86.    WriteLn(' ',Lasttime);
  87.           case Sex of
  88.                1 : writeln ('Sex       : Male');
  89.                2 : writeln ('Sex       : Female');
  90.               else writeln ('Sex       : Unknown');
  91.             end;
  92.    WriteLn('Addr 1    : ',Address1);
  93.    WriteLn('Addr 2    : ',Address2);
  94.    WriteLn('Addr 3    : ',Address3);
  95.    Writeln('Msg''s Posted : ',Msgsposted);
  96.    Writeln('Last Read    : ',Lastread);
  97.    Writeln('Msg Group    : ',Msggroup);
  98.    Writeln('Msg Area     : ',Msgarea);
  99.    WriteLn('Comment      : ',Comment);
  100.    gotoxy(46,3);
  101.    writeln('Files Downloaded   : ',Downloads);
  102.    gotoxy(46,4);
  103.    writeln('Download Kilobytes : ',Downloadsk);
  104.    gotoxy(46,5);
  105.    Writeln('Files Uploaded     : ',Uploads);
  106.    gotoxy(46,6);
  107.    writeln('Upload Kilobytes   : ',Uploadsk);
  108.    gotoxy(46,7);
  109.    writeln('Credits  : ',Credit);
  110.    gotoxy(46,8);
  111.    writeln('Protocol : ',DefaultProtocol);
  112.    gotoxy(46,9);
  113.    writeln('Language : ',Language);
  114.    gotoxy(46,10);
  115.    writeln('Number of Calls :',NoCalls);
  116.    end; {with}
  117.     drawscreen;
  118.     Ch := Readkey;
  119.    if (ch=#0) then ch:=readkey;
  120.    Case ch Of
  121.      #81 : If X < FileSize(UserFile)-1 Then Inc(X);
  122.      #73 : If X > 0 Then Dec(X);
  123.      #27 : Done := True;
  124. end;
  125. Until done;
  126. Close(UserFile);
  127. textattr:=$07;
  128. clrscr;
  129. End.
  130.