int main() { int i; int shift=1; //wzk char board[80]; init_all(); if(!loginok) http_fatal("您尚未登录, 请先登录"); strsncpy(board, getparm("board"), 30); if(!has_read_perm(¤tuser, board)) http_fatal("错误的讨论区"); if(!has_BM_perm(¤tuser, board)) http_fatal("你无权进行本操作"); loaddenyuser(board); printf("<center>\n"); printf("%s -- 被封用户名单 [讨论区: %s]<hr color=green><br>\n", BBSNAME, board); printf("本板共有 %d 人被封<br>", denynum); printf("<table border=0><tr class=title><td>序号<td>用户帐号<td>被封原因<td>原定解封日期<td>管理\n"); for(i=0; i<denynum; i++) { printf("<tr><td>%d", i+1); printf("<td><a href=bbsqry?userid=%s>%s</a>", denyuser[i].id, denyuser[i].id); printf("<td>%s\n", nohtml(denyuser[i].exp)); printf("<td>%s\n", denyuser[i].free_time); printf("<td>[<a onclick='return confirm(\"确实解封吗?\")' href=bbsdenydel?board=%s&userid=%s>解封</a>]", board, denyuser[i].id); } printf("</table><hr color=green>\n"); printf("[<a href=bbsdenyadd?board=%s>设定新的不可POST用户</a>]</center>\n", board); http_quit(); }
int main() { FILE *fp; char board[80], dir[80], *ptr, flag[80]; struct shortfile *x1; struct fileheader x; int i, start, total, my_t_lines=0, chart=0, showhead=0; init_all(); strsncpy(board, getparm("board"), 32); my_t_lines=atoi(getparm("my_t_lines")); if(my_t_lines<10 || my_t_lines>40) my_t_lines=20; x1=getbcache(board); if(x1==0) http_fatal("错误的讨论区"); strcpy(board, x1->filename); board_ban_ip(board); if (!canenterboard (currentuser.userid, board) && !HAS_PERM(PERM_SYSOP)) http_fatal ("您已经被取消进入本板的权限"); if(!has_read_perm(¤tuser, board) && !HAS_PERM(PERM_SYSOP)) http_fatal("错误的讨论区"); if(!has_BM_perm(¤tuser, board)) http_fatal("您没有权限访问本页"); modify_mode(u_info,READING); //bluetent sprintf(dir, "boards/%s/.DIR", board); fp=fopen(dir, "r"); if(fp==0) http_fatal("错误的讨论区目录"); total=file_size(dir)/sizeof(struct fileheader); start=atoi(getparm("start")); if(strlen(getparm("start"))==0 || start>total-my_t_lines) start=total-my_t_lines; if(start<0) start=0; printf("<nobr><center>\n"); strcpy(u_info->board, board); /* printf("%s -- [讨论区: %s] 板主[%s] 文章数[%d]<hr color=green>\n", BBSNAME, board, userid_str(x1->BM), total); if(total<=0) http_fatal("本讨论区目前没有文章"); printf("<form name=form1 method=post action=bbsman>\n"); printf("<table width=613>\n"); printf("<tr><td>序号<td>管理<td>状态<td>作者<td>日期<td>标题\n"); fseek(fp, start*sizeof(struct fileheader), SEEK_SET);*/ printf("<script language=JavaScript>\ \ function MM_jumpMenu(selObj){\ eval(\"window.location='\"+selObj.options[selObj.selectedIndex].value+\"'\");\ }\ function SubmitFlag(flagmode){\ document.form1.mode.value=flagmode;\ document.form1.submit();\ }\ function selrange(x)\ {if(event.shiftKey){var min=x;var max=document.getElementById('lastsel').value;if(min>max){var tmp=min;min=max;max=tmp;}var stt=document.getElementById('chk'+x).checked;for(var i=min;i<=max;i++)document.getElementById('chk'+i).checked=stt;}document.getElementById('lastsel').value=x;}\ </script>\
int bbsdenyadd_main() { int i; char exp[80], board[80], *userid; int dt; struct userec *x; struct boardmem *x1; html_header(1); check_msg(); if (!loginok || isguest) http_fatal("您尚未登录, 请先登录"); changemode(READING); getparmboard(board, sizeof(board)); strsncpy(exp, getparm("exp"), 30); dt = atoi(getparm("dt")); if (!(x1 = getboard(board))) http_fatal("错误的讨论区"); if (!has_BM_perm(currentuser, x1)) http_fatal("你无权进行本操作"); loaddenyuser(board); userid = getparm("userid"); if (userid[0] == 0) return show_form(board); if (getuser(userid, &x) <= 0) http_fatal("错误的使用者帐号"); if (!has_post_perm(x, x1)) http_fatal("这个人本来就没有post权"); strcpy(userid, x->userid); if (!(currentuser->userlevel & PERM_SYSOP) && (dt > 14)) http_fatal("封禁时间大于14天,超过了权限,若需要,请联系站长"); if (dt < 1 || dt > 99) http_fatal("请输入被封天数(1-99)"); if (exp[0] == 0) http_fatal("请输入封人原因"); for (i = 0; i < denynum; i++) if (!strcasecmp(denyuser[i].id, userid)) http_fatal("此用户已经被封"); if (denynum > 40) http_fatal("太多人被封了"); strsncpy(denyuser[denynum].id, userid, 13); strsncpy(denyuser[denynum].exp, exp, 30); denyuser[denynum].free_time = now_t + dt * 86400; denynum++; savedenyuser(board); printf("封禁 %s 成功<br>\n", userid); tracelog("%s deny %s %s", currentuser->userid, board, userid); inform(board, userid, exp, dt); printf("[<a href=bbsdenyall?B=%d>返回被封帐号名单</a>]", getbnumx(x1)); http_quit(); return 0; }
int bbsmnote_main() { FILE *fp; char *ptr, path[256], buf[10000], board[256], notestr[40], buf2[128]; struct boardmem *x; int mode; html_header(1); check_msg(); printf("<center>\n"); if (!loginok || isguest) http_fatal("´Ò´Ò¹ý¿Í£¬ÇëÏȵǼ"); changemode(EDIT); strsncpy(board, getparm("board"), 30); x = getboard(board); mode = atoi(getparm("mode")); if (!has_BM_perm(¤tuser, x)) http_fatal("ÄãÎÞȨ½øÐб¾²Ù×÷"); switch (mode) { case 1: sprintf(path, "vote/%s/notes", board); sprintf(notestr, "Ò»°ã±¸Íü¼"); break; case 2: sprintf(path, "vote/%s/secnotes", board); sprintf(notestr, "ÃØÃܱ¸Íü¼"); break; case 3: default: setbfile(path, board, "introduction"); sprintf(notestr, "°æÃæ¼ò½é"); break; } if (!strcasecmp(getparm("type"), "update")){ if (mode == 2){ sprintf(buf2, "vote/%s/notespasswd", board); unlink(buf2); } save_note(path); } printf("%s -- ±à¼%s [ÌÖÂÛÇø: %s]<hr>\n", BBSNAME, notestr, board); printf ("<form name=form1 method=post action=bbsmnote?type=update&board=%s&mode=%d>\n", board, mode); fp = fopen(path, "r"); if (fp) { fread(buf, 9999, 1, fp); ptr = strcasestr(buf, "<textarea>"); if (ptr) ptr[0] = 0; fclose(fp); } printf("<table border=1><tr><td>"); printf ("<textarea onkeydown='if(event.keyCode==87 && event.ctrlKey) {document.form1.submit(); return false;}' onkeypress='if(event.keyCode==10) return document.form1.submit()' name=text rows=20 cols=80 wrap=virtual>\n"); printf("%s", nohtml(void1(buf))); printf("</textarea></table>\n"); printf("<input type=submit value=´æÅÌ> "); printf("<input type=reset value=¸´Ô>\n"); printf("<hr>\n"); http_quit(); return 0; }
int bbsman_main() { int i, total = 0, mode; char board[80], tbuf[256], *cbuf; char dir[80]; struct boardmem *brd; char *data= NULL; int size, last; int fd; html_header(1); check_msg(); if (!loginok || isguest) http_fatal("请先登录"); changemode(READING); strsncpy(board, getparm("board"), 60); mode = atoi(getparm("mode")); brd = getboard(board); if (brd == 0) http_fatal("错误的讨论区"); if (!has_BM_perm(¤tuser, brd)) http_fatal("你无权访问本页"); if (mode <= 0 || mode > 5) http_fatal("错误的参数"); printf("<table>"); cbuf = "none_op"; sprintf(dir, "boards/%s/.DIR", board); size = file_size(dir); if (!size) http_fatal("空讨论区"); fd = open(dir, O_RDWR); if (fd < 0) http_fatal("空讨论区"); MMAP_TRY { data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); close(fd); if (data == (void *) -1) { MMAP_UNTRY; http_fatal("无法读取文章列表"); } last = 0; for (i = 0; i < parm_num && i < 40; i++) { if (!strncmp(parm_name[i], "box", 3)) { total++; if (mode == 1) { #ifndef WWW_BM_DO_DEL do_set(data, size, parm_name[i] + 3, FH_DEL, board); #else do_del(board,parm_name[i]+3); #endif cbuf = "delete"; } else if (mode == 2) { do_set(data, size, parm_name[i] + 3, FH_MARKED, board); cbuf = "mark"; } else if (mode == 3) { do_set(data, size, parm_name[i] + 3, FH_DIGEST, board); cbuf = "digest"; } else if (mode == 5) { do_set(data, size, parm_name[i] + 3, 0, board); cbuf = "clear_flag"; } } } printf("</table>"); } MMAP_CATCH { close(fd); } MMAP_END { munmap(data, size); } if (total <= 0) printf("请先选定文章<br>\n"); snprintf(tbuf, sizeof (tbuf), "WWW batch %s on board %s,total %d", cbuf, board, total); securityreport(tbuf, tbuf); printf("<br><a href=bbsmdoc?board=%s>返回管理模式</a>", board); http_quit(); return 0; }
int boarddetail_act(char * info) { int act; char buf[1024]; char opinfo[256]; *opinfo = 0; strncpy (board, getparm("board"), 79); act = atoi(getparm("act")); if (loginok) { wmlmode (u_info, READNEW); } x = getbcache(board); if (x) { if ((!canenterboard (currentuser.userid, board) || !has_read_perm(¤tuser, board)) && !HAS_PERM(PERM_SYSOP)) { x = NULL; } } if (x) { switch (act) { case 1://清除板面未读 if (loginok) { brc_init(currentuser.userid, board); brc_clear(); brc_update(currentuser.userid, board); strcpy (opinfo, "已标记本板为已读。"); } break; } printf ("<card title=\"%s/%s\">", x->title + 11, x->filename); if (*opinfo) { printf ("<p>%s</p>", opinfo); } printf ("<p>板面:<anchor><go href=\"bbsdoc.wml?board=%s\" />%s/%s</anchor></p>", x->filename, x->title + 11, x->filename); wmlUseridStr(buf, x->BM); printf ("<p>板主:%s %s %s</p>", *buf ? buf : "无", (x->flag & OUT_FLAG) ? "转信" : "", junkboard(board) ? "不计文章数" : "计文章数"); printf ("<p><anchor><go href=\"bbsdoc.wml?board=%s&mode=0\" />普通</anchor> ", board); printf ("<anchor><go href=\"bbsdoc.wml?board=%s&mode=1\" />文摘</anchor> ", board); printf ("<anchor><go href=\"bbsdoc.wml?board=%s&mode=8\" />置顶</anchor> ", board); if (has_BM_perm(¤tuser, x->filename) || HAS_PERM(PERM_FORCEPAGE)) { printf ("<anchor><go href=\"bbsdoc.wml?board=%s&mode=4\" />回收</anchor>", board); } printf ("</p>"); if (HAS_PERM(PERM_POST)) { if (x->flag & VOTE_FLAG) { printf ("<p><anchor><go href=\"bbsvote.wml?board=%s\" />投票</anchor></p>", x->filename); } printf ("<p><anchor><go href=\"bbspst.wml?board=%s\" />发文</anchor> <anchor><go href=\"bbspattern.wml?board=%s\" />模板</anchor> <anchor><go href=\"bbs0an.wml?path=%s\" />精华</anchor> <anchor><go href=\"boarddetail.wml?board=%s&act=1\" />清除未读</anchor> </p>", x->filename, x->filename, anno_path_of(x->filename), board); } printf ("<p><anchor><go href=\"bbscon.wml?board=%s&file=%s\" />封禁名单</anchor> <anchor><go href=\"bbscon.wml?board=%s\" />敏感词</anchor></p>", WML_VB_DENIED, board, WML_VB_HEXIE); return 0; } else { strcpy (info, "讨论区不存在或您无权进入此讨论区。"); return -1; } }
int main() { FILE *fp; char buf[1024], title[80], board[80], dir[80], first_file[80], userid[16]; struct shortfile *x1; struct fileheader x, x0; int sum=0, total=0, sumfirst=0; init_all(); strsncpy(board, getparm("board"), 32); strsncpy(title, getparm("title"), 42); x1=getbcache(board); if(x1==0) http_fatal("错误的讨论区"); strcpy(board, x1->filename); if(!has_read_perm(¤tuser, board) && !HAS_PERM(PERM_SYSOP)) http_fatal("错误的讨论区"); if (!canenterboard (currentuser.userid, board) && !HAS_PERM(PERM_SYSOP)) http_fatal ("您已经被取消了进本板的权限"); sprintf(buf, "bbsman?board=%s&mode=1", board); sprintf(dir, "boards/%s/.DIR", board); fp=fopen(dir, "r"); if(fp==0) http_fatal("错误的讨论区目录"); printf("<body background=%s bgproperties=fixed>",mytheme.bgpath); printf("<center>%s -- 同主题展开阅读 <a href=bbsdoc?board=%s>[讨论区: %s] </a>[主题 '%s']</center>\n", BBSNAME, board, board,nohtml(title)); // printf("<table width=100%% bgcolor=#65c8aa border=0 cellpadding=0 cellspacing=0 height=1><tr><td></table>"); // printf("<table border=1><tr><td>编号<td>作者<td>日期<td>标题\n"); while(1) { if(fread(&x, sizeof(x), 1, fp)==0) break; sum++; if(!strncmp(title, x.title, 40) || (!strncmp(title, x.title+4, 40) && !strncmp(x.title, "Re: ", 4))) { if(total==0) strcpy(first_file, x.filename); strcpy(userid, x.owner); /* printf("<tr><td>%d", sum); printf("<td>%s", userid_str(x.owner)); if(!(x.accessed[0]&(FILE_MARKED|FILE_DIGEST))) { char buf2[20]; sprintf(buf2, "&box%s=on", x.filename); if(strlen(buf)<500) strcat(buf, buf2); } printf("<td>%6.6s", Ctime(atoi(x.filename+2))+4); printf("<td><a href=bbscon?board=%s&file=%s&num=%d>%s</a>\n", board, x.filename, sum-1, void1(x.title));*/ if (userid[0]=='-') continue; else show_file(board, &x, sum-1); total++; if(total==1) sumfirst=sum-1; } } fclose(fp); printf("\n本主题共有文章 %d 篇 \n", total); printf("<a href=bbsdoc?board=%s&start=%d>本讨论区</a> ", board, sumfirst); if(total>0) { if(has_BM_perm(¤tuser, board)) printf("<a onclick='return confirm(\"确定同主题全部删除?\")' href=%s>同主题删除</a>", buf); } //printf("</center>"); http_quit(); }
int main() { FILE *fp; int type=0, i, num, l; char userid[80], buf[512], path[512], file[512], board[512], title[80]=""; //struct shortfile *brd; struct fileheader *x; char c;//huangxu@060331 init_all(); modify_mode(u_info,EDIT+20000); //bluetent if(!loginok) http_fatal("匆匆过客不能修改文章,请先登录"); strsncpy(board, getparm("board"), 20); type=atoi(getparm("type")); brd=getbcache(board); if(brd==0) http_fatal("错误的讨论区!"); strcpy(board, brd->filename); strsncpy(file, getparm("file"), 20); if(!has_post_perm(¤tuser, board)) http_fatal("错误的讨论区或者您无权在此讨论区发表文章"); x=get_file_ent(board, file); if(strstr(file, "..") || strstr(file, "/")) http_fatal("错误的参数"); if(x==0) http_fatal("错误的参数"); if(strcmp(x->owner, currentuser.userid)) if(!has_BM_perm(¤tuser, board)) http_fatal("你无权修改此文章"); printf("<center>%s -- 修改文章 [使用者: %s]<hr color=green>\n", BBSNAME, currentuser.userid); if(type!=0) return update_form(board, file); printf("<table border=1>\n"); printf("<tr><td>"); printf("<tr><td><form method=post action=bbsedit>\n"); hsprintf(buf, "%s", x->title); printf("使用标题: %s 讨论区: %s<br>\n", buf, board); printf("本文作者:%s<br>\n", currentuser.userid); sprintf(path, "boards/%s/%s", board, file); fp=fopen(path, "r"); if(fp==0) http_fatal("文件丢失"); fseek(fp,0,2); l=ftell(fp); fseek(fp,0,0); for (i=4;l>0&&i>0;l--)//huangxu@060331 { c=fgetc(fp); if (c==0x0a) i--; } if (l<=0) http_fatal("错误的文件"); printf("<textarea name=text rows=20 cols=80 wrap=physicle>"); while(1) { if(fgets(buf, 500, fp)==0) break; //为什么这些代码无法工作? /*for (;i>0;i--) { printf("CHAR::%d::",*(buf+44)); pbuf++; pbuf=strchr(pbuf,0x0a); if (!pbuf) { printf("NOTFOUND%d",i); break; } printf("FOUND:%d,Length:%d,str=%s::",pbuf-buf,strlen(buf),buf); }*/ if(!strcasestr(buf, "</textarea>")) printf("%s", buf); } fclose(fp); printf("</textarea>\n"); printf("<tr><td class=post align=center>\n"); printf("<input type=hidden name=type value=1>\n"); printf("<input type=hidden name=board value=%s>\n", board); printf("<input type=hidden name=file value=%s>\n", file); printf("<input type=submit value=存盘> \n"); printf("<input type=button value=放弃编辑 onclick=javascript:history.go(-1)></form>\n"); printf("</table>"); http_quit(); }
int bbsnot_main() { FILE *fp; char buf[512], board[80], filename[128], notestr[STRLEN]; struct boardmem *x; int mode; html_header(1); check_msg(); changemode(READING); strsncpy(board, getparm("B"), 32); if (!board[0]) strsncpy(board, getparm("board"), 32); if (!(x = getboard(board))) http_fatal("´íÎóµÄ°æÃæ"); mode = atoi(getparm("mode")); switch (mode) { case 1: sprintf(filename, "vote/%s/notes", board); sprintf(notestr, "Ò»°ã±¸Íü¼"); break; /* case '2': sprintf(filename, "vote/%s/secnotes", board); sprintf(notestr, "ÃØÃܱ¸Íü¼"); break; */ case 3: default: setbfile(filename, board, "introduction"); sprintf(notestr, "°æÃæ¼ò½é"); break; } printf("<center>\n"); printf("%s -- %s [ÌÖÂÛÇø: %s]<hr>\n", notestr, BBSNAME, board); fp = fopen(filename, "r"); if (fp == 0) { printf("<br>±¾ÌÖÂÛÇøÉÐÎÞ¡¸%s¡¹¡£\n", notestr); http_quit(); } printf("<table border=1><tr><td class=f2>\n"); while (1) { char *s; bzero(buf, 512); if (fgets(buf, 512, fp) == 0) break; while (1) { int i; s = strstr(buf, "$userid"); if (s == 0) break; for (i = 0; i < 7; i++) s[i] = 32; for (i = 0; i < strlen(currentuser.userid); i++) s[i] = currentuser.userid[i]; } fhhprintf(stdout, "%s", buf); } fclose(fp); printf("</table><hr>\n"); printf("[<a href=%s%s>±¾ÌÖÂÛÇø</a>] ", showByDefMode(), board); if (has_BM_perm(¤tuser, x)) printf("[<a href=bbsmnote?board=%s&mode=%d>±à¼%s</a>]", board, mode, notestr); printf("</center>\n"); http_quit(); return 0; }
int main() { FILE *fp,*fp2; struct shortfile *brd; struct fileheader f; struct userec *u; char buf[80], dir[80], path[80], board[80], file[80], *id; char jdir[80]; int num=0; init_all(); if(!loginok) http_fatal("请先登录"); id=currentuser.userid; strsncpy(board, getparm("board"), 60); strsncpy(file, getparm("file"), 20); brd=getbcache(board); if(strncmp(file, "M.", 2) && strncmp(file, "G.", 2)) http_fatal("错误的参数"); if(strstr(file, "..")) http_fatal("错误的参数"); if(brd==0) http_fatal("板面错误"); if(!has_post_perm(¤tuser, board)) http_fatal("错误的讨论区"); sprintf(dir, "boards/%s/.DIR", board); sprintf(path, "boards/%s/%s", board, file); sprintf(jdir, "boards/%s/.junk", board); fp=fopen(dir, "r"); if(fp==0) http_fatal("错误的参数"); while(1) { if(fread(&f, sizeof(struct fileheader), 1, fp)<=0) break; if(!strcmp(f.filename, file)) {//huangxu@060715:web下删除m文章 if((strcasecmp(id, f.owner)||(f.accessed[0]&FILE_MARKED)) && !has_BM_perm(¤tuser, board)) http_fatal("你无权删除该文"); fp2=fopen(jdir, "a"); fwrite(&f, sizeof(struct fileheader), 1, fp2); fclose(fp2); if(!HAS_PERM(PERM_SYSOP))//huangxu@060406:deleted、junk已经无用 if(strstr(board,"syssecurity")||(!strcmp(board,"Punishment")&&!HAS_PERM(PERM_BLEVELS))) http_fatal("你无权删除该文"); del_record(dir, sizeof(struct fileheader), num); sprintf(buf, "\n※ %s 于 %s 删除·Web[FROM: %s]", currentuser.userid, Ctime(time(0))+4, fromhost); f_append(path, buf); /* if(!strcmp(f.owner, currentuser.userid)) { post_article("junk", f.title, path, f.owner, "", fromhost, -1); } else { post_article("deleted", f.title, path, f.owner, "", fromhost, -1); }*/ //unlink(path); printf("删除成功.<br><a href='bbsdoc?board=%s'>返回本讨论区</a>", board); u=getuser(f.owner); if(!junkboard(board) && u) { if(u->numposts>0) u->numposts--; save_user_data(u); } sprintf(buf, "%s %-12s bbsdel %s\n", Ctime(time(0))+4, id, board); f_append("trace", buf); http_quit(); } num++; } fclose(fp); printf("文件不存在, 删除失败.<br>\n"); printf("<a href='bbsdoc?board=%s'>返回本讨论区</a>", board); http_quit(); }