summaryrefslogtreecommitdiffstats
path: root/mbbsd/register.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-11 01:14:01 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-11 01:14:01 +0800
commit63543835c8a092b0bf8e6d8dc0d9f29eed0e5c10 (patch)
tree9697bb9abe6159648a8afb5839a2db44fab81d56 /mbbsd/register.c
parentb0f507a8e1e368a31ab45baff849a5d064350527 (diff)
downloadpttbbs-63543835c8a092b0bf8e6d8dc0d9f29eed0e5c10.tar
pttbbs-63543835c8a092b0bf8e6d8dc0d9f29eed0e5c10.tar.gz
pttbbs-63543835c8a092b0bf8e6d8dc0d9f29eed0e5c10.tar.bz2
pttbbs-63543835c8a092b0bf8e6d8dc0d9f29eed0e5c10.tar.lz
pttbbs-63543835c8a092b0bf8e6d8dc0d9f29eed0e5c10.tar.xz
pttbbs-63543835c8a092b0bf8e6d8dc0d9f29eed0e5c10.tar.zst
pttbbs-63543835c8a092b0bf8e6d8dc0d9f29eed0e5c10.zip
- user: display over18 evalulation result
- register: reject invalid (in future) birthday input. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3985 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/register.c')
-rw-r--r--mbbsd/register.c11
1 files changed, 9 insertions, 2 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;