home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
WWIV2.ZIP
/
LILO.C
< prev
next >
Wrap
Text File
|
1995-12-13
|
18KB
|
619 lines
#include "vars.h"
#pragma hdrstop
void getuser(void)
{
char s[81],s2[81],s3[81],s4[50],*ss;
int ok,count,net_only,ans,i;
long l;
FILE *f;
thisuser.sysstatus &= (~sysstatus_ansi);
net_only=1;
if (syscfg.netlowtime!= syscfg.nethightime) {
if (syscfg.nethightime>syscfg.netlowtime) {
if ((timer()<=(syscfg.netlowtime*60.0)) || (timer()>=(syscfg.nethightime*60.0)))
net_only=0;
} else {
if ((timer()<=(syscfg.netlowtime*60.0)) && (timer()>=(syscfg.nethightime*60.0)))
net_only=0;
}
} else
net_only=0;
count=0;
ok=0;
checkit=1;
okmacro=0;
actsl=syscfg.newusersl;
if ((!net_only) && (incom)) {
sprintf(s,"%sWELCOME.ANS",languagedir);
if (exist(s)) {
nl();
#ifdef OLD
outstr("Can you support ANSI graphics? ");
thisuser.sysstatus=0;
ans=yn();
#else
ans=check_ansi();
#endif
if (ans>0) {
printfile("welcome.ans");
printfile("games.msg");
} else if (ans==0) {
printfile("welcome.msg");
printfile("games.msg");}
} else {
printfile("welcome.msg");
printfile("games.msg"); }
}
if (curatr!=7)
reset_colors();
do {
nl();
if (net_only) {
pl(get_string(353));
pl(get_string(354));
} else
pl("If you call waiting is not disabled or someone might pick up");
pl("the phone during your call, hit [Enter] three times so the");
pl("BBS will disconnect you, and call back when you are sure that");
pl("nothing will abruptly interrupt your call.");
pl(get_string(355));
outstr(get_string(356)); /* DON'T change the NN: prompt. */
input(s,30);
usernum=finduser(s);
if ((net_only) && (usernum!=-2))
usernum=0;
if (usernum>0) {
read_user(usernum,&thisuser);
read_qscn(usernum,qsc,0);
actsl = syscfg.newusersl;
topscreen();
ok=1;
outstr("1Password7 : ");
echo=0;
input(s,8);
if (strcmp(s,thisuser.pw)!=0)
ok=0;
if ((syscfg.sysconfig & sysconfig_free_phone)==0) {
outstr("1Phone ■■■7-1■■■7-1");
echo=0;
input(s2,4);
if (strcmp(s2,&thisuser.phone[8])!=0) {
ok=0;
if ((strlen(s2)==4) && (s2[3]=='-')) {
nl();
pl("6!! 5Enter the last 4 digits of your phone number only 6!!");
nl();
}
}
}
if ((thisuser.sl==255) && (incom) && (ok)) {
outstr("1System PW 7: ");
echo=0;
input(s,20);
if (strcmp(s,syscfg.systempw)!=0)
ok=0;
}
echo=1;
if (ok) {
reset_act_sl();
changedsl();
} else {
++thisuser.illegal;
write_user(usernum,&thisuser);
close_user();
nl();
pl("6ILLEGAL LOGON!");
nl();
sprintf(s3,get_stringx(1,21),
nam(&thisuser,usernum),
ctim(timer()),
s);
if ((syscfg.sysconfig & sysconfig_free_phone)==0) {
sprintf(s4,get_stringx(1,22),s2);
strcat(s3,s4);
}
sl1(0,"");
sl1(0,s3);
sl1(0,"");
usernum=0;
}
} else
if (usernum==-1) {
newuser();
ok=1;
} else
if (usernum==0) {
if (net_only)
nl();
else
pl("6Unknown User");
} else
if ((usernum==-2) || (usernum==-3) || (usernum==-4)) {
if (incom) {
save_status();
time(&l);
s2[0]=0;
switch(usernum) {
case -2:
sprintf(s2,"NETWORK /B%u /T%ld /F%u",modem_speed,l,modem_flag);
run_external1(s2);
break;
case -3:
sprintf(s2,"REMOTE /B%u /F%u",modem_speed,modem_flag);
run_external1(s2);
break;
case -4:
s[8]=0;
if (s[0]) {
sprintf(s2,"%s /B%u /F%u",s,modem_speed,modem_flag);
sprintf(s3,"%sREMOTES.DAT",syscfg.datadir);
f=fopen(s3,"rt");
if (f) {
ok=0;
while ((!ok) && (fgets(s3,80,f))) {
ss=strchr(s3,'\n');
if (ss)
*ss=0;
if (stricmp(s3,s)==0)
ok=1;
}
fclose(f);
if (ok) {
shrink_out(s2, -1, 0, 0, 1);
run_external1(s2);
}
}
}
break;
}
l=status.qscanptr;
get_status();
if (l!=status.qscanptr) {
for (i=0; i<num_subs; i++) {
sub_dates[i]=0L;
}
}
hangup=1;
dtr(0);
global_xx=0;
wait(1.0);
dtr(1);
wait(0.1);
cleanup_net();
imodem(0);
}
hangup=1;
}
} while ((!hangup) && (!ok) && (++count<3));
if (count==3)
hangup=1;
checkit=0;
okmacro=1;
if ((!hangup) && (usernum>0) && (thisuser.restrict & restrict_logon) &&
(strcmp(date(),thisuser.laston)==0) && (thisuser.ontoday>0)) {
nl();
pl("1Sorry, you can only logon once per day.");
nl();
hangup=1;
}
}
void logon(void)
{
char s[255],s1[181],s2[81],*ss;
int i,i1,f;
long len,pos;
if (usernum<1) {
hangup=1;
return;
}
if (live_user) {
reset_colors();
ansic(0);
outchr(12);
}
if (incom && live_user) {
i=printfile("LOGON");
if ((!i) && (!(thisuser.sysstatus & sysstatus_pause_on_page)))
pausescr();
}
strcpy(xdate,date());
if (strcmp(xdate,thisuser.laston)==0)
++thisuser.ontoday;
else {
thisuser.ontoday=1;
thisuser.timeontoday=0.0;
thisuser.extratime=0.0;
thisuser.posttoday=0;
thisuser.etoday=0;
thisuser.fsenttoday1=0;
}
++thisuser.logons;
cursub=0;
msgreadlogon=0;
if (udir[0].subnum==0)
curdir=1;
else
curdir=0;
curdloads=0;
if (actsl!=255) {
++status.callernum1;
++status.callstoday;
}
sprintf(s,"%ld: %s %s %s %s - %d",
status.callernum1,
nam(&thisuser,usernum),
times(),
date(),
curspeed,
thisuser.ontoday);
sprintf(s2,"%sLASTON.TXT",syscfg.gfilesdir);
ss=get_file(s2,&len);
pos=0;
if (ss!=NULL) {
if (!cs())
for (i=0; i<4; i++)
copy_line(s1,ss,&pos,len);
i=1;
do {
copy_line(s1,ss,&pos,len);
if ((s1[0]) && live_user) {
if (i) {
i=0;
nl();
nl();
pl("7╓══════════════════════════════════════════════════════════╖");
pl("7║ 2Last Few Callers7 ║");
pl("7╠══════════════════════════════════════════════════════════╣");
pl("7║ Caller User Speed-On Today ║");
}
pl(s1);
}
} while (pos<len);
}
if ((actsl!=255) || (incom)) {
sl1(0,"");
sl1(0,s);
sl1(1,"");
sprintf(s,"7║ 1%-5ld3: 1%-35s %-6s 3- 1%-2d7 ║\r\n",
status.callernum1,
nam(&thisuser,usernum),
curspeed,
thisuser.ontoday);
sprintf(s1,"%sUSER.LOG",syscfg.gfilesdir);
f=open(s1,O_RDWR | O_BINARY | O_CREAT, S_IREAD | S_IWRITE);
lseek(f,0L,SEEK_END);
i=strlen(s);
if (actsl!=255) {
write(f,(void *)s,i);
close(f);
f=open(s2,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
pos=0;
copy_line(s1,ss,&pos,len);
for (i=1; i<8; i++) {
copy_line(s1,ss,&pos,len);
strcat(s1,"\r\n");
write(f,(void *)s1,strlen(s1));
}
write(f,(void *)s,strlen(s));
close(f);
} else
close(f);
}
pl("7╚══════════════════════════════════════════════════════════╝");
if (ss!=NULL)
farfree(ss);
if (live_user)
read_automessage();
timeon=timer();
useron=1;
if (live_user)
topscreen();
if ((syscfg.logon_c[0]) && live_user) {
nl();
stuff_in(s,syscfg.logon_c,create_chain_file("CHAIN.TXT"),"","","","");
full_external(s,0,1);
nl();
nl();
}
if (live_user) {
nl();
pl("5┌──────────────────────────────────────────────────────────────────────────┐");
pl("5│ 2 Your Information 5 │");
pl("5│ │");
npr("5│ 3Name 5: 3%-31s Real name5: 3%-21s5│\r\n",nam(&thisuser,usernum),thisuser.realname);
npr("5│ 3Address5: 3%-31s %-31s5 │\r\n",thisuser.street,thisuser.city);
npr("5│ 3Phone 5: 3%-13s %-13s5 │\r\n",thisuser.phone,thisuser.dataphone);
npr("5│ │\r\n");
npr("5│ 1Please let the sysop know if any of this information is incorrect7.5 │\r\n");
pl("5└──────────────────────────────────────────────────────────────────────────┘");
nl();
pausescr();
outchr(12);
nl();
pl("7┌──────────────────────────────────────────────────────────────────────────┐");
pl("7│ 1Your Stats 7 │");
pl("7│ │");
npr("7│ 1SL 7:1%-3d DSL 7:1%-32d7│\r\n",thisuser.sl,thisuser.dsl);
npr("7│ 1Laston 7:1%-9s Times on 7:1%-6d On today 7:1%-8d7│\r\n",thisuser.laston,thisuser.logons,thisuser.ontoday);
npr("7│ 1Time on 7:1%-10ld Illegal logons7:1%-4d Mail7 :1%-8d7│\r\n",(long)((thisuser.timeon+timer()-timeon)/60.0),thisuser.illegal,thisuser.waiting);
npr("7│ 1Msgs Posted7:1%-10d E-mail sent 7:1%-10d P/C Ratio7:1%-5.3f 7│\r\n",thisuser.msgpost,thisuser.emailsent,post_ratio());
npr("7│ 1ULk 7:1%-10ld DLk 7:1%-10ld U/D Ratio7:1%-6.3f 7│\r\n",thisuser.uk,thisuser.dk,ratio());
npr("7│ 1Ass points 7:1%-3d Time allowed 7:1%-32d7│\r\n",thisuser.ass_pts,(int)((nsl()+30)/60.0));
npr("7│ 1Personal Tag 7:1%-58s7│\r\n",thisuser.ptag);
pl("7└──────────────────────────────────────────────────────────────────────────┘");
nl();
pausescr();
outchr(12);
pl("5┌─────────────────────────────────────────────┐");
pl("5│3 System Information 5 │");
pl("5│ │");
npr("5│2 Total number of users5:2%-22d5│\r\n",status.users);
npr("5│2 Total number of calls5:2%-22d5│\r\n",status.callernum1);
npr("5│2 Calls today 5:2%-22d5│\r\n",status.callstoday);
npr("5│2 Msgs posted today 5:2%-22d5│\r\n",status.msgposttoday);
npr("5│2 Uploads today 5:2%-22d5│\r\n",status.uptoday);
npr("5│2 WWIV Registration 5:2%-22ld5│\r\n",syscfg.wwiv_reg_number);
if (!sysop2())
npr("5│2 Sysop is 5:2Out LLama Tipping! 5│\r\n");
else
npr("5│2 Sysop is 5:2Available for chat! 5│\r\n");
npr("5│2 WWIV version is 5:2%-22s5│\r\n",wwiv_version);
npr("5│2 Network version is 5:2%-22u5│\r\n",status.net_version);
npr("5│2 Networks : 5│\r\n");
for (i=0; i<net_num_max; i++) {
if (net_networks[i].sysnum) {
sprintf(s,"5│ 2%-14s %s",net_networks[i].name, get_string(370));
for (i1=strlen(s); i1<15; i1++)
s[i1]=' ';
s[i1]=0;
sprintf(s1,"2%-5s 5: 2@%-20u5│",s,net_networks[i].sysnum);
if (i)
pl(s1);
else {
for (i1=strlen(s1); i1<23; i1++)
s1[i1]=' ';
s1[i1]=0;
npr("2%s\r\n",s1);
}
}
}
pl("5└─────────────────────────────────────────────┘");
nl();
if (thisuser.forwardusr) {
if (thisuser.forwardsys) {
set_net_num(thisuser.net_num);
if (!valid_system(thisuser.forwardsys)) {
thisuser.forwardusr=0;
thisuser.forwardsys=0;
strcpy(s1,get_string(371));
} else {
strcpy(s1,get_string(372));
if (net_num_max>1)
sprintf(s2,"%s #%u @%u.",
net_name,thisuser.forwardusr,thisuser.forwardsys);
else
sprintf(s2,"#%u @%u.",
thisuser.forwardusr,thisuser.forwardsys);
strcat(s1,s2);
}
} else {
if (thisuser.forwardusr==65535)
strcpy(s1,get_string(373));
else {
strcpy(s1,get_string(372));
sprintf(s2,"#%u.",thisuser.forwardusr);
strcat(s1,s2);
}
}
pl(s1);
nl();
}
if (ltime) {
nl();
pl(get_string(374));
nl();
}
fsenttoday=0;
if (thisuser.year) {
s[0]=years_old(thisuser.month,thisuser.day,thisuser.year);
if (thisuser.age!=s[0]) {
thisuser.age=s[0];
topscreen();
}
} else {
nl();
pl(get_string(375));
do {
nl();
input_age(&thisuser);
sprintf(s,"%02d/%02d/%02d",(int) thisuser.month,
(int) thisuser.day,
(int) thisuser.year);
nl();
outstr(s);
outstr(get_string(376));
if (!yn())
thisuser.year=0;
} while ((!hangup) && (thisuser.year==0));
}
if (syscfg.sysconfig & sysconfig_extended_info) {
if (!thisuser.street[0])
input_street();
if (!thisuser.city[0])
input_city();
if (!thisuser.state[0])
input_state();
if (!thisuser.country[0])
input_country();
if (!thisuser.zipcode[0])
input_zipcode();
if (!thisuser.dataphone[0])
input_dataphone();
}
topscreen();
nl();
rsm(usernum,&thisuser);
if (thisuser.waiting) {
prt(5,get_string(377));
if (yn())
readmail();
}
}
nscandate=thisuser.daten;
batchtime=0.0;
numbatchdl=numbatch=0;
i1=0;
for (i=0; i<20; i++) {
if (questused[i])
if (thisuser.votes[i]==0)
i1=1;
}
if (restrict_vote & thisuser.restrict)
i1=0;
if (actsl<=10)
i1=0;
if (i1 && live_user) {
nl();
prt(3,get_string(378));
nl();
pausescr();
vote();
nl();
nl();
}
i=0;
express=0;
expressabort=0;
qscan(cursub,&i);
nl();
prt(5,"Scan for new messages? ");
if(ny()) {
express=0;
expressabort=0;
nscan(0);
}
save_status();
create_chain_file("CHAIN.TXT");
}
void logoff(void)
{
long l;
int f,r,w,t,i;
char s[81];
mailrec m;
shortmsgrec sm;
double ton;
dtr(0);
hangup=1;
if (usernum<1)
return;
thisuser.lastrate=modem_speed;
strcpy(thisuser.laston,xdate);
thisuser.illegal=0;
if ((timer()-timeon)<-30.0)
timeon-=24.0*3600.0;
ton=timer()-timeon;
thisuser.timeon += ton;
thisuser.timeontoday += (ton-extratimecall);
status.activetoday += (int) (ton/60.0);
save_status();
time(&l);
thisuser.daten=l;
close_user();
write_user(usernum,&thisuser);
write_qscn(usernum,qsc,0);
close_user();
sprintf(s,get_stringx(1,23),msgreadlogon,
(int)((timer()-timeon)/60.0));
if ((incom) || (actsl!=255))
sl1(0,s);
if (mailcheck) {
sprintf(s,"%sEMAIL.DAT",syscfg.datadir);
f=open(s,O_BINARY | O_RDWR);
if (f!=-1) {
t=(int) (filelength(f)/sizeof(mailrec));
r=0;
w=0;
while (r<t) {
lseek(f,(long)(sizeof(mailrec)) * (long)(r),SEEK_SET);
read(f,(void *)&m,sizeof(mailrec));
if ((m.tosys!=0) || (m.touser!=0)) {
if (r!=w) {
lseek(f,(long)(sizeof(mailrec)) * (long)(w),SEEK_SET);
write(f,(void *)&m,sizeof(mailrec));
}
++w;
}
++r;
}
chsize(f,(long)(sizeof(mailrec)) * (long)(w));
close(f);
}
}
if (smwcheck) {
sprintf(s,"%sSMW.DAT",syscfg.datadir);
f=open(s,O_BINARY | O_RDWR);
if (f!=-1) {
t=(int) (filelength(f)/sizeof(shortmsgrec));
r=0;
w=0;
while (r<t) {
lseek(f,(long)(sizeof(shortmsgrec)) * (long)(r),SEEK_SET);
read(f,(void *)&sm,sizeof(shortmsgrec));
if ((sm.tosys!=0) || (sm.touser!=0)) {
if (r!=w) {
lseek(f,(long)(sizeof(shortmsgrec)) * (long)(w),SEEK_SET);
write(f,(void *)&sm,sizeof(shortmsgrec));
}
++w;
}
++r;
}
chsize(f,(long)(sizeof(shortmsgrec)) * (long)(w));
close(f);
}
}
remove_from_temp("*.*", syscfg.tempdir, 0);
remove_from_temp("*.*", syscfg.batchdir, 0);
if (numbatch && (numbatch != numbatchdl)) {
for (i=0; i<numbatch; i++) {
if (!batch[i].sending) {
didnt_upload(i);
}
}
}
numbatch=numbatchdl=0;
}