Exemple #1
0
static int
inform(char *board, char *user, char *exp, int dt)
{
	FILE *fp;
	char path[80], title[80], buf[512];
	struct tm *tmtime;
	time_t daytime = now_t + (dt + 1) * 86400;
	tmtime = gmtime(&daytime);
	sprintf(title, "%s 被 %s 取消在%s的POST权", user, currentuser->userid, board);
	sprintf(path, "bbstmpfs/tmp/%d.tmp", thispid);
	fp = fopen(path, "w");
	fprintf(fp, "【此篇文章是由自动发信系统所张贴】\n\n");
	snprintf(buf, sizeof (buf),
		"被封原因: %s\n"
		"被封天数: %d\n"
		"解封日期: %d月%d日\n"
		"管理人员: %s\n"
		"解封办法: 联系版主提前解封或由系统自动解封\n"
		"如有异议,可向管理人员提出,或到Arbitration版投诉\n\n\n",
		 exp, dt, tmtime->tm_mon + 1, tmtime->tm_mday,
		currentuser->userid);
	fputs(buf, fp);
	fclose(fp);
	securityreport(title, buf);
	post_article(board, title, path, "deliver", "自动发信系统",
		     "自动发信系统", -1, 0, 0, "deliver", -1);
	if (!hideboard(board))
		post_article("Penalty", title, path, "deliver", "自动发信系统",
			     "自动发信系统", -1, 0, 0, "deliver", -1);
	mail_file(path, user, title, "deliver");
	unlink(path);
	printf("系统已经发信通知了%s.<br>\n", user);
	return 0;
}
Exemple #2
0
//	核对系统密码
int	check_systempasswd()
{
	FILE*	pass;
	char    passbuf[20], prepass[STRLEN];
	clear();
	if ((pass = fopen("etc/.syspasswd", "r")) != NULL) {
		fgets(prepass, STRLEN, pass);
		fclose(pass);
		prepass[strlen(prepass) - 1] = '\0';
		getdata(1, 0, "请输入系统密码: ", passbuf, 19, NOECHO, YEA);
		if (passbuf[0] == '\0' || passbuf[0] == '\n')
			return NA;
		if (!checkpasswd(prepass, passbuf)) {
			move(2, 0);
			prints("错误的系统密码...");
			securityreport("系统密码输入错误...", 0, 0);
			pressanykey();
			return NA;
		}
	}
	return YEA;
}
Exemple #3
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(&currentuser, 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;
}
Exemple #4
0
// ��username�û�ͨ����֤�� added by interma@BMY 2005.5.12
static void register_success(int usernum, char *userid, char *realname, char *dept, 
char *addr, char *phone, char *assoc, char *email)
{
	struct userec uinfo;
	FILE *fout, *fn;
	char buf[STRLEN];
	int n;

	//int id = getuser(userid);
	usernum = getuser(userid);

	setuserfile(genbuf, "mailcheck");
	if ((fn = fopen(genbuf, "w")) == NULL) {
		fclose(fn);
		return;
	}
	fprintf(fn, "usernum: %d\n", usernum);
	fclose(fn);

	memcpy(&uinfo, &lookupuser, sizeof (uinfo));

			strsncpy(uinfo.userid, userid,
				 sizeof (uinfo.userid));
			strsncpy(uinfo.realname, realname,
				 sizeof (uinfo.realname));
			strsncpy(uinfo.address, addr,
				 sizeof (uinfo.address));
			sprintf(genbuf, "%s$%s@%s", dept, phone, userid);
			strsncpy(uinfo.realmail, genbuf,
				 sizeof (uinfo.realmail));

			strsncpy(uinfo.email, email, sizeof (uinfo.email));

			uinfo.userlevel |= PERM_DEFAULT;	// by ylsdd
			substitute_record(PASSFILE, &uinfo, sizeof (struct userec), usernum);

			sethomefile(buf, uinfo.userid, "sucessreg");
			if ((fout = fopen(buf, "w")) != NULL) {
				fprintf(fout, "\n");
				fclose(fout);
			}

			sethomefile(buf, uinfo.userid, "register");
	
			if ((fout = fopen(buf, "w")) != NULL) 
			{
				
				fprintf(fout, "%s: %d\n", "usernum", usernum);
				fprintf(fout, "%s: %s\n", "userid", userid);
				fprintf(fout, "%s: %s\n", "realname", realname);
				fprintf(fout, "%s: %s\n", "dept", dept);
				fprintf(fout, "%s: %s\n", "addr", addr);
				fprintf(fout, "%s: %s\n", "phone", phone);
				fprintf(fout, "%s: %s\n", "assoc", assoc);

				n = time(NULL);
				fprintf(fout, "Date: %s",
					ctime((time_t *) & n));
				fprintf(fout, "Approved: %s\n", userid);
				fclose(fout);
			}

			mail_file("etc/s_fill", uinfo.userid,
				  "������ͨ�������֤"); // ����ط��и�覴ã����Ƿ�����Ϊ����

			mail_file("etc/s_fill2", uinfo.userid,
				  "��ӭ����" MY_BBS_NAME "���ͥ");
			sethomefile(buf, uinfo.userid, "mailcheck");
			unlink(buf);
			sprintf(genbuf, "�� %s ͨ�����ȷ��.", uinfo.userid);
			securityreport(genbuf, genbuf);

	return ;
}
Exemple #5
0
int kick_user( struct user_info *userinfo )
{
    int     id, ind;
    struct user_info uin;
    struct userec kuinfo;
    char    kickuser[40], buffer[40];

    if (uinfo.mode != LUSERS && uinfo.mode != OFFLINE && uinfo.mode != FRIEND)
    {
        modify_user_mode(ADMIN);
        stand_title("踢使用者下站");
        move(1, 0);
        usercomplete("输入使用者帐号: ", kickuser);
        if (*kickuser == '\0')
        {
            clear();
            return 0;
        }
        if (!(id = getuser(kickuser)))
        {
            move(3, 0);
            prints("无效的用户 ID!");
            clrtoeol();
            pressreturn();
            clear();
            return 0;
        }
        move(1, 0);
        clrtoeol();
        sprintf(genbuf,"踢掉使用者 : [%s].", kickuser);
        move(2, 0);
        if (askyn(genbuf, NA, NA) == NA)
        {
            move(2, 0);
            prints("取消踢使用者..\n");
            pressreturn();
            clear();
            return 0;
        }
        search_record(PASSFILE, &kuinfo, sizeof(kuinfo), cmpuids, kickuser);
        ind = search_ulist(&uin, t_cmpuids, id);
    }
    else
    {
        uin = *userinfo;
        strcpy(kickuser, uin.userid);
        ind = YEA;
    }
    if (!ind||!uin.active||(uin.pid && kill(uin.pid, 0)==-1))
    {
        if(uinfo.mode!=LUSERS&&uinfo.mode!=OFFLINE&&uinfo.mode!=FRIEND)
        {
            move(3, 0);
            prints("用户 [%s] 不在线上",kickuser);
            clrtoeol();
            pressreturn();
            clear();
        }
        return 0;
    }
    kill(uin.pid, SIGHUP);
    //sprintf(buffer, "kicked %s", kickuser);
    //report(buffer);
    if(strcmp(currentuser.userid , kickuser))
    {
        char    secu[STRLEN];
        sprintf(secu, "将用户[%s]踢下站", kickuser);
        securityreport(secu);
    }
    sprintf(genbuf, "%s (%s)", kuinfo.userid, kuinfo.username);
    log_usies("KICK ", genbuf);
    move(2, 0);
    if(uinfo.mode!=LUSERS&&uinfo.mode!=OFFLINE&&uinfo.mode!=FRIEND)
    {
        prints("用户 [%s] 已经被踢下站.\n",kickuser);
        pressreturn();
        clear();
    }
    return 1;
}