Esempio n. 1
0
int
bbsqry_main()
{
	FILE *fp;
	char userid[14], filename[80], buf[512];
	struct userec *x;
	struct user_info *u;
	int i, tmp2, num;
	html_header(1);
	check_msg();
	changemode(QUERY);
	strsncpy(userid, getparm("U"), 13);
	if (!userid[0])
		strsncpy(userid, getparm("userid"), 13);
	printf("<body><center>");
	printf("<div class=rhead>%s -- ��ѯ����</div><hr>\n", BBSNAME);
	if (userid[0] == 0) {
		printf("<form action=bbsqry>\n");
		printf
		    ("�������û���: <input name=userid maxlength=12 size=12>\n");
		printf("<input type=submit value=��ѯ�û�>\n");
		printf("</form><hr>\n");
		http_quit();
	}
	x = getuser(userid);
	if (x == 0) {
		int i, j = 0;
		printf("û������û������ѵ�����Щ:<p>");
		printf("<table width=600>");
		for (i = 0; i < shm_ucache->number; i++)
			if (strcasestr(shm_ucache->userid[i], userid) ==
			    shm_ucache->userid[i]) {
				j++;
				if (j % 6 == 1)
					printf("<tr>");
				printf("<td>");
				printf("<a href=bbsqry?userid=%s>%s</a>",
				       shm_ucache->userid[i],
				       shm_ucache->userid[i]);
				printf("</td>");
				sprintf(buf, "bbsqry?userid=%s",
					shm_ucache->userid[i]);
				if (j % 6 == 0)
					printf("</tr>");
				if (j >= 12 * 6)
					break;
			}
		printf("</table>");
		if (!j)
			printf("�����ܣ��϶������ô��ˣ�����û���˰�");
		if (j == 1)
			redirect(buf);
		printf("<p><a href=javascript:history.go(-1)>���ٷ���</a>");
		http_quit();
	}
	printf("</center><pre style='font-size:14px'>\n");
	sprintf(buf,
		"%s (%s) ����վ %d �Σ��������� %d ƪ",
		x->userid, x->username, x->numlogins, x->numposts);
	hprintf("%s", buf);
	show_special_web(x->userid);//add by wjbta@bmy  ����id��ʶ
	printf("\n");
	hprintf("�ϴ��� [%s] �� [%s] ����վһ�Ρ�\n",
		Ctime(x->lastlogin), x->lasthost);
	mails(userid, &tmp2);
	hprintf("���䣺[%s]��", tmp2 ? "��" : "  ");
	if (!strcasecmp(x->userid, currentuser.userid)) {
		hprintf("����ֵ��[%d](%s) ", countexp(x),
			cexp(countexp(x)));
		hprintf("����ֵ��[%d](%s) ", countperf(x),
			cperf(countperf(x)));
	}
	hprintf("��������[%d]��\n", count_life_value(x));
	if (x->userlevel & PERM_BOARDS) {
		hprintf("�����");
		sethomefile(filename, x->userid, "mboard");
		new_apply_record(filename, sizeof (struct boardmanager),
				 (void *) bm_printboard, NULL);
		if (x->userlevel & !strcmp(x->userid, "SYSOP")) hprintf("[ϵͳ����Ա]");
		else if (x->userlevel & !strcmp(x->userid, "lanboy")) hprintf("[ϵͳ����Ա]");
		else if ((x->userlevel&PERM_SYSOP) && (x->userlevel&PERM_ARBITRATE) )	hprintf("[��վ������]");
		else if (x->userlevel & PERM_SYSOP)	hprintf("[����վ��]");
		else if (x->userlevel & PERM_OBOARDS)   hprintf("[ʵϰվ��]");
		else if (x->userlevel & PERM_ARBITRATE)	hprintf("[���μ�ί]");
		else if (x->userlevel & PERM_SPECIAL4)	hprintf("[����]");
		else if (x->userlevel & PERM_WELCOME) hprintf("[ϵͳ����]");
		else if (x->userlevel & PERM_SPECIAL7)
		{
		if ( (x->userlevel & PERM_SPECIAL1) && !(x->userlevel & PERM_CLOAK) ) 
		hprintf("[���γ���Ա]");		
		else		
		hprintf("[�������Ա]");
		}
		else if (x->userlevel & PERM_ACCOUNTS) hprintf ("[�ʺŹ���Ա]"); 
		hprintf("\n");
	}
	num = 0;
	for (i = 0; i < MAXACTIVE; i++) {
		u = &(shm_utmp->uinfo[i]);
		if (!strcmp(u->userid, x->userid)) {
			if (u->active == 0 || u->pid == 0
			    || (u->invisible && !HAS_PERM(PERM_SEECLOAK)))
				continue;
			num++;
			if (num == 1)
				hprintf("Ŀǰ��վ��, ״̬����:\n");
			if (u->invisible)
				hprintf("C");
			if (u->mode != USERDF4)
			  hprintf("\033[%dm%s ", u->pid == 1 ? 35 : 32,
				ModeType(u->mode));
			else							/* �Զ���״̬ */
			  hprintf("\033[%dm%s ", u->pid == 1 ? 35 : 32,
				u->user_state_temp);
			if (num % 5 == 0)
				printf("\n");
		}
	}
	if (num == 0) {
		hprintf("Ŀǰ����վ��, �ϴ���վʱ�� [%s]\n\n",
			x->lastlogout ? Ctime(x->lastlogout) :
			"�������ϻ��������߲���");
	}
	printf("\n");
	printf("</pre><table width=100%%><tr><td class=f2>");
	sethomefile(filename, x->userid, "plans");
	fp = fopen(filename, "r");
	sprintf(filename, "00%s-plan", x->userid);
	fdisplay_attach(NULL, NULL, NULL, NULL);
	if (fp) {
		while (1) {
			if (fgets(buf, 256, fp) == 0)
				break;
			if (!strncmp(buf, "begin 644 ", 10)) {
				errlog("old attach %s", filename);
				fdisplay_attach(stdout, fp, buf, filename);
				continue;
			}
			fhhprintf(stdout, "%s", buf);
		}
		fclose(fp);
	} else {
		hprintf("û�и���˵����\n");
	}
	printf("</td></tr></table>");
	printf
	    ("<br><br><a href=bbspstmail?userid=%s&title=û����>[�������]</a> ",
	     x->userid);
	printf("<a href=bbssendmsg?destid=%s>[����ѶϢ]</a> ", x->userid);
	printf("<a href=bbsfadd?userid=%s>[�������]</a> ", x->userid);
	printf("<a href=bbsfdel?userid=%s>[ɾ������]</a>", x->userid);
	printf("<hr>");
	printf("<center><form action=bbsqry>\n");
	printf("�������û���: <input name=userid maxlength=12 size=12>\n");
	printf("<input type=submit value=��ѯ�û�>\n");
	printf("</form><hr>\n");
	printf("</body>\n");
	http_quit();
	return 0;
}
Esempio n. 2
0
int
bbsqry_main()
{
	FILE *fp;
	char userid[14], filename[80], buf[512];
	struct userec *x;
	int tmp2;
	struct in_addr in;
	html_header(1);
	check_msg();
	changemode(QUERY);
	strsncpy(userid, getparm("U"), 13);
	if (!userid[0])
		strsncpy(userid, getparm("userid"), 13);
	printf("<body><center>");
	printf("%s -- 查询网友<hr>\n", BBSNAME);
	if (userid[0] == 0) {
		printf("<form name=qry action=bbsqry>\n");
		printf
		    ("请输入用户名: <input name=userid maxlength=12 size=12>\n");
		printf("<input type=submit value=查询用户>\n");
		printf("</form><hr>\n");
		printf("<script>document.qry.userid.focus();</script>");
		http_quit();
	}
	if (getuser(userid, &x) <= 0) {
		printf("不可能,肯定是你敲错了,根本没这人啊");
		printf("<p><a href=javascript:history.go(-1)>快速返回</a>");
		http_quit();
	}
	printf("</center><pre>\n");
	if (x->mypic) {
		printf("<table align=left><tr><td><center>");
		printmypic(x->userid);
		printf("</center></td></tr></table>");
	}
	printf("<b><font size=+1>%s</font></b> (<font class=gre>%s</font>) "
	       "共上站 <font class=gre>%d</font> 次,"
	       "发表文章 <font class=gre>%d</font> 篇\n",
	       x->userid, x->username, x->numlogins, x->numposts);
//      show_special(x->userid);

	in.s_addr = x->lasthost & 0x0000ffff;
	printf
	    ("上次在 <font color=green>%s</font> 从 <font color=green>%s</font> 到本站一游。<br>",
	     Ctime(x->lastlogin), inet_ntoa(in));
	mails(userid, &tmp2);
	printf("信箱:[<font color=green>%s</font>],", tmp2 ? "⊙" : "  ");
	if (!strcasecmp(x->userid, currentuser->userid)) {
		printf
		    ("经验值:[<font color=green>%d</font>](<font color=olive>%s</font>) ",
		     countexp(x), cuserexp(countexp(x)));
		printf
		    ("表现值:[<font color=green>%d</font>](<font color=olive>%s</font>) ",
		     countperf(x), cperf(countperf(x)));
	}
	if (x->dieday) {
		printf
		    ("<br>已经离开了人世,呜呜...<br>还有 [<b>%d</b>] 天就要转世投胎了<br>",
		     countlife(x));
	} else {
		printf("生命力:[<font color=red>%d</font>]。<br>",
		       countlife(x));
		if (x->userlevel & PERM_BOARDS) {
			int i;
			printf("担任版务:");
			for (i = 0; i < MAXBOARD && i < shm_bcache->number; i++)
				bm_printboard(&shm_bcache->bcache[i],
					      x->userid);
			printf("<br>");
		}
		if (!show_onlinestate(userid)) {
			printf
			    ("目前不在站上, 上次离站时间 [<font color=blue>%s</font>]\n\n",
			     (x->lastlogout >=
			      x->lastlogin) ? Ctime(x->
						    lastlogout) :
			     "因在线上或不正常断线不详");
		}
	}
	printf("\n");
	printf("</pre><table width=100%%><tr><td>");
	sethomefile(filename, x->userid, "plans");
	fp = fopen(filename, "r");
	sprintf(filename, "00%s-plan", x->userid);
	fdisplay_attach(NULL, NULL, NULL, NULL);
	if (fp) {
		while (1) {
			if (fgets(buf, 256, fp) == 0)
				break;
			if (!strncmp(buf, "begin 644 ", 10)) {
				errlog("old attach %s", filename);
				fdisplay_attach(stdout, fp, buf, filename);
				continue;
			}
			fhhprintf(stdout, "%s", buf);
		}
		fclose(fp);
	} else {
		printf("<font color=teal>没有个人说明档</font><br>");
	}

	printf("</td></tr></table>");
	printf
	    ("<br><br><a href=bbspstmail?userid=%s&title=没主题>[书灯絮语]</a> ",
	     x->userid);
	printf("<a href=bbssendmsg?destid=%s>[发送讯息]</a> ", x->userid);
	printf("<a href=bbsfadd?userid=%s>[加入好友]</a> ", x->userid);
	printf("<a href=bbsfdel?userid=%s>[删除好友]</a> ", x->userid);
	if (x->userlevel & PERM_SPECIAL8) {
		printf
		    ("<a href=bbs0an?path=/groups/GROUP_0/Personal_Corpus/%c/%s>[个人文集]</a> ",
		     mytoupper(x->userid[0]), x->userid);
	}
	sethomefile(filename, x->userid, "B/config");
	if (file_isfile(filename)) {
		printf
		    ("<a href=blog?U=%s>[Blog]</a>", x->userid);
	}
	printf("<hr>");
	printf("<center><form name=qry action=bbsqry>\n");
	printf("请输入用户名: <input name=userid maxlength=12 size=12>\n");
	printf("<input type=submit value=查询用户>\n");
	printf("</form><hr>\n");
	printf("</body>\n");
	http_quit();
	return 0;
}
Esempio n. 3
0
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(&currentuser, x))
		printf("[<a href=bbsmnote?board=%s&mode=%d>±à¼­%s</a>]", board, mode, notestr);
	printf("</center>\n");
	http_quit();
	return 0;
}