int bbsfdel_main() { FILE *fp; int i, total = 0; char path[80], userid[80]; struct override f[200]; html_header(1); //check_msg(); if (!loginok || isguest) http_fatal("您尚未登录,请先登录"); changemode(GMENU); sethomefile(path, currentuser->userid, "friends"); printf("<center>%s -- 好友名单 [使用者: %s]<hr>\n", BBSNAME, currentuser->userid); strsncpy(userid, getparm("userid"), 13); if (userid[0] == 0) { printf("<form action=bbsfdel>\n"); printf("请输入欲删除的好友帐号: <input type=text><br>\n"); printf("<input type=submit>\n"); printf("</form>"); http_quit(); } loadfriend(currentuser->userid); if (friendnum <= 0) http_fatal("您没有设定任何好友"); if (!isfriend(userid)) http_fatal("此人本来就不在你的好友名单里"); for (i = 0; i < friendnum; i++) { if (strcasecmp(fff[i].id, userid)) { memcpy(&f[total], &fff[i], sizeof (struct override)); total++; } }
int main() { int type; char pw1[20], pw2[20], pw3[20]; init_all(); if(!loginok) http_fatal("����δ��¼, ���ȵ�¼"); modify_mode(u_info,USERDEF+20000); //bluetent type=atoi(getparm("type")); if(type==0) { printf("%s -- ������ [�û�: %s]<hr color=green>\n", BBSNAME, currentuser.userid); printf("<form action=bbspwd?type=1 method=post>\n"); printf("��ľ�����: <input maxlength=12 size=12 type=password name=pw1><br>\n"); printf("���������: <input maxlength=12 size=12 type=password name=pw2><br>\n"); printf("������һ��: <input maxlength=12 size=12 type=password name=pw3><br><br>\n"); printf("<input type=submit value=ȷ����>\n"); http_quit(); } strsncpy(pw1, getparm("pw1"), 13); strsncpy(pw2, getparm("pw2"), 13); strsncpy(pw3, getparm("pw3"), 13); if(strcmp(pw2, pw3)) http_fatal("�������벻��ͬ"); if(strlen(pw2)<2) http_fatal("������̫��"); if(!checkpasswd(currentuser.passwd, pw1)) http_fatal("���벻��ȷ"); strcpy(currentuser.passwd, crypt1(pw2, pw2)); save_user_data(¤tuser); printf("[%s] �����ijɹ�.", currentuser.userid); }
int bbseva_main() { char board[80], file[80]; int star; html_header(1); check_msg(); strsncpy(board, getparm("B"), 32); if (!board[0]) strsncpy(board, getparm("board"), 32); strsncpy(file, getparm("F"), 20); if (!file[0]) strsncpy(file, getparm("file"), 32); star = atoi(getparm("star")); if (!loginok) http_fatal("匆匆过客不能进行本项操作"); changemode(READING); if(! getboard(board)) http_fatal("错误的讨论区"); if (hideboard(board)) http_fatal("隐藏版面就不要评价文章啦!"); if (star < 1 || star > 5) http_fatal("错误的参数"); if (star == 1) star++; printf("<center>%s -- 评价文章 [使用者: %s]<hr>\n", BBSNAME, currentuser.userid); printf("<table><td>"); do_eva(board, file, star); printf("</td></table>"); printf("[<a href='javascript:history.go(-1)'>返回</a>]"); http_quit(); return 0; }
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() { int i, total=0, mode; char *ptr; struct boardheader *brd; init_all(); printf("<b>删除信件 · %s </b><br>\n",BBSNAME); printpretable_lite(); if(!loginok) http_fatal("请先登录"); mode=atoi(getparm("mode")); if(mode<=0 || mode>1) http_fatal("错误的参数"); printf("<table>"); for(i=0; i<parm_num && i<40; i++) { if(!strncmp(parm_name[i], "box", 3)) { total++; if(mode==1) do_del(parm_name[i]+3); /* for extension */ } } printf("</table>"); if(total<=0) printf("请先选定文章<br>\n"); printposttable_lite(); printf("<br><a href=bbsmail>返回信件模式</a>"); http_quit(); }
int bbsmsg_main() { //modify by mintbaggio 20040829 for new www char buf[MAX_MSG_SIZE]; char msgbuf[MAX_MSG_SIZE*2]; int count, i; struct msghead head; html_header(1); check_msg(); printf("<body>"); printf("<div class=rhead>%s -- 查看信息</div><hr>\n", BBSNAME); if (!loginok || isguest) http_fatal("匆匆过客无法查看讯息, 请先登录"); changemode(LOOKMSGS); count = get_msgcount(0, currentuser.userid); if (count == 0) http_fatal("没有任何讯息"); for (i=0; i<count; i++) { load_msghead(0, currentuser.userid, &head, i); load_msgtext(currentuser.userid, &head, buf); translate_msg(buf, &head, msgbuf, 0); hprintf("%s", msgbuf); } u_info->unreadmsg = 0; printf("<a onclick='return confirm(\"你真的要清除所有讯息吗?\")' href=bbsdelmsg>清除所有讯息</a> "); printf("<a href=bbsmailmsg>寄回所有信息</a>"); http_quit(); return 0; }
int main() { FILE *fp; struct fileheader f; char rpath[80],*id,path[80]; init_all(); if(loginok == 0) http_fatal("ÄúÉÐδµÇ¼"); id=currentuser.userid; sprintf(rpath, "mail/%c/%s/.recycle", toupper(id[0]), id); fp=fopen(rpath, "r"); if(fp==0) http_fatal("´íÎóµÄ²ÎÊý2"); while(1) { if(fread(&f, sizeof(struct fileheader ), 1, fp)<=0) break; sprintf(path, "mail/%c/%s/%s", toupper(id[0]), id, f.filename); unlink(path); } unlink(rpath); fp=fopen(rpath,"a+"); if(fp!=0) { fclose(fp); redirect("bbsmailrecycle"); // printf("Çå¿Õ³É¹¦£¬<a href=bbsmailrecycle> ·µ»Ø</a>"); http_quit(); } fclose(fp); http_fatal("Çå¿Õ³ö´í"); }
int check_if_ok() { if(user_perm(¤tuser, PERM_LOGINOK)) http_fatal("您已经通过本站的身份认证, 无需再次填写注册单."); if(has_fill_form()) http_fatal("目前站长尚未处理您的注册单,请耐心等待."); }
int main() { struct fileheader *x; char board[80], file[80], target[80]; init_all(); strsncpy(board, getparm("board"), 30); strsncpy(file, getparm("file"), 30); strsncpy(target, getparm("target"), 30); if(!loginok) http_fatal("匆匆过客不能进行本项操作"); if(!has_read_perm(¤tuser, board)) http_fatal("错误的讨论区"); x=get_file_ent(board, file); if(x==0) http_fatal("错误的文件名"); printf("<center>%s -- 转寄/推荐给好友 [使用者: %s]<hr color=green>\n", BBSNAME, currentuser.userid); if(target[0]) { if(!strstr(target, "@")) { if(!getuser(target)) http_fatal("错误的使用者帐号"); strcpy(target, getuser(target)->userid); } return do_fwd(x, board, target); } printf("<table><tr><td>\n"); printf("文章标题: %s<br>\n", nohtml(x->title)); printf("文章作者: %s<br>\n", x->owner); printf("原讨论区: %s<br>\n", board); printf("<form action=bbsfwd method=post>\n"); printf("<input type=hidden name=board value=%s>", board); printf("<input type=hidden name=file value=%s>", file); printf("把文章转寄给 <input name=target size=30 maxlength=30 value=%s> (请输入对方的id或email地址). <br>\n", currentuser.email); printf("<input type=submit value=确定转寄></form>"); }
int attach_init() { char *buf, buf2[1024], *t2, *t3; int n; srand(time(0)*2+getpid()); chdir(BBSHOME); printf("Content-Type: application/octet-stream \n"); printf("Content-Disposition: attachment; filename=tshirt.csv \n\n", CHARSET); n=atoi(getsenv("CONTENT_LENGTH")); if(n>5000000) n=5000000; buf=calloc(n+1, 1); if(buf==0) http_fatal("memory overflow"); fread(buf, 1, n, stdin); buf[n]=0; t2=strtok(buf, "&"); while(t2) { t3=strchr(t2, '='); if(t3!=0) { t3[0]=0; t3++; __unhcode(t3); parm_add(trim(t2), t3); } t2=strtok(0, "&"); } strsncpy(buf2, getsenv("QUERY_STRING"), 1024); t2=strtok(buf2, "&"); while(t2) { t3=strchr(t2, '='); if(t3!=0) { t3[0]=0; t3++; __unhcode(t3); parm_add(trim(t2), t3); } t2=strtok(0, "&"); } strsncpy(buf2, getsenv("HTTP_COOKIE"), 1024); t2=strtok(buf2, ";"); while(t2) { t3=strchr(t2, '='); if(t3!=0) { t3[0]=0; t3++; parm_add(trim(t2), t3); } t2=strtok(0, ";"); } strsncpy(fromhost, getsenv("REMOTE_ADDR"), 32); seteuid(BBSUID); if(geteuid()!=BBSUID) http_fatal("uid error."); shm_init(); loginok=user_init(¤tuser, &u_info); if(u_info==0){ u_info=&guest; } return; }
int bbsnewmail_main() { FILE *fp; struct fileheader x; int total = 0, total2 = 0; char dir[80]; if (!loginok || isguest) http_fatal("您尚未登录, 请先登录"); sprintf(dir, "mail/%c/%s/.DIR", mytoupper(currentuser->userid[0]), currentuser->userid); if (cache_header(file_time(dir), 1)) return 0; html_header(1); //check_msg(); changemode(RMAIL); //去掉了框架 printf("<body topmargin=0 leftMargin=1 MARGINWIDTH=1 MARGINHEIGHT=0>" WWWLEFT_DIV); printf("<center>\n"); printf ("%s -- 未读邮件列表 [使用者: %s] [信箱容量: %dk, 已用空间: %dk]<hr>\n", BBSNAME, currentuser->userid, max_mailsize(currentuser), get_mailsize(currentuser)); fp = fopen(dir, "r"); if (fp == 0) http_fatal("目前您的信箱没有任何信件"); printf("<table border=1>\n"); printf ("<tr><td>序号</td><td>状态</td><td>发信人</td><td>日期</td><td>信件标题</td></tr>\n"); while (1) { if (fread(&x, sizeof (x), 1, fp) <= 0) break; total++; if (x.accessed & FH_READ) continue; printf("<tr><td>%d</td><td>N</td>", total); printf("<td>%s</td>", userid_str(fh2owner(&x))); printf("<td>%6.6s</td>", Ctime(x.filetime) + 4); printf("<td><a href=bbsmailcon?file=%s&num=%d>", fh2fname(&x), total - 1); if (strncmp("Re: ", x.title, 4)) printf("★ "); hprintf("%42.42s", void1(x.title)); printf(" </a></td></tr>\n"); total2++; } fclose(fp); printf("</table><hr>\n"); printf("您的信箱共有%d封信件, 其中新信%d封.", total, total2); printf("</center>"); showfile(MY_BBS_HOME "/wwwtmp/googleanalytics"); // printf("</body>"); //修改框架,页面底部 printf(WWWFOOT_DIV "</body></html>\n"); http_quit(); return 0; }
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 main() { char board[80]; // char closewindow[80]; int maxsize=1024000;//网络硬盘上限 // int currexp;//用户的经验值 //currexp=currentuser.numposts + currentuser.numlogins/5 + (time(0)-currentuser.firstlogin)/86400 + currentuser.stay/3600; // currexp=(time(0)-currentuser.firstlogin)/86400; //currexp=currentuser.stay/3600; init_all(); if(!loginok) http_fatal("匆匆过客无法上传附件"); strsncpy(board, currentuser.userid, 30);//用board存储用户id了:)//bluetent // strsncpy(closewindow, getparm("closewindow"), 10);//bluetent // if(!has_read_perm(¤tuser, board)) http_fatal("错误的讨论区"); // if(!has_post_perm(¤tuser, board)) http_fatal("无权上载附件至该板"); if(currentuser.stay/3600<100) http_fatal("上站累计时数未满100小时,无权使用本功能"); if((time(0)-currentuser.firstlogin)/86400<60) http_fatal("注册帐号时间未超过60天,无权使用本功能"); //strsncpy(board, getparm("board"), 80); // printf("<center>%s -- 上传附件至%s讨论区 [使用者: %s] <hr color=green>\n", // BBSNAME, board, currentuser.userid); printf("<center>网络硬盘 [使用者: %s] <hr color=green>\n", currentuser.userid); // printf("注意,bbs服务器资源宝贵,为节省空间,请勿上传过大的文件。请勿上传与板面无关的文件。<br>\n"); // printf("目前单个上载文件大小限制为<font color=red> %d </font>字节.<br>\n", maxsize); //printf("%d,%d,%d,%d",currentuser.numposts,currentuser.numlogins/5,(time(0)-currentuser.firstlogin)/86400,currentuser.stay/3600); // printf("请遵守国家法律,<font color=red>严禁上载非法资料和可能导致纠纷的资料</font>。<br>\n"); printf("<form method=post action=bbsnetdoupload enctype='multipart/form-data'>\n"); printf("<table>\n"); printf("<tr><td>上载附件: <td><input type=file name=up>"); printf("<input type=hidden name=MAX_FILE_SIZE value=%d>", maxsize); printf("<input type=hidden name=board value='%s'>", board); // printf("<tr><td>备注: <td>"); // printf("<input type=radio name=level value=0 checked>1星 "); // printf("<input type=radio name=level value=1>2星 "); // printf("<input type=radio name=level value=2>3星 "); // printf("<input type=radio name=level value=3>4星 "); // printf("<input type=radio name=level value=4>5星 "); // printf("<tr><td>希望保留的时间: <td><input name=live size=4 maxlength=4 value=180>(1-9999)天<br>\n"); printf("<tr><td>附件的简要说明: <td><input name=exp size=60 maxlength=72>\n"); //add by bluetent 2002.12.22 /* if (!strcmp("yes", closewindow)) printf("<input type=hidden name=closewindows value=yes>"); else printf("<input type=hidden name=closewindows value=no>");*/ //add end printf("</table>\n"); printf("<hr color=green><br>\n"); printf("<input type=submit value='开始上传文件'> \n"); printf("<input type=button onclick='javascript:history.go(-1)' value='返回上一页'> \n"); printf("</form>"); }
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 bbsnewmail_main() { //modify by mintbaggio 20040829 for new www FILE *fp; struct fileheader x; int total = 0, total2 = 0; char dir[80]; if (!loginok || isguest) http_fatal("您尚未登录, 请先登录"); sprintf(dir, "mail/%c/%s/.DIR", mytoupper(currentuser.userid[0]), currentuser.userid); if(cache_header(file_time(dir),1)) return 0; html_header(1); check_msg(); changemode(RMAIL); printf("<body><center>\n"); printf ("<div class=rhead>%s -- 新邮件列表 [使用者: <span class=h11>%s</span>]<br>[信箱容量: <span class=h11>%d</span>k, 已用空间: <span class=h11>%dk</span>]</div><hr>\n", BBSNAME, currentuser.userid, max_mail_size(), get_mail_size()); fp = fopen(dir, "r"); if (fp == 0) http_fatal("目前您的信箱没有任何信件"); printf("<table border=1>\n"); printf ("<tr><td>序号</td><td>状态</td><td>发信人</td><td>日期</td><td>信件标题</td></tr>\n"); while (1) { if (fread(&x, sizeof (x), 1, fp) <= 0) break; total++; if (x.accessed & FH_READ) continue; printf("<tr><td>%d</td><td>N</td>", total); printf("<td>%s</td>", userid_str(fh2owner(&x))); printf("<td>%6.6s</td>", Ctime(x.filetime) + 4); printf("<td><a href=bbsmailcon?file=%s&num=%d>", fh2fname(&x), total - 1); if (strncmp("Re: ", x.title, 4)) printf("★ "); hprintf("%42.42s", void1(x.title)); printf(" </a></td></tr>\n"); total2++; } fclose(fp); printf("</table><hr>\n"); printf("您的信箱共有%d封信件, 其中新信%d封.", total, total2); printf("</center></body>"); http_quit(); return 0; }
int main() { init_all(); printf("<b>隐身 · %s </b><br>\n",BBSNAME); printpretable_lite(); if(!loginok) http_fatal("匆匆过客不能进行此操作, 请先登录"); if(!(currentuser.userlevel & PERM_CLOAK)) http_fatal("错误的参数"); if(u_info->invisible) { u_info->invisible=0; printf("隐身状态已经停止了."); } else { u_info->invisible=1; printf("隐身状态已经开始了."); } }
int bbsfind_main() { char user[32], title3[80], title[80], title2[80]; int day; html_header(1); //check_msg(); changemode(READING); strsncpy(user, getparm("user"), 13); strsncpy(title, getparm("title"), 50); strsncpy(title2, getparm("title2"), 50); strsncpy(title3, getparm("title3"), 50); day = atoi(getparm("day")); printf("<body>"); if (day == 0) { printf("%s -- 站内文章查询<hr>\n", BBSNAME); printf ("<font color=red>用户查询请使用各版面上的 版内查询 功能,此查询主要供管理人员使用</font>" "<br> 目前系统负载 %f。系统负载超过 1.5 或者上线人数超过 %d 时将不能进行查询。<br>" "系统负载统计图和上线人数统计图可以到<a href=home?B=bbslists>bbslists版</a>查看<br>", *system_load(), ONLINELIMIT); if (!loginok || isguest) printf("<b>您还没有登录,请先登录再使用本功能</b><br>"); printf("<form action=bbsfind>\n"); printf ("文章作者: <input maxlength=12 size=12 type=text name=user> (不填查找所有作者)<br>\n"); printf ("标题含有: <input maxlength=60 size=20 type=text name=title>"); printf (" AND <input maxlength=60 size=20 type=text name=title2><br>\n"); printf ("标题不含: <input maxlength=60 size=20 type=text name=title3><br>\n"); printf ("查找最近: <input maxlength=5 size=5 type=text name=day value=7> 天以内的文章<br><br>\n"); printf("<input type=submit value=提交查询></form>\n"); } else { if (*system_load() >= 1.7 || count_online() > ONLINELIMIT) http_fatal ("用户查询请使用各版面上的 版内查询 功能,此查询主要供管理人员使用。系统负载(%f)或上线人数(%d)过高, 请在上站人数较少的时间查询( 系统负载超过 1.5 或者上线人数超过 %d 时不能进行查询 )", *system_load(), count_online(), ONLINELIMIT); if (!loginok || isguest) http_fatal("请先登录再使用本功能。"); search(user, title, title2, title3, day * 86400); } // printSoukeForm(); showfile(MY_BBS_HOME "/wwwtmp/googleanalytics"); printf("</body>"); http_quit(); return 0; }
int bbsspam_main() { int num; struct spamheader *sh = NULL; struct spamheader *sh1; uint16_t spamnum; struct yspam_ctx *yctx; unsigned long long mid; char midbuf[100]; int ret; if ((!loginok || isguest) && (!tempuser)) http_fatal("您尚未登录, 请先登录"); html_header(1); changemode(RMAIL); printf("<body><center>\n"); printf("%s -- 垃圾信件列表 [使用者: %s]\n", BBSNAME, currentuser->userid); yctx = yspam_init("127.0.0.1"); ret = yspam_getallspam(yctx, currentuser->userid, &sh, &spamnum); yspam_fini(yctx); if (ret < 0 && ret != -YSPAM_ERR_NOSUCHMAIL) { if (sh) free(sh); http_fatal("内部错误 1"); } printf("共有 %d 封垃圾邮件", spamnum); printf("<table>"); printf ("<tr><td>序号</td><td>发信人</td><td>日期</td><td>信件标题</td></tr>\n"); sh1 = sh; for (num = 1; num <= spamnum; num++) { mid = ((unsigned long long)ntohl(sh1->mailid_high) << 32) + ntohl(sh1->mailid_low); sprintf(midbuf, "%llu", mid); printf("<tr><td>%d</td><td>%s</td><td>%12.12s</td><td><a href=bbsspamcon?id=%s&magic=%d>", num, void1(titlestr(sh1->sender)), Ctime(ntohl(sh1->time)) + 4, midbuf, ntohl(sh1->magic)); if (sh1->title[0] == 0) printf("无题"); else printf("%s", void1(titlestr(sh1->title))); printf("</a></td></tr>"); sh1++; } if (sh) free(sh); printf("</table>"); http_quit(); return 0; }
int do_del(char *board, char *file) { FILE *fp; int num = 0, filetime; char path[256], buf[256], dir[256], *id = currentuser.userid; struct fileheader f; filetime = atoi(file + 2); sprintf(dir, "boards/%s/.DIR", board); sprintf(path, "boards/%s/%s", board, file); fp = fopen(dir, "r"); if (fp == 0) http_fatal("错误的参数"); while (1) { if (fread(&f, sizeof (struct fileheader), 1, fp) <= 0) break; if (f.filetime == filetime) { del_record(dir, sizeof (struct fileheader), num); cancelpost(board, id, &f, !strcmp(id, f.owner)); updatelastpost(board); fclose(fp); printf("<tr><td>%s <td>标题:%s <td>删除成功.\n", fh2owner(&f), nohtml(f.title)); snprintf(buf, 256, "%s del %s %s %s", currentuser.userid, board, fh2owner(&f), f.title); newtrace(buf); return 0; } num++; } fclose(fp); printf("<tr><td><td>%s<td>文件不存在.\n", file); return -1; }
int bbschangestyle_main() { char name[STRLEN], p[STRLEN], main_page[STRLEN], *tmp; int colorIndex, n = NWWWSTYLE; colorIndex = atoi(getparm("color")); get_session_string(name); tmp = strchr(name, '/'); if (NULL != tmp) { *tmp = '\0'; } if (!strcmp(currentuser.userid,"guest")) { n = NWWWSTYLE - 1; } if (colorIndex > -1 && colorIndex < n) { addextraparam(name, sizeof(name), 0, colorIndex); sprintf(p, "/%s%s./", SMAGIC, name); print_session_string(p); html_header(1); sprintf(main_page, "/%s/", SMAGIC); redirect(main_page); } else { http_fatal("´íÎóµÄÅäÉ«·½°¸"); } http_quit(); return 0; }
int bbspassport_main() { char id[IDLEN + 1], buf[384], site[256]; struct userec *x; html_header(1); if (key_fail) http_fatal("�ڲ����� ��ϵά��!"); strsncpy(buf, getparm("pp"), sizeof (buf)); strsncpy(site, getparm("site"), sizeof (site)); strsncpy(id, des3_decode(buf, 0), IDLEN + 1); if (id[0] && getuser(id, &x) > 0) { snprintf(buf, sizeof (buf), "http://%s?q=%s", site, des3_encode(id, 1)); redirect(buf); http_quit(); return 0; } printf("<form name=lpassport method=post action=lpassport>\n"); printf("<table width=100%%>\n"); printf ("<tr><td align=right>*���������:<td align=left><input name=id size=12 maxlength=%d >\n", IDLEN); printf ("<tr><td align=right>*����������:<td align=left><input type=password name=pw size=12 maxlength=%d>\n", PASSLEN - 1); printf("<tr><td><td><input type=hidden name=site value=\"%s\">", site); printf("<tr><td align=right><input type=submit value=��¼>" " <td align=left><input type=reset value=������д></table>"); printf("</form>"); http_quit(); return 0; }
int main() { char buf[512]; char file[80]; char keystr[80]; //关键字 int has=1; init_all(); if(!loginok) http_fatal("您尚未登录"); modify_mode(u_info,FTPSEARCH); strsncpy(keystr, getparm("keystr"), 80); printf("<body background=/bg_1.gif bgproperties=fixed>"); if(!strlen(keystr)) { printf("<table width=600 align=center><tr height=150><td align=center valign=bottom style='font-size:14px'><font color=blue>局域网FTP搜索引擎<p><p></font></td></tr>"); printf("<tr><td align=center style='font-size:14px'><form name=ftpsearch>请输入关键字:<input name=keystr type=text size=50 maxlength=80><input type=submit value=搜索> (<font color=red>%d</font>人在线)</form><script language=javascript>document.ftpsearch.keystr.focus();</script></td></tr>", countuser()); printf("<tr><td><table><tr>"); printf("<td><a href=bbsmyftp?type=4>我要加盟</a></td>"); if(SiteInList(fromhost)) printf("<td> | <a href=bbsmyftp>管理站点数据</a> | <a href=bbsmyftp?type=3>已上传数据的站点列表</a></td>"); printf("</tr></table></td></tr>"); printf("</tr><tr><td width=80%%>【说明】 本搜索引擎用来查找南开大学校内教育网和宿舍网FTP站点的数据。<br>各位站长可以自行上传自己的站点数据,服务器端对原始数据进行重新编码以供搜索。<br>因该引擎仅依照编码后的数据进行搜索,故不会对网络负载产生影响。</td></tr>"); printf("</table>"); } else { sprintf(file, "tmp/%d.tmp", getpid()); search(keystr, file); printf("</pre>"); unlink(file); } http_quit(); }
int bbsparm_main() { ////modify by mintbaggio 20040829 for new www int i, perm = 1, type; html_header(1); check_msg(); type = atoi(getparm("type")); printf("<body><center><div class=rhead>%s -- 修改个人参数 [使用者: <span class=h11>%s</span>]</div><hr>\n", BBSNAME, currentuser.userid); if (!loginok || isguest) http_fatal("匆匆过客不能设定参数"); changemode(USERDEF); if (type) return read_form(); printf("<form action=bbsparm?type=1 method=post>\n"); printf("<table>\n"); for (i = 0; defines[i]; i++) { char *ptr = ""; if (i % 2 == 0) printf("<tr>\n"); if (currentuser.userdefine & perm) ptr = " checked"; printf ("<td><input type=checkbox name=perm%d%s></td><td>%s</td>", i, ptr, defines[i]); perm = perm * 2; } printf("</table>"); printf ("<input type=submit value=确定修改></form><br>以上参数大多仅在telnet方式下才有作用\n"); printf("</body>"); http_quit(); return 0; }
int bbsfall_main() { int i; html_header(1); check_msg(); if (!loginok || isguest) http_fatal("дЗипн╢╣гб╪, гКох╣гб╪"); changemode(GMENU); loadfriend(currentuser->userid); printf("<body><center>\n"); printf("%s -- ╨цсяцШ╣╔ [й╧сцуъ: %s]<hr><br>\n", BBSNAME, currentuser->userid); printf("дЗ╧╡иХ╤╗ак %d н╩╨цся<br>", friendnum); printf ("<table border=1><tr><td>пР╨е</td><td>╨цся╢З╨е</td><td>╨цсяк╣цВ</td><td>и╬ЁЩ╨цся</td></tr>"); for (i = 0; i < friendnum; i++) { printf("<tr><td>%d</td>", i + 1); printf("<td><a href=bbsqry?userid=%s>%s</a></td>", fff[i].id, fff[i].id); printf("<td>%s</td>\n", nohtml(fff[i].exp)); printf ("<td>[<a onclick='return confirm(\"х╥й╣и╬ЁЩбП?\")' href=bbsfdel?userid=%s>и╬ЁЩ</a>]</td></tr>", fff[i].id); } printf("</table><hr>\n"); printf("[<a href=bbsfadd>лМ╪спб╣д╨цся</a>]</center></body>\n"); http_quit(); return 0; }
int main() { FILE *fp; char *ptr, plan[256], buf[10000]; init_all(); printf("<center>\n"); if(!loginok) http_fatal("匆匆过客不能设置说明档,请先登录"); modify_mode(u_info,USERDEF+20000); //bluetent sprintf(plan, "home/%c/%s/plans", toupper(currentuser.userid[0]), currentuser.userid); if(!strcasecmp(getparm("type"), "update")) save_plan(plan); printf("%s -- 设置个人说明档 [%s]<hr>\n", BBSNAME, currentuser.userid); printf("<form method=post action=bbsplan?type=update>\n"); fp=fopen(plan, "r"); if(fp) { fread(buf, 9999, 1, fp); ptr=strcasestr(buf, "<textarea>"); if(ptr) ptr[0]=0; fclose(fp); } printf("<table width=610 border=1><tr><td>"); printf("<textarea name=text rows=20 cols=80 wrap=physicle>\n"); printf(void1(buf)); printf("</textarea></table>\n"); printf("<input type=submit value=存盘> "); printf("<input type=reset value=复原>\n"); printf("<hr>\n"); http_quit(); }
int main() { FILE *fp; int type; init_all(); type=atoi(getparm("type")); if(!loginok) http_fatal("您尚未登录, 请重新登录。"); printf("%s -- 填写注册单<hr color=green>\n", BBSNAME); check_if_ok(); if(type==1) { check_submit_form(); http_quit(); } printf("您好, %s, 注册单通过确认后才可获得发表文章,发送信件和讯息的权利, 下面各项务必请认真真实填写<br><hr>\n", currentuser.userid); printf("<form method=post action=bbsform?type=1>\n"); printf("真实姓名: <input name=realname type=text maxlength=80 size=8 value='%s'><br>\n", nohtml(currentuser.realname)); printf("学校系级: <input name=dept type=text maxlength=320 size=32 value='%s'>(或工作单位)<br>\n", nohtml(currentuser.reginfo)); printf("居住地址: <input name=address type=text maxlength=320 size=32 value='%s'><br>\n", nohtml(currentuser.address)); printf("联络电话: <input name=phone type=text maxlength=320 size=32><br><hr><br>\n"); printf("<input type=submit value=填好了> <input type=reset>"); http_quit(); }
int do_eva(char *board, char *file, int star) { FILE *fp; char dir[256]; struct fileheader f; int result[2], filetime; filetime = atoi(file + 2); sprintf(dir, "boards/%s/.DIR", board); fp = fopen(dir, "r+"); if (fp == 0) http_fatal("错误的参数"); flock(fileno(fp), LOCK_EX); while (1) { if (fread(&f, sizeof (struct fileheader), 1, fp) <= 0) break; if (f.filetime == filetime) { if (set_eva(board, file, star, result, dir)) { f.staravg50 = result[0]; f.hasvoted = result[1]; fseek(fp, -1 * sizeof (struct fileheader), SEEK_CUR); fwrite(&f, sizeof (struct fileheader), 1, fp); } fclose(fp); printf("%s", dir); return 0; } } fclose(fp); printf("<td><td><td>%s<td>文件不存在.\n", file); return -1; }
int bbseva_main() { html_header(1); http_fatal("请安装MySQL支持环境!"); return 0; }
int bbsfind_main() { char user[32], title3[80], title[80], title2[80]; int day; html_header(1); check_msg(); changemode(READING); strsncpy(user, getparm("user"), 13); strsncpy(title, getparm("title"), 50); strsncpy(title2, getparm("title2"), 50); strsncpy(title3, getparm("title3"), 50); day = atoi(getparm("day")); printf("<body>"); if (day == 0) { printf("%s -- 站内文章查询<hr>\n", BBSNAME); printf ("目前系统负载 %f。系统负载超过 5.0 或者上线人数超过 4000 时将不能进行查询。<br>" "系统负载统计图和上线人数统计图可以到<a href=%sbbslists>bbslists版</a>查看<br>", *system_load(),showByDefMode()); if (!loginok || isguest) printf("<b>您还没有登录,请先登录再使用本功能</b><br>"); printf("<form action=bbsfind>\n"); printf ("文章作者: <input maxlength=12 size=12 type=text name=user> (不填查找所有作者)<br>\n"); printf ("标题含有: <input maxlength=60 size=20 type=text name=title>"); printf (" AND <input maxlength=60 size=20 type=text name=title2><br>\n"); printf ("标题不含: <input maxlength=60 size=20 type=text name=title3><br>\n"); printf ("查找最近: <input maxlength=5 size=5 type=text name=day value=7> 天以内的文章<br><br>\n"); printf("<input type=submit value=提交查询></form>\n"); } else { if (*system_load() >= 5.0 || count_online() > 4000) http_fatal ("系统负载(%f)或上线人数(%d)过高, 请在上站人数较少的时间查询.", *system_load(), count_online()); if (!loginok || isguest) http_fatal("请先登录再使用本功能。"); search(user, title, title2, title3, day * 86400); } printf("</body>"); http_quit(); return 0; }
int bbsupload_main() { char *ptr; char userattachpath[256]; int totalsize; html_header(1); printf("<body><center><div class=swidth style=\"text-align:left\">"); if (!loginok || isguest) http_fatal("请先登录"); if (!user_perm(currentuser, PERM_POST)) http_fatal("缺乏 POST 权限"); snprintf(userattachpath, sizeof (userattachpath), PATHUSERATTACH "/%s", currentuser->userid); mkdir(userattachpath, 0760); ptr = getparm("del"); if (*ptr) { upload_do_del(userattachpath, ptr); totalsize = upload_getpathsize(userattachpath, 1); if (totalsize < MAXATTACHSIZE) printuploadform(); showfile(MY_BBS_HOME "/wwwtmp/googleanalytics"); printf("</body></html>"); return 0; } totalsize = upload_getpathsize(userattachpath, 0); if (totalsize < 0) http_fatal("无法检测目录大小"); totalsize = save_attach(userattachpath, totalsize); /* Cleanup. */ totalsize = upload_getpathsize(userattachpath, 1); if (totalsize < MAXATTACHSIZE) printuploadform(); printf("</div></center>"); showfile(MY_BBS_HOME "/wwwtmp/googleanalytics"); printf("</body></html>"); return 0; }