summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h8
-rw-r--r--mbbsd/admin.c17
-rw-r--r--mbbsd/mbbsd.c10
-rw-r--r--mbbsd/user.c86
-rw-r--r--sample/pttbbs.conf3
5 files changed, 95 insertions, 29 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index cb60f97d..044704ad 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -1,4 +1,4 @@
-/* $Id: pttstruct.h,v 1.35 2003/05/07 03:35:07 bbs Exp $ */
+/* $Id: pttstruct.h,v 1.36 2003/05/09 07:44:48 victor Exp $ */
#ifndef INCLUDE_STRUCT_H
#define INCLUDE_STRUCT_H
@@ -75,7 +75,8 @@ typedef struct userec_t {
char mind[4];
char ident[11];
unsigned int uflag2;
- char pad[72];
+ char foreign;
+ char pad[71];
} userec_t;
/* these are flags in userec_t.uflag */
#define SIG_FLAG 0x3 /* signature number, 2 bits */
@@ -95,6 +96,9 @@ typedef struct userec_t {
#define FAVNOHILIGHT 0x10 /* false if hilight favorite */
#define FAVNEW_FLAG 0x20 /* true if add new board into one's fav */
+/* these are flags in userec_t.foreign */
+#define FOREIGN 0x1
+#define LIVERIGHT 0x2
#define BTLEN 48 /* Length of board title */
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index dc792e47..4b87f98a 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -1,4 +1,4 @@
-/* $Id: admin.c,v 1.32 2003/05/07 08:14:21 bbs Exp $ */
+/* $Id: admin.c,v 1.33 2003/05/09 07:43:57 victor Exp $ */
#include "bbs.h"
/* 使用者管理 */
@@ -413,16 +413,18 @@ x_file()
int aborted;
char ans[4], *fpath;
- move(b_lines - 4, 0);
+ move(b_lines - 6, 0);
/* Ptt */
outs("設定 (1)身份確認信 (4)post注意事項 (5)錯誤登入訊息 (6)註冊範例 (7)通過確認通知\n");
outs(" (8)email post通知 (9)系統功\能精靈 (A)茶樓 (B)站長名單 (C)email通過確認\n");
- outs(" (D)新使用者需知 (E)身份確認方法 (F)歡迎畫面 (G)進站畫面 "
+ outs(" (D)新使用者需知 (E)身份確認方法 (F)歡迎畫面 (G)進站畫面"
#ifdef MULTI_WELCOME_LOGIN
"(X)刪除進站畫面"
#endif
"\n");
- getdata(b_lines - 1, 0, " (H)看板期限 (I)故鄉 (J)出站畫面 (K)生日卡 (L)節日 [Q]取消?", ans, sizeof(ans), LCECHO);
+ outs(" (H)看板期限 (I)故鄉 (J)出站畫面 (K)生日卡 (L)節日 (M)外籍使用者認證通知\n");
+ outs(" (N)外籍使用者過期警告通知\n");
+ getdata(b_lines - 1, 0, "[Q]取消[1-9 A-N]?", ans, sizeof(ans), LCECHO);
switch (ans[0]) {
case '1':
@@ -521,6 +523,12 @@ x_file()
case 'l':
fpath = "etc/feast";
break;
+ case 'm':
+ fpath = "etc/foreign_expired";
+ break;
+ case 'n':
+ fpath = "etc/foreign_expired_warn";
+ break;
default:
return FULLUPDATE;
}
@@ -754,6 +762,7 @@ scan_register_form(char *regfile, int automode, int neednum)
char fdata[7][STRLEN];
char fname[STRLEN], buf[STRLEN];
char ans[4], *ptr, *uid;
+ char foreign;
int n = 0, unum = 0;
int nSelf = 0, nAuto = 0;
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index ef35cfe9..9c360550 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.71 2003/04/14 07:47:54 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.72 2003/05/09 07:43:57 victor Exp $ */
#include "bbs.h"
#define SOCKET_QLEN 4
@@ -884,6 +884,14 @@ user_login()
if (!PERM_HIDE(currutmp))
cuser.lastlogin = login_start_time;
+ if (login_start_time - cuser.firstlogin > (FOREIGN_REG_DAY - 5) * 24 * 3600){
+ mail_muser(cuser, "[出入境管理局]", "etc/foreign_expired_warn");
+ }
+ else if (login_start_time - cuser.firstlogin > FOREIGN_REG_DAY * 24 * 3600){
+ cuser.userlevel &= ~(PERM_LOGINOK | PERM_POST);
+ mail_muser(cuser, "[出入境管理局]", "etc/foreign_expired");
+ }
+
passwd_update(usernum, &cuser);
for (i = 0; i < NUMVIEWFILE; i++)
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 4059a275..5568854b 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1,4 +1,4 @@
-/* $Id: user.c,v 1.52 2003/03/30 06:52:09 in2 Exp $ */
+/* $Id: user.c,v 1.53 2003/05/09 07:43:57 victor Exp $ */
#include "bbs.h"
static char *sex[8] = {
@@ -51,12 +51,12 @@ user_display(userec_t * u, int real)
" 資 料 "
" \033[m \033[30;41m┴┬┴┬┴┬\033[m\n");
prints(" 代號暱稱: %s(%s)\n"
- " 真實姓名: %s\n"
+ " 真實姓名: %s %s\n"
" 居住住址: %s\n"
" 電子信箱: %s\n"
" 性 別: %s\n"
" 銀行帳戶: %d 銀兩\n",
- u->userid, u->username, u->realname, u->address, u->email,
+ u->userid, u->username, u->realname, u->foreign & FOREIGN ? "(外籍)" : "", u->address, u->email,
sex[u->sex % 8], u->money);
sethomedir(genbuf, u->userid);
@@ -309,7 +309,7 @@ uinfo_query(userec_t * u, int real, int unum)
if (real) {
getdata_buf(i++, 0, "真實姓名:",
x.realname, sizeof(x.realname), DOECHO);
- getdata_buf(i++, 0, "身分證號:",
+ getdata_buf(i++, 0, cuser.foreign & FOREIGN ? "護照號碼" : "身分證號:",
x.ident, sizeof(x.ident), DOECHO);
getdata_buf(i++, 0, "居住地址:",
x.address, sizeof(x.address), DOECHO);
@@ -433,6 +433,13 @@ uinfo_query(userec_t * u, int real, int unum)
x.chc_tie = atoi(p);
break;
}
+ if (getdata_str(i++, 0, "國籍 1)本國 2)外國:", buf, 2, DOECHO, x.foreign & FOREIGN ? "2" : "1"))
+ if ((fail = atoi(buf)) >= 0){
+ if (fail == 0)
+ x.foreign |= FOREIGN;
+ else
+ x.foreign &= ~FOREIGN;
+ }
fail = 0;
}
break;
@@ -890,7 +897,7 @@ isvaildemail(char *email)
}
static void
-toregister(char *email, char *genbuf, char *phone, char *career,
+toregister(char *email, char *genbuf, char *phone, char *career, char fore,
char *ident, char *rname, char *addr, char *mobile)
{
FILE *fn;
@@ -900,7 +907,8 @@ toregister(char *email, char *genbuf, char *phone, char *career,
if (phone[0] != 0) {
fn = fopen(buf, "w");
assert(fn);
- fprintf(fn, "%s\n%s\n%s\n%s\n%s\n%s\n",
+ fprintf(fn, "%s%s\n%s\n%s\n%s\n%s\n%s\n",
+ fore & FOREIGN ? "#foreign\n" : "",
phone, career, ident, rname, addr, mobile);
fclose(fn);
}
@@ -1085,6 +1093,9 @@ int
u_register(void)
{
char rname[21], addr[51], ident[12], mobile[21];
+//#ifdef FOREIGN_REG_DAY
+ char fore[2];
+//#endif
char phone[21], career[41], email[51], birthday[9], sex_is[2],
year, mon, day;
char inregcode[14], regcode[50];
@@ -1125,6 +1136,10 @@ u_register(void)
sethomefile(genbuf, cuser.userid, "justify.wait");
if ((fn = fopen(genbuf, "r"))) {
fgets(phone, 21, fn);
+ if(strcmp(ident, "#foreign") == 0){
+ fore[0] |= FOREIGN;
+ fgets(ident, 21, fn);
+ }
phone[strlen(phone) - 1] = 0;
fgets(career, 41, fn);
career[strlen(career) - 1] = 0;
@@ -1172,7 +1187,7 @@ u_register(void)
outs("認證碼錯誤\n");
pressanykey();
}
- toregister(email, genbuf, phone, career, ident, rname, addr, mobile);
+ toregister(email, genbuf, phone, career, fore[0], ident, rname, addr, mobile);
return FULLUPDATE;
}
@@ -1188,16 +1203,42 @@ u_register(void)
move(1, 0);
prints("%s(%s) 您好,請據實填寫以下的資料:",
cuser.userid, cuser.username);
- while( 1 ){
- getfield(3, "D123456789", "身分證號", ident, 11);
- if ('a' <= ident[0] && ident[0] <= 'z')
- ident[0] -= 32;
- if( ispersonalid(ident) )
+ while (1) {
+ getfield(2, "Y/n", "是否為本國籍?", fore, 2);
+ fore[0] = tolower(fore[0]);
+ if (fore[0] == 'y'){
+ fore[0] = '\0';
break;
- vmsg("您的輸入不正確(若有問題麻煩至SYSOP板)");
+ }
+ else if (fore[0] == 'n'){
+ getdata(4, 0, "是否確定(Y/N)", ans, sizeof(ans), LCECHO);
+ if (ans[0] == 'y' || ans[0] == 'Y'){
+ fore[0] |= FOREIGN;
+ break;
+ }
+ }
+ }
+ if (!fore[0]){
+ while( 1 ){
+ getfield(5, "D123456789", "身分證號", ident, 11);
+ if ('a' <= ident[0] && ident[0] <= 'z')
+ ident[0] -= 32;
+ if( ispersonalid(ident) )
+ break;
+ vmsg("您的輸入不正確(若有問題麻煩至SYSOP板)");
+ }
+ }
+ else{
+ while( 1 ){
+ getfield(5, "0123456789", "護照號碼", ident, 11);
+ getdata(7, 0, "是否確定(Y/N)", ans, sizeof(ans), LCECHO);
+ if (ans[0] == 'y' || ans[0] == 'Y')
+ break;
+ vmsg("請重新輸入(若有問題麻煩至SYSOP板)");
+ }
}
while (1) {
- getfield(5, "請用中文", "真實姓名", rname, 20);
+ getfield(8, "請用中文", "真實姓名", rname, 20);
if( (errcode = isvaildname(rname)) == NULL )
break;
else
@@ -1208,7 +1249,7 @@ u_register(void)
prints("麻煩您盡量詳細的填寫您的服務單位, 大專院校請麻煩"
"加系所, 公司單位請加職稱");
while (1) {
- getfield(8, "學校(含\033[1;33m系所年級\033[m)或單位職稱",
+ getfield(9, "學校(含\033[1;33m系所年級\033[m)或單位職稱",
"服務單位", career, 40);
if( (errcode = isvaildcareer(career)) == NULL )
break;
@@ -1216,7 +1257,7 @@ u_register(void)
vmsg(errcode);
}
while (1) {
- getfield(10, "含\033[1;33m縣市\033[m及門寢號碼"
+ getfield(11, "含\033[1;33m縣市\033[m及門寢號碼"
"(台北請加\033[1;33m行政區\033[m)",
"目前住址", addr, 50);
if( (errcode = isvaildaddr(addr)) == NULL )
@@ -1225,18 +1266,18 @@ u_register(void)
vmsg(errcode);
}
while (1) {
- getfield(12, "不加-(), 包括長途區號", "連絡電話", phone, 11);
+ getfield(13, "不加-(), 包括長途區號", "連絡電話", phone, 11);
if( (errcode = isvaildphone(phone)) == NULL )
break;
else
vmsg(errcode);
}
- getfield(14, "只輸入數字 如:0912345678 (可不填)",
+ getfield(15, "只輸入數字 如:0912345678 (可不填)",
"手機號碼", mobile, 20);
while (1) {
int len;
- getfield(16, "月月/日日/西元 如:09/27/76", "生日", birthday, 9);
+ getfield(17, "月月/日日/西元 如:09/27/76", "生日", birthday, 9);
len = strlen(birthday);
if (!len) {
snprintf(birthday, sizeof(birthday), "%02i/%02i/%02i",
@@ -1259,8 +1300,8 @@ u_register(void)
}
break;
}
- getfield(18, "1.葛格 2.姐接 ", "性別", sex_is, 2);
- getdata(19, 0, "以上資料是否正確(Y/N)?(Q)取消註冊 [N] ",
+ getfield(19, "1.葛格 2.姐接 ", "性別", sex_is, 2);
+ getdata(20, 0, "以上資料是否正確(Y/N)?(Q)取消註冊 [N] ",
ans, sizeof(ans), LCECHO);
if (ans[0] == 'q')
return 0;
@@ -1276,11 +1317,12 @@ u_register(void)
cuser.month = mon;
cuser.day = day;
cuser.year = year;
+ cuser.foreign = fore[0];
trim(career);
trim(addr);
trim(phone);
- toregister(email, genbuf, phone, career, ident, rname, addr, mobile);
+ toregister(email, genbuf, phone, career, fore[0], ident, rname, addr, mobile);
clear();
move(9, 3);
diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf
index e222a34d..8a09e6a0 100644
--- a/sample/pttbbs.conf
+++ b/sample/pttbbs.conf
@@ -42,6 +42,9 @@
/* 定義看板好友名單將會在幾秒鐘後失效強迫重載 */
#define HBFLexpire (432000)
+/* 定義外國人最長居留時間,之後需向站方申請永久居留權 */
+#define FOREIGN_REG_DAY 30
+
/* 板主可以按大寫 H切換隱形與否 */
#define BMCHS