summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-02-01 18:32:24 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-02-01 18:32:24 +0800
commitaf6e9ec70228249a462a9a4fd5aa4977733f9e13 (patch)
tree75cb354a07fe869816c457fa12c4cdb2531b74dc
parent463cdbbc77d5b00b8f6693e7ea6cb6b9c53be081 (diff)
downloadpttbbs-af6e9ec70228249a462a9a4fd5aa4977733f9e13.tar
pttbbs-af6e9ec70228249a462a9a4fd5aa4977733f9e13.tar.gz
pttbbs-af6e9ec70228249a462a9a4fd5aa4977733f9e13.tar.bz2
pttbbs-af6e9ec70228249a462a9a4fd5aa4977733f9e13.tar.lz
pttbbs-af6e9ec70228249a462a9a4fd5aa4977733f9e13.tar.xz
pttbbs-af6e9ec70228249a462a9a4fd5aa4977733f9e13.tar.zst
pttbbs-af6e9ec70228249a462a9a4fd5aa4977733f9e13.zip
- user: prevent printing zeros if mobile has not been set
- register: force user to update birthday information. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3898 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-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);