diff options
-rw-r--r-- | mbbsd/register.c | 11 | ||||
-rw-r--r-- | mbbsd/user.c | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/mbbsd/register.c b/mbbsd/register.c index 2950fae4..ec79f1c6 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -672,8 +672,12 @@ check_birthday(void) { // check birthday int changed = 0; - - while (cuser.year < 40) // magic number 40: see user.c + time_t t = (time_t)now; + struct tm tm; + + localtime_r(&t, &tm); + while ( cuser.year < 40 || // magic number 40: see user.c + cuser.year+3 > tm.tm_year) { char birthday[sizeof("mmmm/yy/dd ")]; int y, m, d; @@ -692,6 +696,9 @@ check_birthday(void) } else if (y < 1940) { vmsg("你真的有那麼老嗎?"); continue; + } else if (y+3 > tm.tm_year+1900) { + vmsg("嬰兒/未出生應該無法使用 BBS..."); + continue; } cuser.year = (unsigned char)(y-1900); cuser.month = (unsigned char)m; diff --git a/mbbsd/user.c b/mbbsd/user.c index c077280a..47cfb674 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -146,10 +146,10 @@ user_display(const userec_t * u, int adminmode) sethomedir(genbuf, u->userid); prints(" 私人信箱: %d 封 (購買信箱: %d 封)\n" " 手機號碼: %010d\n" - " 生 日: %04i/%02i/%02i\n", + " 生 日: %04i/%02i/%02i (%s滿18歲)\n", get_num_records(genbuf, sizeof(fileheader_t)), u->exmailbox, u->mobile, - u->year + 1900, u->month, u->day + u->year + 1900, u->month, u->day, over18 ? "已" : "未" ); #ifdef ASSESS |