diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-16 13:28:31 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-16 13:28:31 +0800 |
commit | 9c8794b3f2f27dd778286c095d739ed75231db10 (patch) | |
tree | 05482d1584f4439a3380a987ee1cc0a51438eacb /mbbsd/register.c | |
parent | 69be2d6f1e9e298496c3aa1ad329300f0dda2360 (diff) | |
download | pttbbs-9c8794b3f2f27dd778286c095d739ed75231db10.tar pttbbs-9c8794b3f2f27dd778286c095d739ed75231db10.tar.gz pttbbs-9c8794b3f2f27dd778286c095d739ed75231db10.tar.bz2 pttbbs-9c8794b3f2f27dd778286c095d739ed75231db10.tar.lz pttbbs-9c8794b3f2f27dd778286c095d739ed75231db10.tar.xz pttbbs-9c8794b3f2f27dd778286c095d739ed75231db10.tar.zst pttbbs-9c8794b3f2f27dd778286c095d739ed75231db10.zip |
- bbs: alert when replying to board fallbacks to reply-mail.
- board: prevent showing groups in 's' of boardlist.
- register: fix too old/too young error string
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4312 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/register.c')
-rw-r--r-- | mbbsd/register.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/mbbsd/register.c b/mbbsd/register.c index f60c6064..548a42bb 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -20,7 +20,9 @@ // #define DBG_DRYRUN // Dry-run test (mainly for RegForm2) #define MSG_ERR_MAXTRIES "您嘗試錯誤的輸入次數太多,請下次再來吧" -#define DATE_SAMPLE "1911/2/29" +#define MSG_ERR_TOO_OLD "年份可能有誤。 若這是您的真實生日請另行通知站務處理" +#define MSG_ERR_TOO_YOUNG "年份有誤。 嬰兒/未出生應該無法使用 BBS..." +#define DATE_SAMPLE "1911/2/29" //////////////////////////////////////////////////////////////////////////// // Password Hash @@ -806,6 +808,9 @@ new_register(void) { char birthday[sizeof("mmmm/yy/dd ")]; int y, m, d; + struct tm tm; + + localtime4_r(&now, &tm); if (++try > 20) { vmsg(MSG_ERR_MAXTRIES); @@ -822,8 +827,11 @@ new_register(void) if (ParseDate(birthday, &y, &m, &d)) { vmsg("日期格式不正確"); continue; - } else if (y < 1940) { - vmsg("你真的有那麼老嗎?"); + } else if (y < 1930) { + vmsg(MSG_ERR_TOO_OLD); + continue; + } else if (y+3 > tm.tm_year+1900) { + vmsg(MSG_ERR_TOO_YOUNG); continue; } newuser.year = (unsigned char)(y-1900); @@ -873,17 +881,17 @@ check_birthday(void) vmsg("不要複製範例! 請輸入你真實生日"); continue; } - if (ParseDate(birthday, &y, &m, &d)) { vmsg("日期格式不正確"); continue; - } else if (y < 1940) { - vmsg("你真的有那麼老嗎?"); + } else if (y < 1930) { + vmsg(MSG_ERR_TOO_OLD); continue; } else if (y+3 > tm.tm_year+1900) { - vmsg("嬰兒/未出生應該無法使用 BBS..."); + vmsg(MSG_ERR_TOO_YOUNG); continue; } + cuser.year = (unsigned char)(y-1900); cuser.month = (unsigned char)m; cuser.day = (unsigned char)d; |