// 系统安全记录,自动发送到syssecurity版 // mode == 0 syssecurity // mode == 1 boardsecurity // mode == 2 bmsecurity // mode == 3 usersecurity int securityreport(char *str, int save, int mode) { FILE* se; char fname[STRLEN]; int savemode; savemode = uinfo.mode; report(str, currentuser.userid); sprintf(fname, "tmp/security.%s.%05d", currentuser.userid, uinfo.pid); if ((se = fopen(fname, "w")) != NULL) { fprintf(se, "系统安全记录\n[1m原因:%s[m\n", str); if (save){ fprintf(se, "以下是个人资料:"); getuinfo(se); } fclose(se); if (mode == 0){ Postfile(fname, "syssecurity", str, 2); } else if (mode == 1){ Postfile(fname, "boardsecurity", str, 2); } else if (mode == 2){ Postfile(fname, "bmsecurity", str, 2); } else if (mode == 3){ Postfile(fname, "usersecurity", str, 2); } else if (mode == 4){ Postfile(fname, "vote", str, 2); } unlink(fname); modify_user_mode(savemode); } }
// 自动发送到版面 // title 标题 // str 内容 // toboard 决定是否发送到版面 // userid 发送到的用户名,为null则不发送. // mode 分别奖惩,1表示BMS任命,0表示deliver处罚 // 2表示当前用户 int autoreport(char *title,char *str,int toboard,char *userid,int mode) { FILE *se; char fname[STRLEN]; int savemode; savemode = uinfo.mode; report(title, currentuser.userid); sprintf(fname,"tmp/AutoPoster.%s.%05d",currentuser.userid,uinfo.pid); if((se=fopen(fname,"w"))!=NULL) { fprintf(se,"%s",str); fclose(se); if(userid != NULL) { mail_file(fname,userid,title); } /* Modified by Amigo 2002.04.17. Set BMS announce poster as 'BMS'. */ // if(toboard) Postfile( fname,currboard,title,1); if (toboard) { if (mode == 1) { Postfile(fname, currboard, title, 3); } else if (mode == 2) { Postfile(fname, currboard, title, 2); } else { Postfile(fname, currboard, title, 1); } } /* Modify end. */ unlink(fname); modify_user_mode( savemode ); } return 0; //返回值现无意义 }
void autoreport(char* title,char* str, int toboard, char* userid) { FILE *se; char fname[STRLEN]; int savemode; struct boardheader fh; extern int cmpbnames(); search_record(BOARDS, &fh, sizeof(fh), cmpbnames, currboard); savemode = uinfo.mode; report(title); sprintf(fname,"tmp/%s.%s.%05d",BBSID,currentuser.userid,uinfo.pid); if((se=fopen(fname,"w"))!=NULL) { fprintf(se,"%s",str); fclose(se); if(userid != NULL) mail_file(fname,userid,title); if(toboard) Postfile( fname,currboard,title,1); if(userid!=NULL && fh.level == 0) Postfile(fname, "Punishment", title,2);//add by bluetent - 2002.11.5 unlink(fname); modify_user_mode( savemode ); } }
int security_report(char *str,int i) { FILE *se; char fname[STRLEN]; int savemode; savemode = uinfo.mode; report(str); sprintf(fname, "tmp/security.%s.%05d", currentuser.userid, uinfo.pid); if ((se = fopen(fname, "w")) != NULL) { fprintf(se, "系统安全记录\n\033[1m原因:%s\033[m\n", str); fprintf(se, "以下是个人资料"); getuinfo(se); fclose(se); if(i==1) Postfile(fname, "syssecurity1", str, 2); else if(i==2) Postfile(fname, "syssecurity2",str, 2); else if(i==3) Postfile(fname, "syssecurity3",str, 2); else if(i==4) Postfile(fname, "syssecurity4",str, 2); unlink(fname); modify_user_mode(savemode); } }
int securityreport3(char *str,int mod) { FILE *se; char fname[STRLEN]; int savemode; savemode = uinfo.mode; report(str); sprintf(fname, "tmp/security.%s.%05d", currentuser.userid, uinfo.pid); if ((se = fopen(fname, "w")) != NULL) { char tmpbuf [256]; sprintf (tmpbuf, "%d", mod); fprintf(se, "系统安全记录\n[1m原因:%s[m\n", str); if (mod >= 0) { fprintf (se, "方式: "); if (mod == 0) fprintf (se, "不减文章数\n"); else fprintf (se, "文章数减 %d\n", mod); } fprintf(se, "以下是个人资料"); getuinfo(se); fclose(se); Postfile(fname, "syssecurity2", str, 2); unlink(fname); modify_user_mode(savemode); } }
/* add by yiyo 修改个人资料或权限详细记录 */ int securityreport1(char *str) { FILE *se; char fname[STRLEN]; int savemode; savemode = uinfo.mode; report(str); sprintf(fname, "tmp/security.%s.%05d", currentuser.userid, uinfo.pid); if ((se = fopen(fname, "w")) != NULL) { fprintf(se, "系统安全记录\n\033[1m原因:%s\033[m\n", str); fprintf(se, "以下是改动前后的个人资料"); gethisinfo(se); fclose(se); Postfile(fname, "syssecurity1", str, 2); unlink(fname); modify_user_mode(savemode); } }
// Do autoposting according to "etc/autopost", // if no such action has been taken since last 00:00 UTC. static void notepad_init(void) { FILE *check; char notetitle[STRLEN]; char tmp[STRLEN * 2]; char *fname, *bname, *ntitle; long int maxsec; maxsec = 86400; lastnote = 0; if ((check = fopen("etc/checknotepad", "r")) != NULL) { fgets(tmp, sizeof(tmp), check); lastnote = atol(tmp); fclose(check); } fb_time_t now = fb_time(); if ((now - lastnote) >= maxsec) { screen_move(-1, 0); //% prints("对不起,系统自动发信,请稍候....."); prints("\xb6\xd4\xb2\xbb\xc6\xf0\xa3\xac\xcf\xb5\xcd\xb3\xd7\xd4\xb6\xaf\xb7\xa2\xd0\xc5\xa3\xac\xc7\xeb\xc9\xd4\xba\xf2....."); screen_flush(); check = fopen("etc/checknotepad", "w"); lastnote = now - (now % maxsec); if (check) { fprintf(check, "%ld", lastnote); fclose(check); } if ((check = fopen("etc/autopost", "r")) != NULL) { while (fgets(tmp, STRLEN, check) != NULL) { fname = strtok(tmp, " \n\t:@"); bname = strtok(NULL, " \n\t:@"); ntitle = strtok(NULL, " \n\t:@"); if (fname == NULL || bname == NULL || ntitle == NULL) continue; else { char *str = format_time(now, TIME_FORMAT_ZH); snprintf(notetitle, sizeof(notetitle), "[%14.14s %6.6s] %s", str, str + 23, ntitle); if (dashf(fname)) { Postfile(fname, bname, notetitle, 1); //% sprintf(tmp, "%s 自动张贴", ntitle); sprintf(tmp, "%s \xd7\xd4\xb6\xaf\xd5\xc5\xcc\xf9", ntitle); report(tmp, currentuser.userid); } } } fclose(check); } char *str = format_time(now, TIME_FORMAT_ZH); //% snprintf(notetitle, sizeof(notetitle), "[%14.14s %6.6s] 留言板记录", snprintf(notetitle, sizeof(notetitle), "[%14.14s %6.6s] \xc1\xf4\xd1\xd4\xb0\xe5\xbc\xc7\xc2\xbc", str, str + 23); if (dashf("etc/notepad")) { Postfile("etc/notepad", "Notepad", notetitle, 1); unlink("etc/notepad"); } //% report("自动发信时间更改", currentuser.userid); report("\xd7\xd4\xb6\xaf\xb7\xa2\xd0\xc5\xca\xb1\xbc\xe4\xb8\xfc\xb8\xc4", currentuser.userid); } return; }
void check_register_info(void) { struct userec *urec = ¤tuser; FILE *fout; char buf[192], buf2[STRLEN]; if (!(urec->userlevel & PERM_LOGIN)) { urec->userlevel = 0; return; } #ifdef NEWCOMERREPORT if (urec->numlogins == 1) { screen_clear(); file_temp_name(buf, sizeof(buf)); if ((fout = fopen(buf, "w")) != NULL) { //% fprintf(fout, "大家好,\n\n"); fprintf(fout, "\xb4\xf3\xbc\xd2\xba\xc3,\n\n"); //% fprintf(fout, "我是 %s (%s), 来自 %s\n", fprintf(fout, "\xce\xd2\xca\xc7 %s (%s), \xc0\xb4\xd7\xd4 %s\n", currentuser.userid, urec->username, fromhost); //% fprintf(fout, "今天%s初来此站报到, 请大家多多指教。\n", fprintf(fout, "\xbd\xf1\xcc\xec%s\xb3\xf5\xc0\xb4\xb4\xcb\xd5\xbe\xb1\xa8\xb5\xbd, \xc7\xeb\xb4\xf3\xbc\xd2\xb6\xe0\xb6\xe0\xd6\xb8\xbd\xcc\xa1\xa3\n", //% (urec->gender == 'M') ? "小弟" : "小女子"); (urec->gender == 'M') ? "\xd0\xa1\xb5\xdc" : "\xd0\xa1\xc5\xae\xd7\xd3"); screen_move(2, 0); //% prints("非常欢迎 %s 光临本站,希望您能在本站找到属于自己的一片天空!\n\n", currentuser.userid); prints("\xb7\xc7\xb3\xa3\xbb\xb6\xd3\xad %s \xb9\xe2\xc1\xd9\xb1\xbe\xd5\xbe\xa3\xac\xcf\xa3\xcd\xfb\xc4\xfa\xc4\xdc\xd4\xda\xb1\xbe\xd5\xbe\xd5\xd2\xb5\xbd\xca\xf4\xd3\xda\xd7\xd4\xbc\xba\xb5\xc4\xd2\xbb\xc6\xac\xcc\xec\xbf\xd5\xa3\xa1\n\n", currentuser.userid); //% prints("请您作个简短的个人简介, 向本站其他使用者打个招呼\n"); prints("\xc7\xeb\xc4\xfa\xd7\xf7\xb8\xf6\xbc\xf2\xb6\xcc\xb5\xc4\xb8\xf6\xc8\xcb\xbc\xf2\xbd\xe9, \xcf\xf2\xb1\xbe\xd5\xbe\xc6\xe4\xcb\xfb\xca\xb9\xd3\xc3\xd5\xdf\xb4\xf2\xb8\xf6\xd5\xd0\xba\xf4\n"); //% prints("(简介最多三行, 写完可直接按 <Enter> 跳离)...."); prints("(\xbc\xf2\xbd\xe9\xd7\xee\xb6\xe0\xc8\xfd\xd0\xd0, \xd0\xb4\xcd\xea\xbf\xc9\xd6\xb1\xbd\xd3\xb0\xb4 <Enter> \xcc\xf8\xc0\xeb)...."); getdata(6, 0, ":", buf2, 75, DOECHO, YEA); if (buf2[0] != '\0') { //% fprintf(fout, "\n\n自我介绍:\n\n"); fprintf(fout, "\n\n\xd7\xd4\xce\xd2\xbd\xe9\xc9\xdc:\n\n"); fprintf(fout, "%s\n", buf2); getdata(7, 0, ":", buf2, 75, DOECHO, YEA); if (buf2[0] != '\0') { fprintf(fout, "%s\n", buf2); getdata(8, 0, ":", buf2, 75, DOECHO, YEA); if (buf2[0] != '\0') { fprintf(fout, "%s\n", buf2); } } } fclose(fout); //% sprintf(buf2, "新手上路: %s", urec->username); sprintf(buf2, "\xd0\xc2\xca\xd6\xc9\xcf\xc2\xb7: %s", urec->username); Postfile(buf, "newcomers", buf2, 2); unlink(buf); } pressanykey(); } #endif #ifndef FDQUAN //检查邮箱 while (!HAS_PERM(PERM_BINDMAIL)) { screen_clear(); if (HAS_PERM(PERM_REGISTER)) { //% while (askyn("是否绑定复旦邮箱", NA, NA)== NA) while (askyn("\xca\xc7\xb7\xf1\xb0\xf3\xb6\xa8\xb8\xb4\xb5\xa9\xd3\xca\xcf\xe4", NA, NA)== NA) //add by eefree.06.7.20 { //% if (askyn("是否填写校友信息", NA, NA) == NA) { if (askyn("\xca\xc7\xb7\xf1\xcc\xee\xd0\xb4\xd0\xa3\xd3\xd1\xd0\xc5\xcf\xa2", NA, NA) == NA) { screen_clear(); continue; } check_reg_extra(); return; } //add end. } tui_check_reg_mail(); } #endif screen_clear(); if (HAS_PERM(PERM_REGISTER)) return; #ifndef AUTOGETPERM if (check_register_ok()) { #endif set_safe_record(); urec->userlevel |= PERM_DEFAULT; substitut_record(PASSFILE, urec, sizeof(struct userec), usernum); return; #ifndef AUTOGETPERM } #endif if (!chkmail()) fill_reg_form(); }
int deal_gopherkey(char ch, int allnum, int pagenum) { char fname[STRLEN], fpath[STRLEN]; #ifdef INTERNET_EMAIL struct shortfile fhdr; #endif switch (ch) { case 'h': case 'H': show_help("help/announcereadhelp"); g_refresh(); break; case 'E': case 'e': tmpitem = nth_item(allnum - pagenum); setuserfile(fname, "gopher.tmp"); if (tmpitem->title[0] != '0') { return 1; } if (get_con(tmpitem->server, tmpitem->port) == -1) return 1; enterdir(tmpitem->file); savetmpfile(fname); if (dashf(fname)) { vedit(fname, NA, YEA); unlink(fname); g_refresh(); } show_message(NULL); break; case '=': { tmpitem = nth_item(allnum - pagenum); move(2, 0); clrtobot(); prints("[1;44;37m"); printdash("BBS Gopher Îï¼þ»ù±¾×ÊÁÏ"); prints("[m"); prints("ÀàÐÍ£º%c (%s)\n", tmpitem->title[0], (tmpitem->title[0] == '0') ? "Îļþ" : "Ŀ¼"); prints("±êÌ⣺%s\n", tmpitem->title + 1); prints("·¾¶£º%s\n", tmpitem->file); prints("λÖãº%s\n", tmpitem->server); prints("ʹÓãº%d²º\n", tmpitem->port); pressanykey(); g_refresh(); } break; case Ctrl('P'): tmpitem = nth_item(allnum - pagenum); if (!HAS_PERM(PERM_POST)) break; setuserfile(fname, "gopher.tmp"); if (tmpitem->title[0] != '0') { return 1; } if (get_con(tmpitem->server, tmpitem->port) == -1) return 1; enterdir(tmpitem->file); savetmpfile(fname); if (dashf(fname)) { char bname[30]; clear(); if (get_a_boardname(bname, "ÇëÊäÈëҪתÌùµÄÌÖÂÛÇøÃû³Æ: ")) { move(1, 0); sprintf(fpath, "ÄãÈ·¶¨Òª×ªÌùµ½ %s °åÂð", bname); if (askyn(fpath, NA, NA) == 1) { move(2, 0); Postfile(fname, bname, tmpitem->title + 1, 2); sprintf(fpath, "[1mÒѾ°ïÄãתÌùµ½ %s °åÁË...[m", bname); prints(fpath); refresh(); sleep(1); } } } unlink(fname); g_refresh(); return 1; #ifdef INTERNET_EMAIL case 'U': case 'F': case 'u': case 'f': case 'z': case 'Z': tmpitem = nth_item(allnum - pagenum); setuserfile(fname, "gopher.tmp"); if (tmpitem->title[0] != '0') { return 1; } if (get_con(tmpitem->server, tmpitem->port) == -1) return 1; enterdir(tmpitem->file); savetmpfile(fname); if (dashf(fname)) { strncpy(fhdr.title, tmpitem->title + 1, 70); strncpy(fhdr.filename, "gopher.tmp", STRLEN); sethomepath(fpath, currentuser.userid); // if (ch == 'Z' || ch == 'z') // a_download(fname); // else { switch (doforward(fpath, &fhdr, (ch == 'u' || ch == 'U') ? 1 : 0)) { case 0: show_message("ÎÄÕÂת¼ÄÍê³É!"); break; case -1: show_message("system error!!."); break; case -2: show_message("invalid address."); break; default: show_message("È¡Ïûת¼Ä¶¯×÷."); } // } refresh(); pressanykey(); g_refresh(); unlink(fname); return 1; } else return 1; break; #endif default: return 0; } return 1; }
void check_register_info() { struct userec *urec = ¤tuser; FILE *fout; char buf[192], buf2[STRLEN]; #ifdef MAILCHECK char ans[4]; #ifdef CODE_VALID int i; #endif #endif if (!(urec->userlevel & PERM_LOGIN)) { urec->userlevel = 0; return; } #ifdef NEWCOMERREPORT if (urec->numlogins == 1) { clear(); sprintf(buf, "tmp/newcomer.%s", currentuser.userid); if ((fout = fopen(buf, "w")) != NULL) { fprintf(fout, "��Һ�,\n\n"); fprintf(fout, "���� %s (%s), ���� %s\n", currentuser.userid, urec->username, fromhost); fprintf(fout, "����%s������վ����, ���Ҷ��ָ�̡�\n", (urec->gender == 'M') ? "С��" : "СŮ��"); move(2, 0); prints("�dz���ӭ %s ���ٱ�վ��ϣ�������ڱ�վ�ҵ������Լ���һƬ��գ�\n\n", currentuser.userid); prints("����������̵ĸ��˼��, ��վ����ʹ���ߴ���к�\n"); prints("(����������, д���ֱ�Ӱ� <Enter> ����)...."); getdata(6, 0, ":", buf2, 75, DOECHO, YEA); if (buf2[0] != '\0') { fprintf(fout, "\n\n���ҽ���:\n\n"); fprintf(fout, "%s\n", buf2); getdata(7, 0, ":", buf2, 75, DOECHO, YEA); if (buf2[0] != '\0') { fprintf(fout, "%s\n", buf2); getdata(8, 0, ":", buf2, 75, DOECHO, YEA); if (buf2[0] != '\0') { fprintf(fout, "%s\n", buf2); } } } fclose(fout); sprintf(buf2, "������·: %s", urec->username); Postfile(buf, "newcomers", buf2, 2); unlink(buf); } pressanykey(); } #endif #ifdef PASSAFTERTHREEDAYS if (urec->lastlogin - urec->firstlogin < 3 * 86400) { if (!HAS_PERM(PERM_SYSOP)) { set_safe_record(); urec->userlevel &= ~(PERM_DEFAULT); urec->userlevel |= PERM_LOGIN; substitut_record(PASSFILE, urec, sizeof(struct userec), usernum); ansimore("etc/newregister", YEA); return; } } #endif #ifndef FDQUAN //������� while (!HAS_PERM(PERM_BINDMAIL)) { clear(); if (HAS_PERM(PERM_REGISTER)) { while (askyn("�Ƿ��������", NA, NA)== NA) //add by eefree.06.7.20 { if (askyn("�Ƿ���дУ����Ϣ", NA, NA) == NA) { clear(); continue; } check_reg_extra(); return; } //add end. } check_reg_mail(); } #endif clear(); if (HAS_PERM(PERM_REGISTER)) return; #ifndef AUTOGETPERM if (check_register_ok()) { #endif set_safe_record(); urec->userlevel |= PERM_DEFAULT; substitut_record(PASSFILE, urec, sizeof(struct userec), usernum); return; #ifndef AUTOGETPERM } #endif #ifdef MAILCHECK #ifdef CODE_VALID sethomefile(buf, currentuser.userid, ".regpass"); if (dashf(buf)) { move(13, 0); prints("����δͨ�����ȷ��... \n"); prints("�����ڱ�������ע��ȷ������, \"��֤����\"����Ϊ���ȷ��\n"); prints("һ���� %d ���ַ�, ��Сд���в���, ��ע��.\n", RNDPASSLEN); prints("����ȡ�������������� [Enter] ��.\n"); prints("[1;33m��ע��, ����������һ����֤�������������������룡[m\n"); if ((fout = fopen(buf, "r")) != NULL) { fscanf(fout, "%s", buf2); fclose(fout); for (i = 0; i < 3; i++) { move(18, 0); prints("������ %d �λ���\n", 3 - i); getdata(19,0,"��������֤����: ",genbuf,(RNDPASSLEN+1),DOECHO,YEA); if (strcmp(genbuf, "") != 0) { if (strcmp(genbuf, buf2) != 0) continue; else break; } } } else i = 3; if (i == 3) { prints("������֤ʧ��! ����Ҫ��дע�ᵥ�����ȷ������ȷ���������\n"); getdata(22,0,"��ѡ��1.��ע�ᵥ 2.����ȷ���� [1]:",ans,2,DOECHO,YEA); if(ans[0] == '2') { send_regmail(¤tuser); pressanykey(); } else x_fillform(); } else { set_safe_record(); urec->userlevel |= PERM_DEFAULT; substitut_record(PASSFILE, urec,sizeof(struct userec), usernum); prints("������!! ����˳����ɱ�վ��ʹ����ע������,\n"); prints("������������ӵ��һ��ʹ���ߵ�Ȩ��������...\n"); unlink(buf); mail_file("etc/smail", "SYSOP", "��ӭ���뱾վ����"); pressanykey(); } return; } #endif if ( (!strstr(urec->email, BBSHOST)) && (!invalidaddr(urec->email)) && (!invalid_email(urec->email))) { move(13, 0); prints("���ĵ������� ����ͨ��������֤... \n"); prints(" ��վ�����ϼ�һ����֤�Ÿ���,\n"); prints(" ��ֻҪ�� %s ����, �Ϳ��Գ�Ϊ��վ�ϸ���.\n\n", urec->email); prints(" ��Ϊ��վ�ϸ���, �������и����Ȩ���!\n"); prints(" ��Ҳ����ֱ����дע�ᵥ��Ȼ��ȴ�վ�����ֹ���֤��\n"); getdata(21,0,"��ѡ��1.��ע�ᵥ 2.��ȷ���� [1]: ",ans,2,DOECHO,YEA); if(ans[0] == '2') { send_regmail(¤tuser); getdata(21,0,"ȷ�����Ѽij�, ��������Ŷ!! ",ans, 2, DOECHO, YEA); return; } } #endif /* Following line modified by Amigo 2002.04.23. Fill form only when no new letter. */ /* x_fillform();*/ if (!chkmail()) x_fillform(); }