From fcbf0439c1fcd12272854b0ed098bc1ecedb10a0 Mon Sep 17 00:00:00 2001 From: piaip Date: Wed, 30 Jan 2008 12:54:02 +0000 Subject: - fix over18 calculation git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3888 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mbbsd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index cd7211e5..b350637b 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1120,10 +1120,16 @@ user_login(void) mysrand(); /* check if over18 */ - if( (ptime.tm_year - cuser.year) >= 18 || - (ptime.tm_year - cuser.year == 17 && - ((ptime.tm_mon+1) > cuser.month || - ((ptime.tm_mon+1) == cuser.month && ptime.tm_mday > cuser.day))) ) + // ·Ó¹ê·³­pºâ + if( (ptime.tm_year - cuser.year) > 18) + over18 = 1; + else if (ptime.tm_year - cuser.year < 18) + over18 = 0; + else if ((ptime.tm_mon+1) > cuser.month) + over18 = 1; + else if ((ptime.tm_mon+1) < cuser.month) + over18 = 0; + else if (ptime.tm_mday >= cuser.day ) over18 = 1; log_usies("ENTER", fromhost); -- cgit v1.2.3