home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!uakari.primate.wisc.edu!doug.cae.wisc.edu!umn.edu!kksys.com!orbit!pnet51!dt
- From: dt@pnet51.orb.mn.org (Ryan Williams)
- Newsgroups: comp.lang.pascal
- Subject: need help with data bases!
- Message-ID: <8157@orbit.cts.com>
- Date: 27 Jul 92 06:45:14 GMT
- Sender: news@orbit.cts.com
- Organization: People-Net [pnet51], Minneapolis, MN.
- Lines: 419
-
-
-
-
- type Sex = (Male,Female);
-
- User = record
-
- UserName : string[25];
-
- UserNum : integer;
-
- Location : string[25];
-
- Gender : sex;
-
- PhoneNum : String[8];
-
- Password : string[12];
-
- UserLevl : integer;
-
- End;
-
- Mesgs = record
-
- From : string[20];
-
- MTo : string[20];
-
- Subject : string[30];
-
- ENd;
-
-
-
-
-
- var
-
- UNumRd : word;
-
- UNumWr : word;
-
- events : text;
-
- Chatstatus : boolean;
-
- Usern : integer;
-
- Pass : string[12];
-
- Mch : char;
-
- TimeOut : integer;
-
- Yn : boolean;
-
- Password : string;
-
- Yesn : char;
-
- GetOff : boolean;
-
- Year, Month, Day, Dayofweek : word;
-
- Hour, Minute, Second, Sec100: word;
-
- CCycle : integer;
-
- UserFile : file of User;
-
-
-
-
-
- procedure Startup;
-
-
-
- begin
-
- assign(UserFile,'USERS.FIL');
-
- reset(UserFile);
-
- close(UserFile);
-
- assign(events,'EVENTS.TXT');
-
- Append(events);
-
- Gettime(Hour,Minute,Second,Sec100);
-
- Writeln(events,'System brought up at ',Ret_Date,' @ ',Ret_Time);
-
- Close(events);
-
- LastUser:='Nobody';
-
- End;
-
-
-
-
-
-
-
- procedure NewUserP;
-
-
-
- type sex=(Male,Female);
-
-
-
-
-
- var
-
- NewUser : User;
-
- UserName : String[25];
-
- PhoneNum : String[8];
-
- Location : String[25];
-
- Password : String[12];
-
- Age : integer;
-
- Good : Boolean;
-
- CCCycle : integer;
-
- Chr : char;
-
- gender : sex;
-
- response : char;
-
- A : byte;
-
- UserNum : integer;
-
-
-
- const
-
- UserLevl : integer = 2;
-
-
-
- begin
-
- {whatever}
-
- with NewUser do
-
- ClrScr;
-
- Good:=TRUE;
-
- repeat
-
- repeat
-
- Write('What is your name?');
-
- Readln(UserName);
-
- until not (Username='');
-
- Good:=TRUE;
-
- For CCycle:=1 to Totusers do
-
- if UserName=UserNm[CCycle] then begin
-
- Writeln('Sorry, that name is already in
- use.');
-
- Good:=FALSE;
-
- End;
-
- if Copy(UserName,1,1)='0' then Good:=FALSE;
-
- if Copy(UserName,1,1)='1' then good:=false;
-
- if Copy(username,1,1)='2' then good:=false;
-
- if copy(username,1,1)='3' then good:=false;
-
- if copy(username,1,1)='4' then good:=false;
-
- if copy(username,1,1)='5' then good:=false;
-
- if copy(username,1,1)='6' then good:=false;
-
- if copy(username,1,1)='7' then good:=false;
-
- if copy(username,1,1)='8' then good:=false;
-
- if COpy(UserName,1,1)='9' then good:=false;
-
- until Good=TRUE;
-
- repeat
-
- Write('Where are you calling from?');
-
- Readln(Location);
-
- until not (Location='');
-
- repeat
-
- Write('What is your age?');
-
- Readln(Age);
-
- until not (Age=0);
-
- Write('Are you male or female? [M,F] ');
-
- repeat
-
- response:=UpCase(GetChar);
-
- until (response='M') or (response='F');
-
- If Response='M' then Gender:=Male;
-
- If response='F' then Gender:=Female;
-
- Writeln('');
-
- repeat
-
- Writeln('What is your phone number?');
-
- Writeln('Write in form: xxx-xxxx');
-
- Write('Number?');
-
- Readln(PhoneNum);
-
- Good:=TRUE;
-
- if Copy(PhoneNum,1,1)='1' then Good:=FALSE; {fake number trapping}
-
- If Copy(PhoneNum,1,1)='0' then Good:=FALSE;
-
- If Copy(PhoneNum,1,3)='911' then Good:=FALSE;
-
- If PhoneNum='' then Good:=FALSE;
-
- If PhoneNum='PRI-VATE' then Good:=FALSE;
-
- If PhoneNum=BBSNumber then GOod:=FALSE;
-
- until Good=TRUE;
-
- repeat
-
- Write('What would you like to use for a password?');
-
- Readln(Password);
-
- until not (Password='');
-
- For A:=1 to length(Password) do
-
- Password[A]:= upcase(Password[A]);
-
- ClrScr;
-
- Writeln(' Alias: ',UserName);
-
- Writeln(' Gender: ',Response);
-
- Writeln(' Password: ',Password);
-
- Writeln(' Phone # ',PhoneNum);
-
- Writeln('Calling from: ',Location);
-
- Writeln('');
-
- Write('Is all this information correct? (y/n)');
-
- Yn:=KeyPressed;
-
- Mch:=GetChar;
-
- If Mch='N' then NewUserP;
-
- UserNum:=1;
-
- UserLevl:=2;
-
- reset(UserFile);
-
- Seek(userfile,usernum-1);
-
- Write(Userfile,NewUser);
-
- close(Userfile);
-
- Append(events);
-
- Writeln(events,'New user logon: ',UserName,' ',Ret_Date,' @ ',Ret_Time);
-
- close(events);
-
- End;
-
-
-
-
-
- procedure InfoCenter;
-
-
-
- var
-
- NewUser : User;
-
- UserName : string[25];
-
- Location : string[24];
-
- Phonenum : string[8];
-
- Password : string[12];
-
- Gender : sex;
-
- index : integer;
-
- Usernum : integer;
-
- inch : string;
-
-
-
- begin
-
- ClrScr;
-
- repeat
-
- Write('Information>');
-
- Yn:=KeyPressed;
-
- Mch:=GetChar;
-
- case Mch of
-
- 'L','U' : begin
-
- Usernum:=0;
-
- index:=0;
-
- ClrScr;
-
- Writeln('User List:');
-
- Writeln('NAME---------------|LOCATION------------');
-
- {$I-} reset(UserFile) {$I+};
-
- if IOresult<>0 then rewrite(UserFile);
-
- while (usernum=0) and not eof(Userfile) do begin
-
- index:=index+1;
-
- Read(UserFile,User(newuser));
-
- Writeln(newuser.UserName);
-
- Writeln(newuser.Password);
-
- Writeln(newuser.Location);
-
- Writeln(newuser.PhoneNum);
-
- End;
-
- str(filesize(userfile):1,inch);
-
- writeln('there are ',inch,' users.');
-
- close(userfile);
-
- End;
-
- {I took the rest out since it wasn't neccesary}
-
-
-
- When the program's booted up, it runs StartUp. NewuserP is the
-
- new user application program. The InfoCenter procedure contains the 'user
-
- list' that I have trouble with. All that's shown in this user list
-
- is complete garbage. Can anyone help me? If you want to see the full source
-
- code(if it helps), just ask.....
-
-
-
-
-