Exemplo n.º 1
0
//  ---------------------------   警署     --------------------------  //
static int
cop_accuse()
{
    char uident[IDLEN + 1], buf[256];
    mcUserInfo *mcuInfo;
    time_t currTime;

    move(4, 4);
    prints("如果您遭遇抢劫或偷窃,如果您有任何线索,请向警方报告。");
    move(5, 4);
    prints("\033[1;32m警民合作,共创安定大好局面!\033[0m");
    if (!getOkUser("举报谁?", uident, 7, 4))
        return 0;
    move(8, 4);
    sethomefile(buf, uident, "mc.save");
    if (!file_exist(buf))
        initData(1, buf);
    if((mcuInfo = loadData(buf, sizeof (mcUserInfo))) == (void*)-1)
        return 0;
    if (seek_in_file(DIR_MC "policemen", uident)) {
        showAt(8, 4, "大胆!想诬陷警务人员吗?!", YEA);
        goto UNMAP;
    }
    if (mcuInfo->freeTime > 0) {
        showAt(8, 4, "这个人已经被警署监禁了。", YEA);
        goto UNMAP;
    }
    currTime = time(NULL);
    if ((mcuInfo->robExp == 0) || (mcuInfo->begExp == 0)
            || (mcuInfo->lastActiveTime + 7200 < currTime) || !(mcuInfo->BeIn)) {
        showAt(8, 4, "这个人最近很安分啊!你不要诽谤别人哦!", YEA);
        goto UNMAP;
    }
    if (seek_in_file(DIR_MC "criminals_list", uident)) {
        showAt(8, 4, "此人已经被警署通缉了,警署仍然向你表示感谢。",
               YEA);
        goto UNMAP;
    }
    getdata(8, 4, "简述案情[\033[1;33mENTER\033[0m放弃]:",
            genbuf, 40, DOECHO, YEA);
    if (genbuf[0] == '\0')
        goto UNMAP;
    move(9, 4);
    if (askyn("\033[1;33m你向警方提供的上述信息真实吗\033[0m", NA, NA) ==
            NA)
        goto UNMAP;
    snprintf(buf, STRLEN - 1, "%s %s", uident, genbuf);
    addtofile(DIR_MC "criminals_list", buf);
    showAt(10, 4, "警方非常感谢您提供的线索,我们将尽力尽快破案。", YEA);
    return 1;

UNMAP:
    unloadData(mcuInfo, 1);
    return 0;
}
Exemplo n.º 2
0
static int
cop_police()
{
    int ch, quit = 0;

    while (!quit) {
        nomoney_show_stat("刑警队");

        if (!seek_in_file(DIR_MC "policemen", currentuser->userid)) {
            showAt(12, 4,
                   "警察执行任务,闲杂人等请回避,以免误伤。", YEA);
            return 0;
        }
        move(t_lines - 1, 0);
        prints
        ("\033[1;44m 选单 \033[1;46m [1]逮捕 [2]征税 [3]移花接木 [Q]离开\033[m");
        ch = igetkey();
        switch (ch) {
        case '1':
            cop_Arrest();
            break;
        case '2':
            cop_tax();
            break;
        case '3':
            break;
        case 'q':
        case 'Q':
            quit = 1;
            break;
        }
    }
    return 0;
}
Exemplo n.º 3
0
static int canread(int level, char *path, char * fname, char *title)
{
	char buf[PATHLEN+20];

	if(strlen(path)+strlen(fname) > PATHLEN)
		return 0;

	sprintf(buf,"%s/%s",path,fname);

#ifdef FB2KPC
	if(!strncmp(path,FB2KPC,strlen(FB2KPC))){
		if(fb2kpc_is_owner(buf))
			return 1;
		if(strstr(title,"<secret>"))
			return 0;
	}else{
#endif
	if(level & PERM_BOARDS) return 1;
#ifdef FB2KPC
	}
#endif

	if(dashd(buf)){
		strcat(buf,"/.allow");
		if(!dashf(buf)) return 1;
		if(!seek_in_file(buf,getCurrentUser()->userid)) return 0;
		return 1;
	}
	return 1;
}
Exemplo n.º 4
0
static int
cop_arrange(int type)
{
    int found;
    char uident[IDLEN + 1], buf[STRLEN], title[STRLEN];
    char *actionDesc[] = { "-", "任命", "解职", NULL };
    mcUserInfo *mcuInfo;

    if (!getOkUser("请输入ID: ", uident, 12, 4))
        return 0;
    found = seek_in_file(DIR_MC "policemen", uident);
    move(13, 4);
    if (type == 1 && found) {
        showAt(13, 4, "该ID已经是警员了。", YEA);
        return 0;
    } else if (type == 2 && !found) {
        showAt(13, 4, "该ID不是警署警员。", YEA);
        return 0;
    }
    if (type == 1 && (clubtest(ROBUNION) || clubtest(BEGGAR))) {
        showAt(13, 4, "此人社会关系不明,不宜雇用为警员。", YEA);
        return 0;
    }

    sprintf(buf, "%s确定%s吗?",
            type == 2 ? "被解雇警员会损失一半胆识跟身法," : "",
            actionDesc[type]);
    if (askyn(buf, NA, NA) == NA)
        return 0;
    if (type == 1)
        addtofile(DIR_MC "policemen", uident);
    else {
        sethomefile(buf, uident, "mc.save");
        if (!file_exist(buf))
            initData(1, buf);
        if((mcuInfo = loadData(buf, sizeof (mcUserInfo))) == (void*)-1)
            return 0;
        mcuInfo->robExp /= 2;
        mcuInfo->begExp /= 2;
        mcuInfo->luck = -100;
        del_from_file(DIR_MC "policemen", uident);
        unloadData(mcuInfo, sizeof (mcUserInfo));
    }
    sprintf(title, "【警署】%s警员 %s", actionDesc[type], uident);
    sprintf(buf, "警署署长%s %s警员 %s", currentuser->userid,
            actionDesc[type], uident);
    deliverreport(title, buf);
    system_mail_buf(buf, strlen(buf), uident, title, currentuser->userid);
    showAt(14, 4, "操作成功。", YEA);
    return 1;
}
Exemplo n.º 5
0
static void
cop_Arrest(void)
{
    char uident[IDLEN + 1], police[IDLEN + 1], buf[256], title[STRLEN];
    char *CrimeName[] =
    {   "莫须有", "有伤风化", "小偷小摸", "破坏治安", "卖淫嫖娼",
        "杀人放火", "颠覆政府", "反社会反人类", "种族灭绝", NULL
    };
    int CrimeTime[] = { 1, 2, 3, 4, 6, 8, 12, 16, 24 };
    time_t currtime;
    mcUserInfo *mcuInfo;
    int num, tranum, crime = 0, bonus = 100;

    nomoney_show_stat("刑警队");
    if (!seek_in_file(DIR_MC "policemen", currentuser->userid)) {
        showAt(12, 4, "警察执行任务,闲杂人等请回避,以免误伤。", YEA);
        return;
    }
    if (clubtest(ROBUNION) || clubtest(BEGGAR)) {
        showAt(12, 4, "《无间道》看多了吧你?", YEA);
        return;
    }

    if (myInfo->robExp < 50 || myInfo->begExp < 50) {
        showAt(12, 4,
               "新警察吧?先去练练基本功,不然就是送死了。党和国家培养你不容易啊!",
               YEA);
        return;
    }
    if (check_health(100, 12, 4, "你没有充沛的体力来执行任务。", YEA))
        return;

    currtime = time(NULL);
    if (myInfo->WorkPoint < 7200) {
        showAt(12, 4, "不要着急,上级还没有行动指示。", YEA);
        return;
    }

    move(5, 4);
    prints("刚刚接到上级指示,马上要进行一次抓捕行动。");

    if (!getOkUser("\n请选择你的目标:", uident, 6, 4)) {
        move(8, 4);
        prints("查无此人");
        pressanykey();
        return;
    }
    if (!strcmp(uident, currentuser->userid)) {
        showAt(8, 4, "牛魔王:“老婆~快来看神经病啦~”", YEA);
        return;
    }
    if (!seek_in_file(DIR_MC "criminals_list", uident)) {
        showAt(8, 4, "此人不在通缉名单上面。”", YEA);
        return;
    }
    myInfo->Actived += 10;
    move(10, 4);
    prints("你埋伏在大富翁世界的必经之路,等待目标的出现。");
    sleep(1);

    sethomefile(buf, uident, "mc.save");
    if (!file_exist(buf))
        initData(1, buf);
    if((mcuInfo = loadData(buf, sizeof (mcUserInfo))) == (void*)-1)
        return;

    myInfo->lastActiveTime = currtime;
    myInfo->WorkPoint -= 7200;
    sleep(1);
    if (currtime > 3600 + mcuInfo->lastActiveTime) {
        myInfo->health -= 10;
        showAt(12, 4, "你等了整整一天,目标还是没有出现,只好放弃了。",
               YEA);
        return;
    }

    /*	if (!(random() % 3)) {
    		myInfo->health -= 10;
    		showAt(12, 4, "你眼看老远处人影一晃,目标得到风声跑掉了。",
    		       YEA);
    		return;
    	}

    	if ((myInfo->robExp + myInfo->begExp >=
    	     (mcuInfo->robExp + mcuInfo->begExp)
    	     * 5 + 50 || myInfo->luck - mcuInfo->luck >= 100 || (random() % 3))
    	    && !(mcuInfo->robExp + mcuInfo->begExp >= (myInfo->
    						       robExp +
    						       myInfo->begExp) * 5 +
    		 50)) {
    */
    num =
        myInfo->robExp + myInfo->begExp + (mcuInfo->robExp +
                                           mcuInfo->begExp) * 2;
    if (num > 150000)
        crime = 8;
    else if (num > 100000)
        crime = 7;
    else if (num > 50000)
        crime = 6;
    else if (num > 10000)
        crime = 5;
    else if (num > 5000)
        crime = 4;
    else if (num > 2000)
        crime = 3;
    else if (num > 1000)
        crime = 2;
    else if (num > 500)
        crime = 1;
    else
        crime = 0;
    tranum =
        MIN((myInfo->robExp + myInfo->begExp + mcuInfo->robExp +
             mcuInfo->begExp) / 250,
            (mcuInfo->robExp + mcuInfo->begExp) / 50);
    whoTakeCharge(8, police);
    if (!(strcmp(currentuser->userid, police)))
        bonus = 300;
    if (check_chance
            (myInfo->robExp + myInfo->begExp, mcuInfo->robExp + mcuInfo->begExp,
             myInfo->weapon, mcuInfo->armor, 200, bonus)) {
        myInfo->begExp += tranum + 10;
        myInfo->robExp += tranum + 10;
        myInfo->health = 0;
        myInfo->cash += mcuInfo->cash;
        mcuInfo->cash = 0;
        mcuInfo->begExp = MAX(0, mcuInfo->begExp - tranum - 10);
        mcuInfo->robExp = MAX(0, mcuInfo->robExp - tranum - 10);
        mcuInfo->luck = MAX(-100, mcuInfo->luck - 10);
//              mcuInfo->freeTime += (currtime + 10800);
        mcuInfo->freeTime = time(NULL) + CrimeTime[crime] * 3600;

        myInfo->luck = MIN(100, myInfo->luck + 10);
        del_from_file(DIR_MC "criminals_list", uident);
        prints("\n    远处有人走了过来,你定睛一看,正是你要抓的%s。"
               "\n    你跳出来拔出手枪大吼道:“不许动!你被捕了!”"
               "\n    %s目瞪口呆,只好束手就擒。"
               "\n    你的胆识增加了!	你的身法增加了!"
               "\n    你的体力耗尽了!"
               "\n    你的人品增加了!"
               "\n    没收罪犯所有现金做为补助!", uident, uident);
        sprintf(title, "【警署】警方抓获通缉犯%s", uident);
        sprintf(buf,
                "警员%s耐心守候,孤身勇擒在榜通缉犯%s,特此公告,以示表彰。\n\n"
                "经%s法庭判决,被告%s%s罪名成立,判处%d小时有期徒刑。",
                currentuser->userid, uident, CENTER_NAME, uident,
                CrimeName[crime], CrimeTime[crime]);
        deliverreport(title, buf);
        sprintf(buf,
                "你被警员%s设伏抓获,没收所有现金,胆识身法下降。\n"
                "还被法庭判决%s罪,关押%d小时。\n"
                "不报此仇,誓不为人!",
                currentuser->userid, CrimeName[crime],
                CrimeTime[crime]);
        if (mcuInfo->GetLetter == 1)
            system_mail_buf(buf, strlen(buf), uident,
                            "你被警方抓获", currentuser->userid);
        unloadData(mcuInfo, sizeof (mcUserInfo));
    } else {
        myInfo->begExp = MAX(0, myInfo->begExp - tranum / 2);
        myInfo->robExp = MAX(0, myInfo->robExp - tranum / 2);
        myInfo->health = 0;
        mcuInfo->cash += myInfo->cash;
        myInfo->cash = 0;
        mcuInfo->robExp += tranum / 2;
        mcuInfo->begExp += tranum / 2;
        myInfo->freeTime = time(NULL) + CrimeTime[crime] * 1800 + 1800;
        prints("\n    远处有人走了过来,你定睛一看,正是你要抓的%s。"
               "\n    你跳出来拔出手枪大吼道:“不许动!你被捕了!”"
               "\n    正得意时,不料背后有人打了你一个闷棍。"
               "\n    你的胆识减少了!"
               "\n    你的身法减少了!" "\n    你昏了过去!", uident);
        sprintf(title, "【警署】警员%s受伤住院", currentuser->userid);
        sprintf(buf,
                "警员%s在执行任务的时候,被罪犯打伤住院。目前情况稳"
                "定,%d小时以后即可出院。", currentuser->userid,
                (CrimeTime[crime] + 1) / 2);
        deliverreport(title, buf);
        sprintf(buf,
                "条子%s设伏抓你,还好你艺高人胆大将其干掉,自己安然"
                "无恙。\n 顺手捞走了他身上的现金,胆识身法上升,太爽了!",
                currentuser->userid);
        if (mcuInfo->GetLetter == 1)
            system_mail_buf(buf, strlen(buf), uident, "你金蝉脱壳",
                            currentuser->userid);
        unloadData(mcuInfo, sizeof (mcUserInfo));
        unloadData(myInfo, sizeof (mcUserInfo));
        unloadData(mcEnv, sizeof (MC_Env));
        pressreturn();
        Q_Goodbye();
    }

    pressreturn();
//      Q_Goodbye();
    return;

}
Exemplo n.º 6
0
int bbsvote_act(char * info)
{
	FILE *fp;
	struct votebal currvote, ent;
	char buf[STRLEN], buf1[512];
	char buf2[1024];
	struct ballot uservote;
	//	struct votelog log;
	int aborted = NA, pos;
	int i, chkd;
	unsigned int j, multiroll = 0;
	char board[80];
	char posturl[256];
	char controlfile[STRLEN];
	char *date, *tmp1, *tmp2;
	char flagname[STRLEN];
	char logname[STRLEN];
	int voted_flag;		//用户是否投过该项票
	int num_voted;		//这个是有多少人投过票
	int num_of_vote;	//这个是开启的投票数
	int votenum;		//这个是用户选择进行第几个投票
	int votevalue = 0;
	int procvote;
	time_t closedate;
	struct stat st;
	int now_t=time(0);
	if (!loginok) 
	{
		strcpy(info, "匆匆过客不能投票。");
		return -1;
	}
	strsncpy(board, getparm("B"), 32);
	if (!*board)
	{
		strsncpy(board, getparm("board"), 32);
	}
	votenum = atoi(getparm("votenum"));
	procvote = atoi(getparm("procvote"));
	modify_mode(u_info, VOTING);
	if(!has_post_perm(&currentuser, board) || !HAS_PERM(PERM_VOTE))//去死吧倒霉的全站投票
	{
		strcpy(info, "您无权在本板内投票。");
		return -1;
	}
	sprintf(controlfile, "vote/%s/%s", board, "control");
	num_of_vote = (stat(controlfile, &st) == -1) ? 0 : st.st_size / sizeof (struct votebal);
	if (!num_of_vote)
	{
		strcpy(info, "抱歉, 目前并没有任何投票举行。");
		return -2;
	}
	fp = fopen(controlfile, "r");
	if (!fp)//大概不会发生
	{
		strcpy(info, "系统错误。");
		return -256;
	}
	//从if中提出来的
	if (!votenum) //这是投票列表
	{
		printf ("<card title=\"投票箱 -- %s\">", BBSNAME);
		printf ("<p><anchor><go href=\"bbsdoc.wml?board=%s\" />%s板</anchor>投票</p>", board, board);
		for (i = 1; i <= num_of_vote; i++) 
		{
			fread(&ent, sizeof (struct votebal), 1, fp);
			sprintf(flagname, "vote/%s/flag.%d", board, (int) ent.opendate);
			num_voted = (stat(flagname, &st) ==	-1) ? 0 : st.st_size / sizeof (struct ballot);
			closedate = ent.opendate + ent.maxdays * 86400;
			//注意,这里的date成了结束时间
			w_hsprintf(buf2, "%s", ent.title);//输出标题
			printf("<p><anchor><go href=\"bbsvote.wml?board=%s&amp;votenum=%d\" />#%d %s<br />", board, i, i, buf2);
			//发起投票者被华丽地无视了!
			datestr(buf2, closedate);
			//类别也被华丽地无视了!
			printf ("结束:%s 参与:%d</anchor></p>", buf2, num_voted);
		}
		fclose(fp);
		return 0;
	}
	else 
	{
		if (votenum > num_of_vote)
		{
			strcpy(info, "参数错误。");
			return -3;
		}
		fseek(fp, sizeof (struct votebal) * (votenum - 1), 0);
		fread(&currvote, sizeof (struct votebal), 1, fp);
		fclose(fp);
		sprintf(flagname, "vote/%s/flag.%d", board, (int) currvote.opendate);
		num_voted = (stat(flagname, &st) == -1) ? 0 : st.st_size / sizeof (struct ballot);
		pos = 0;
		fp = fopen(flagname, "r");
		voted_flag = NA;
		if (fp) 
		{
			for (i = 1; i <= num_voted; i++) 
			{
				fread(&uservote, sizeof (struct ballot), 1, fp);
				if (!strcasecmp(uservote.uid, currentuser.userid)) 
				{
					voted_flag = YEA;
					pos = i;
					break;
				}
			}
			fclose(fp);
		}
		if (!voted_flag)
		{
			memset(&uservote, 0, sizeof (uservote));
		}
		if (procvote == 0) 
			//-------投票权限判断
			//没仔细看-_-b
		{
			if (currentuser.firstlogin > currvote.opendate)	
			{
				strcpy(info, "对不起, 本投票在您帐号申请之前开启,您不能投票。");
				return -3;
			}
			else if (!HAS_PERM(currvote.level & ~(LISTMASK | VOTEMASK)))
			{
				strcpy(info, "对不起,您目前尚无权在本票箱投票。");
				return -4;
			}
			else if(currvote.level & LISTMASK )
			{
				char listfilename[STRLEN];
				setvfile(listfilename, board, "vote.list");
				if(!dashf(listfilename)) 
				{
					strcpy(info, "对不起,本票箱需要设定好投票名册方可进行投票。");
					return -5;
				}
				else if(!seek_in_file(listfilename,currentuser.userid))
				{
					strcpy(info, "对不起, 投票名册上找不到您的大名。");
					return -6;
				}
			}
			else if(currvote.level & VOTEMASK )
			{
				if(currentuser.numlogins < currvote.x_logins || currentuser.numposts < currvote.x_posts ||currentuser.stay < currvote.x_stay * 3600
					|| currentuser.firstlogin > currvote.opendate - currvote.x_live * 86400)
				{
					strcpy(info, "对不起,您目前尚不够资格在本票箱投票。");
					return -7;
				}
			}
			closedate =	currvote.opendate + currvote.maxdays * 86400;
			printf ("<card title=\"投票箱 -- %s\">", BBSNAME);
			w_hsprintf (buf2, "%s", currvote.title);
			printf("<p>投票主题: %s<br />", buf2);
			printf("投票类型: %s<br />", vote_type[currvote.type - 1]);
			printf("发起投票: <anchor><go href=\"bbsqry.wml?userid=%s\" />%s</anchor><br />", currvote.userid, currvote.userid);
			printf("所在板面: <anchor><go href=\"bbsdoc.wml?board=%s\" />%s</anchor><br />", board, board);
			datetime(buf2, closedate);
			printf("结束时间: %s<br />", buf2);
			if (currvote.type != VOTE_ASKING)
			{
				printf("最多投票: %d<br />", currvote.maxtkt);
				printf("投票说明:<br />");
				sprintf(buf, "vote/%s/desc.%d", board, (int) currvote.opendate);
				fp = fopen(buf, "r");
				if (fp)
				{
					while (1) 
					{
						if (fgets(buf1, sizeof (buf1), fp) == 0)
						{
							break;
						}
						w_hprintf("%s", buf1);
						printf ("<br />");
					}
					fclose(fp);
				}
			}
			printf ("</p>");
			//multiroll这种东西没用啦
			sprintf (posturl, "bbsvote.wml?board=%s&amp;votenum=%d", board, votenum);
			switch (currvote.type) 
			{
				case VOTE_SINGLE:
					//单选
					j =	uservote.voted + (uservote.voted << currvote.totalitems);
					chkd = 0;
					//这是当前选中的
					printf ("<p>选项列表:<br />");
					for (i = 0; i < currvote.totalitems; i++) 
					{
						w_hprintf ("选项%d %s", i + 1, currvote.items[i]);
						printf ("<br />");
						if (j & 1)
						{
							chkd = i + 1;
						}
						j >>= 1;
					}
					printf ("请选择:<select name=\"inp_vote\" value=\"%d\">", chkd);
					printf ("<option value=\"0\">未选择</option>");
					for (i = 0; i < currvote.totalitems; i++)
					{
						printf ("<option value=\"%d\">%d</option>", i + 1, i + 1);
					}
					printf ("</select></p>");
					votesug_inp(&uservote);
					printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"2\" />", posturl);
					wmlPostfield("vote");
					votesug_pst();
					printf ("</go>投票</anchor></p>");
					break;
				case VOTE_MULTI:
					//复选
					j = uservote.voted + (uservote.voted << currvote.totalitems);
					printf ("<p>选项列表<em>(最多投%d票)</em>:<br />", currvote.maxtkt);
					for (i = 0; i < currvote.totalitems; i++) 
					{
						printf ("<select name=\"inp_votemulti%d\" value=\"%d\"><option value=\"0\">不选择</option><option value=\"1\">已选择</option></select> ", i + 1, (j & 1));
						w_hprintf ("%s", currvote.items[i]);
						printf ("<br />");
						j >>= 1;
					}
					printf ("</p>");
					votesug_inp(&uservote);
					printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"3\" />", posturl);
					for (i = 0; i < currvote.totalitems; i++)
					{
						sprintf (buf2, "votemulti%d", i + 1);
						wmlPostfield(buf2);
					}
					votesug_pst();
					printf ("</go>投票</anchor></p>");
					break;
				case VOTE_YN:
					//是非 ... 不是跟单选一样的么?
					j =	uservote.voted + (uservote.voted << currvote.totalitems);
					chkd = 0;
					//这是当前选中的
					printf ("<p>选项列表:<br />");
					for (i = 0; i < currvote.totalitems; i++) 
					{
						if (j & 1)
						{
							chkd = i + 1;
							break;
						}
						j >>= 1;
					}
					printf ("请选择:<select name=\"inp_vote\" value=\"%d\">", chkd);
					printf ("<option value=\"0\">未选择</option>");
					for (i = 0; i < currvote.totalitems; i++)
					{
						printf ("<option value=\"%d\">", i + 1);
						w_hprintf ("%s", currvote.items[i]);
						printf ("</option>");
					}
					printf ("</select></p>");
					votesug_inp(&uservote);
					printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"1\" />", posturl);
					//这里不同,单选procvote=2
					wmlPostfield("vote");
					votesug_pst();
					printf ("</go>投票</anchor></p>");
					break;
				case VOTE_VALUE:
					//数值
					printf ("<p>请输入一个值:");
					printf ("<input name=\"inp_votevalue\" value=\"%d\" /></p>", uservote.voted);
					votesug_inp(&uservote);
					printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"4\" />", posturl);
					wmlPostfield("votevalue");
					votesug_pst();
					printf ("</go>投票</anchor></p>");
					break;
				case VOTE_ASKING:
					votesug_inp(&uservote);
					printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"5\" />", posturl);
					votesug_pst();
					printf ("</go>投票</anchor></p>");
					break;
				default:
					printf ("<p>没有这种类型的投票啊。</p>");
					return 0;
					//:(
				//<-switch
			}
		}
		else
		{
			if (procvote != currvote.type)
			{
				strcpy(info, "投票错误。");
				return -1;
			}
			switch (procvote) 
			{
				case 2:	//VOTE_SINGLE
					votevalue = 1;
					votevalue <<= atoi(getparm("vote")) - 1;
					if (atoi(getparm("vote")) > currvote.totalitems + 1)
					{
						strcpy(info, "无效选项。");
						return -1;
					}
					aborted = (votevalue == uservote.voted);
					break;
				case 3:	//VOTE_MULTI
					votevalue = 0;
					j = 0;
					for (i = currvote.totalitems - 1; i >= 0; i--) 
					{
						votevalue <<= 1;
						sprintf(buf, "votemulti%d", i + 1);
						votevalue |= !!atoi(getparm(buf));
						j += !!atoi(getparm(buf));
					}
					aborted = (votevalue == uservote.voted);
					if (j > currvote.maxtkt) 
					{
						sprintf(info, "本投票最多只能选择%d个选项。", currvote.maxtkt);
						return -1;
					}
					break;
				case 1:	//VOTE_YN
					votevalue = 1;
					j = atoi(getparm("vote")) - 1;
					if (j >	currvote.totalitems || j < 0)
					{
						strcpy(info, "无效选项。");
						return -1;
					}
					votevalue <<= j;
					aborted = (votevalue == uservote.voted);
					break;
				case 4:	//VOTE_VALUE
					aborted = ((votevalue = atoi(getparm("votevalue"))) == uservote.voted);
					if (votevalue < 0 || votevalue > currvote.maxtkt) 
					{
						sprintf(info, "应当介于0到%d之间(含)。", currvote.maxtkt);
						return -1;
					}
					break;
				case 5: //VOTE_ASKING
					aborted = NA;
					break;
				//<-switch
			}
			printf ("<card title=\"投票箱 -- %s\">", BBSNAME);
			if (aborted == YEA) 
			{
				printf ("<p>未修改该投票的选项。</p>");
				return 0;
			}
			else
			{
				fp = fopen(flagname, "r+");
				if (fp == 0)
				{
					fp = fopen(flagname, "w+");
				}
				if (fp)
				{
					flock(fileno(fp), LOCK_EX);
					if (pos > 0)
					{
						fseek(fp, (pos - 1) * sizeof (struct ballot), SEEK_SET);
					}
					else
					{
						fseek(fp, 0, SEEK_END);
					}
					strcpy(uservote.uid, currentuser.userid);
					uservote.voted = votevalue;
					for (i = 0; i < 3; i++)
					{
						sprintf (buf2, "sug%d", i);
						strncpy (uservote.msg[i], getparm(buf2), 78);
						removeInvisibleChars(uservote.msg[i], ' ');
					}
					fwrite(&uservote, sizeof (struct ballot), 1, fp);
					flock(fileno(fp), LOCK_UN);
					fclose(fp);
					printf("<p>已经帮您投入票箱中。</p>");
					sprintf(buf, "%s %s %s", currentuser.userid, currentuser.lasthost, Ctime(now_t));
					fs_append(BBSHOME"/vote.log", buf);
				}
				else
				{
					printf ("<p>系统发生了一点小小的问题-_-b</p>");
				}
			}
		}
	}