int user_switchcase() { char newuserid[IDLEN+2]; modify_user_mode(USERDEF); clear(); if (count_user( )>1) { move(1,0); prints("��Ŀǰ��login��ֹһ��,���˳�����login������һ��\n"); pressreturn(); clear(); return 1; } if(HAS_PERM(PERM_BOARDS)){ move(1,0); prints("�Բ���Ŀǰ��֧�ְ������û�����Сд��������ϵ����������Ա,\n"); prints("�������а���Ȼ������ģ���������������"); pressreturn(); clear(); return 1; } getdata(0, 0, "�������µ��ʺ����� (Enter User ID): ", newuserid, IDLEN + 1, DOECHO, YEA); if(newuserid[0] == '\0'){ clear(); return 0; } if(!strcmp(currentuser.userid, newuserid)){ clear(); return 0; } if(strcasecmp(currentuser.userid, newuserid)){ move(1,0); prints("�µ��ʺ����ƺ�ԭ���ʺŲ�ͬ������ܸı��ʺŵĴ�Сд��"); pressreturn(); clear(); return 1; } if(HAS_PERM(PERM_PERSONAL)) dig_user_switchcase(newuserid); sprintf(genbuf,"mv %s/home/%C/%s %s/home/%C/%s", BBSHOME, toupper(currentuser.userid[0]),currentuser.userid, BBSHOME, toupper(newuserid[0]), newuserid); system(genbuf); sprintf(genbuf,"mv %s/mail/%C/%s %s/mail/%C/%s", BBSHOME, toupper(currentuser.userid[0]),currentuser.userid, BBSHOME, toupper(newuserid[0]), newuserid); system(genbuf); strcpy(currentuser.userid, newuserid); strcpy(uinfo.userid, newuserid); substitute_record(PASSFILE, ¤tuser, sizeof(currentuser), usernum); move(5,10); prints("���ʺŴ�Сд�ɹ���"); pressreturn(); return 0; }
int main(void){ char *date; int count; char buf[80]; while(1){ count = count_user(); date = datestr(); sprintf(buf, "%s %d\n", date, count); save2file(FILENAME3, buf); sleep(1); } }