From d4ca75df642237f81a2958fb395df41083e5c173 Mon Sep 17 00:00:00 2001 From: kcwu Date: Sat, 19 Mar 2005 13:03:03 +0000 Subject: statistic for user's first login today git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2653 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/statistic.h | 3 +++ mbbsd/mbbsd.c | 12 +++++++++--- util/shmctl.c | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/statistic.h b/include/statistic.h index e2e6b61b..81ad937b 100644 --- a/include/statistic.h +++ b/include/statistic.h @@ -30,6 +30,9 @@ enum { // XXX description in shmctl.c STAT_DOPOST, STAT_READPOST, STAT_RECOMMEND, + STAT_TODAYLOGIN_MIN, + STAT_TODAYLOGIN_MAX, + /* insert here. don't forget update shmctl.c */ STAT_NUM, STAT_MAX=512 }; diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 9d8bdc1e..78a4c24d 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -906,7 +906,7 @@ inline static void foreign_warning(void){ static void user_login(void) { - struct tm ptime; + struct tm ptime, lasttime; int nowusers, ifbirth = 0, i; /* get local time */ @@ -961,6 +961,7 @@ user_login(void) setup_utmp(LOGIN); currmode = MODE_STARTED; enter_uflag = cuser.uflag; + lasttime = *localtime4(&cuser.lastlogin); if ((nowusers = SHM->UTMPnumber) > SHM->max_user) { SHM->max_user = nowusers; @@ -982,7 +983,7 @@ user_login(void) welcome_msg(); if( ifbirth ){ - birthday_make_a_wish(&ptime, localtime4(&(cuser.lastlogin))); + birthday_make_a_wish(&ptime, &lasttime); if( getans("是否要顯示「壽星」於使用者名單上?(y/N)") == 'y' ) currutmp->birth = 1; } @@ -998,9 +999,14 @@ user_login(void) pressanykey(); check_mailbox_quota(); } + if(ptime.tm_yday!=lasttime.tm_yday) + STATINC(STAT_TODAYLOGIN_MAX); - if (!PERM_HIDE(currutmp)) + if (!PERM_HIDE(currutmp)) { + if(ptime.tm_yday!=lasttime.tm_yday) + STATINC(STAT_TODAYLOGIN_MIN); cuser.lastlogin = login_start_time; + } #if FOREIGN_REG_DAY > 0 foreign_warning(); diff --git a/util/shmctl.c b/util/shmctl.c index 411562d2..26a7e67b 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -928,6 +928,8 @@ int showstat(int argc, char *argv[]) "STAT_DOPOST", "STAT_READPOST", "STAT_RECOMMEND", + "STAT_TODAYLOGIN_MIN", + "STAT_TODAYLOGIN_MAX", }; if(argv[1] && strcmp(argv[1],"-c")==0) -- cgit v1.2.3