summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/register.c38
-rw-r--r--mbbsd/user.c4
2 files changed, 41 insertions, 1 deletions
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 1df379bf..e2b3a6b3 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -374,10 +374,48 @@ new_register(void)
log_usies("REGISTER", fromhost);
}
+void
+check_birthday(void)
+{
+ // check birthday
+ int changed = 0;
+
+ while (cuser.year < 40) // magic number 40: see user.c
+ {
+ char birthday[sizeof("mmmm/yy/dd ")];
+ int y, m, d;
+
+ clear();
+ stand_title("輸入生日");
+ move(2,0);
+ outs("本站為配合實行內容分級制度,請您輸入正確的生日資訊。");
+
+ getdata(5, 0, "生日 (西元年/月/日, 如 1984/02/29):", birthday,
+ sizeof(birthday), DOECHO);
+
+ if (ParseDate(birthday, &y, &m, &d)) {
+ vmsg("日期格式不正確");
+ continue;
+ } else if (y < 1940) {
+ vmsg("你真的有那麼老嗎?");
+ continue;
+ }
+ cuser.year = (unsigned char)(y-1900);
+ cuser.month = (unsigned char)m;
+ cuser.day = (unsigned char)d;
+ changed = 1;
+ }
+
+ if (changed) {
+ clear();
+ resolve_over18();
+ }
+}
void
check_register(void)
{
+ check_birthday();
if (HasUserPerm(PERM_LOGINOK))
return;
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 9ad49259..09fa58e3 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -726,7 +726,9 @@ uinfo_query(userec_t *u, int adminmode, int unum)
getdata_buf(y++, 0, "居住地址:",
x.address, sizeof(x.address), DOECHO);
}
- snprintf(buf, sizeof(buf), "%010d", x.mobile);
+ buf[0] = 0;
+ if (x.mobile)
+ snprintf(buf, sizeof(buf), "%010d", x.mobile);
getdata_buf(y++, 0, "手機號碼:", buf, 11, LCECHO);
x.mobile = atoi(buf);
snprintf(genbuf, sizeof(genbuf), "%d", (u->sex + 1) % 8);