作者itoc.bbs@cpu.tfcis.org (核心動力) 看板: plan
標題Re: [問題]關於留言版
時間動力核心 (2004/11/16 Tue 17:19:21) Updated: 2005/04/12
※ 引述《imd.bbs@bbs.wretch.cc (摸索中)》之銘言:
> 有辦法限制使用者在多久時間內(例如半小時或一小時)
> 無法在留言版留言呢
: menu.c:pad_draw()
static char pcolors[6] = {31, 32, 33, 34, 35, 36};
+ struct stat st;
+ char fpath[64];
+ usr_fpath(fpath, cuser.userid, "pad_draw");
+ if (!stat(fpath, &st))
+ {
+ if (st.st_mtime > time(0) - 30 * 60) /* 30 分鐘才能留言一次 */
+ {
+ vmsg("每三十分鐘只能留言一次");
+ return XEASY;
+ }
+ }
...
...
} while (cc == 'e');
time(&(pad.tpad));
+ if ((cc = open(fpath, O_WRONLY | O_CREAT)) >= 0)
+ {
+ write(cc, fpath, 1);
+ close(cc);
+ }
--
◤◥ Origin: Maple-itoc˙動力核心 cpu.tfcis.org
◣◢ Author: itoc 從 pc512-2.EE.NCTU.edu.tw 發表