summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-30 20:56:13 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-30 20:56:13 +0800
commitc7ec45b470726d9b50e7d549a09569e22e2a9a69 (patch)
tree3dc409085298e2bcea7fd461aecca9fe1e3d6674
parent48b5100a347dfb5bb48a4d695a44c81e4378d69d (diff)
downloadpttbbs-c7ec45b470726d9b50e7d549a09569e22e2a9a69.tar
pttbbs-c7ec45b470726d9b50e7d549a09569e22e2a9a69.tar.gz
pttbbs-c7ec45b470726d9b50e7d549a09569e22e2a9a69.tar.bz2
pttbbs-c7ec45b470726d9b50e7d549a09569e22e2a9a69.tar.lz
pttbbs-c7ec45b470726d9b50e7d549a09569e22e2a9a69.tar.xz
pttbbs-c7ec45b470726d9b50e7d549a09569e22e2a9a69.tar.zst
pttbbs-c7ec45b470726d9b50e7d549a09569e22e2a9a69.zip
* add more checking to numlogindays
git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4802 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h2
-rw-r--r--mbbsd/user.c20
2 files changed, 18 insertions, 4 deletions
diff --git a/include/proto.h b/include/proto.h
index e0f784c0..bc32e07d 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -745,5 +745,7 @@ int pwcuInitAdminPerm ();
/* calendar */
int calendar(void);
int ParseDate(const char *date, int *year, int *month, int *day);
+int ParseDateTime(const char *date, int *year, int *month, int *day,
+ int *hour, int *min, int *sec);
#endif
diff --git a/mbbsd/user.c b/mbbsd/user.c
index ef73930f..0e8fdb53 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -847,10 +847,22 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
break;
}
- snprintf(genbuf, sizeof(genbuf), "%d", x.numlogindays);
- if (getdata_str(y++, 0, "上線資歷:", buf, 10, DOECHO, genbuf))
- if ((tmp = atoi(buf)) >= 0)
- x.numlogindays = tmp;
+ do {
+ int max_days = (x.lastlogin - x.firstlogin) / DAY_SECONDS;
+ snprintf(genbuf, sizeof(genbuf), "%d", x.numlogindays);
+ if (getdata_str(y++, 0, "上線資歷:", buf, 10, DOECHO, genbuf))
+ if ((tmp = atoi(buf)) >= 0)
+ x.numlogindays = tmp;
+ if (x.numlogindays > max_days)
+ {
+ x.numlogindays = max_days;
+ vmsgf("根據此使用者最後上線時間,資歷最大值為 %d.", max_days);
+ move(--y, 0); clrtobot();
+ continue;
+ }
+ break;
+ } while (1);
+
snprintf(genbuf, sizeof(genbuf), "%d", x.numposts);
if (getdata_str(y++, 0, "文章數目:", buf, 10, DOECHO, genbuf))
if ((tmp = atoi(buf)) >= 0)