Exemple #1
0
int
bbsinfo_main()
{	//modify by mintbaggio 20040829 for new www
	int type;
	html_header(1);
	check_msg();
	printf("<body>");
	if (!loginok || isguest)
		http_fatal("您尚未登录");
	changemode(EDITUFILE);
	type = atoi(getparm("type"));
	printf("<div class=rhead>%s -- 用户个人资料</div><hr>\n", BBSNAME);
	if (type != 0) {
		check_info();
		http_quit();
	}
	printf("<form action=bbsinfo?type=1 method=post>");
	printf("您的帐号: %s<br>\n", currentuser.userid);
	printf
	    ("您的昵称: <input type=text name=nick value='%s' size=24 maxlength=30><br>\n",
	     currentuser.username);
	printf("发表大作: %d 篇<br>\n", currentuser.numposts);
//      printf("信件数量: %d 封<br>\n", currentuser.nummails);
	printf("上站次数: %d 次<br>\n", currentuser.numlogins);
	printf("上站时间: %ld 分钟<br>\n", currentuser.stay / 60);
	printf
	    ("真实姓名: <input type=text name=realname value='%s' size=16 maxlength=16><br>\n",
	     currentuser.realname);
	printf
	    ("居住地址: <input type=text name=address value='%s' size=40 maxlength=40><br>\n",
	     currentuser.address);
	printf("帐号建立: %s<br>", Ctime(currentuser.firstlogin));
	printf("最近光临: %s<br>", Ctime(currentuser.lastlogin));
	printf("来源地址: %s<br>", currentuser.lasthost);
#ifndef POP_CHECK	
	printf
	    ("电子邮件: <input type=text name=email value='%s' size=32 maxlength=32><br>\n",
	     currentuser.email);
#endif

#if 0
	printf
	    ("出生日期: <input type=text name=year value=%d size=4 maxlength=4>年",
	     currentuser.birthyear + 1900);
	printf("<input type=text name=month value=%d size=2 maxlength=2>月",
	       currentuser.birthmonth);
	printf("<input type=text name=day value=%d size=2 maxlength=2>日<br>\n",
	       currentuser.birthday);
	printf("用户性别: ");
	printf("男<input type=radio value=M name=gender %s>",
	       currentuser.gender == 'M' ? "checked" : "");
	printf("女<input type=radio value=F name=gender %s><br>",
	       currentuser.gender == 'F' ? "checked" : "");
#endif
	printf
	    ("<input type=submit value=确定> <input type=reset value=复原>\n");
	printf("</form>");
	printf("<hr>");
	printf("</body></html>");
	return 0;
}
Exemple #2
0
static int string_charsize(unsigned char *p, unsigned char *end, int mode)
{
	int newmode = mode;

	if(mode == JCSTRING_CHAR_DEFAULT)
	{
		newmode = changemode(p, end, mode);

		if(newmode != mode)
		{
			return 0;
		}
		else if((*p >= 0x00 && *p <= 0x1F) || (*p == 0x7F))
		{
			return 1;
		}
	}
	else if((mode == JCSTRING_CHAR_ASCII) || (mode == JCSTRING_CHAR_ROMAN))
	{
		newmode = changemode(p, end, mode);

		if(newmode != mode)
		{
			return 0;
		}
		else if(*p >= 0x20 && *p <= 0x7E)
		{
			return 1;
		}
		else
		{
			return 1;
		}
	}
	else if(mode == JCSTRING_CHAR_KANA)
	{
		newmode = changemode(p, end, mode);

		if(newmode != mode)
		{
			return 0;
		}
		else if(*p >= 0x21 && *p <= 0x5F)
		{
			return 1;
		}
	}
	else if((mode == JCSTRING_CHAR_KANJIOLD) || (mode == JCSTRING_CHAR_KANJINEW))
	{
		newmode = changemode(p, end, mode);

		if(newmode != mode)
		{
			return 0;
		}
		else if( ((end == NULL) || ((end != NULL) && ((p+1) <= end))) && ((*p >= 0x21 && *p <= 0x7E) && (*(p+1) >= 0x21 && *(p+1) <= 0x7E) ) )
		{
			return 2;
		}
	}

	return 0;
}
Exemple #3
0
int
bbssendmsg_main()
{
	int pos, mode, destpid = 0;
	int usernum, direct_reply;
	char destid[20], msg[MAX_MSG_SIZE];
	struct userec *u;
	struct user_info *ui;
	int offline = 0;
	
	html_header(1);
	changemode(MSG);
	if (!loginok || isguest)
		http_fatal("匆匆过客不能发短消息, 请先登录!");
	strsncpy(destid, getparm("destid"), 13);
	strsncpy(msg, getparm("msg"), MAX_MSG_SIZE);
	direct_reply = atoi(getparm("dr"));
	destpid = atoi(getparm("destpid"));
	if (destid[0] == 0 || msg[0] == 0) {
		char buf3[256];
		strcpy(buf3, "<body onload='document.form0.msg.focus()'>");
		if (destid[0] == 0)
			strcpy(buf3,
			       "<body onload='document.form0.destid.focus()'>");
		printf("%s\n", buf3);
		printf("<form name=form0 action=bbssendmsg method=post>"
		       "<input type=hidden name=destpid value=%d>"
		       "送短消息给: <input name=destid maxlength=12 value='%s' size=12><br>"
		       "短消息内容:\n<br>", destpid, destid);
		printf("<table><tr><td><textarea name=msg rows=7 cols=76>"
		       "%s" "</textarea></td><td>", nohtml(void1(msg)));
		print_emote_table("form0", "msg");
		printf("</td></tr></table><br>"
		       "<input type=submit value=确认 width=6></form>");
		http_quit();
	}
	if (checkmsgbuf(msg))
		http_fatal("消息太长了?最多11行(每行最多80个字符)哦");
	usernum = getuser(destid, &u);
	if (usernum <= 0)
		http_fatal("错误的帐号");
	strcpy(destid, u->userid);
	if (!strcasecmp(destid, currentuser->userid))
		http_fatal("你不能给自己发短消息!");
	if (!strcasecmp(destid, "guest") || !strcmp(destid, "SYSOP"))
		http_fatal("无法发短消息给这个人 1");
	if (!((u->userdefine & DEF_ALLMSG)
	      || ((u->userdefine & DEF_FRIENDMSG)
		  && inoverride(currentuser->userid, destid, "friends"))))
		http_fatal("无法发短消息给这个人 2");
	if (!strcmp(destid, "SYSOP"))
		http_fatal("无法发短消息给这个人 3");
	if (inoverride(currentuser->userid, destid, "rejects"))
		http_fatal("无法发短消息给这个人 4");
	if (get_unreadcount(destid) > MAXMESSAGE)
		http_fatal
		    ("对方尚有一些短消息未处理,请稍候再发或给他(她)写信...");
	printf("<body>\n");
	ui = queryUIndex(usernum, NULL, destpid, &pos);
	if (ui == NULL)
		ui = queryUIndex(usernum, NULL, 0, &pos);
	if (ui != NULL) {
		destpid = ui->pid;
		mode = ui->mode;
		if (mode == BBSNET || mode == PAGE || mode == LOCKSCREEN)
			offline = 1;
		if (send_msg(currentuser->userid, pos - 1, destid, destpid, msg, offline) == 1) {
			char buf[64];
	                sprintf(buf, "4 %s %s", currentuser->userid, destid);
	                friendslog(buf);
			printf("已经帮你送出%s消息, %d", offline ? "离线" : "", pos);
		} else
			printf("发送消息失败");
		printf("<script>top.fmsg.location='bbsgetmsg'</script>\n");
		if (!direct_reply) {
			printf
			    ("<br><form name=form1><input name=b1 type=button onclick='history.go(-2)' value='[返回]'>");
			printf("</form>");
		}
		http_quit();
	}
	if (send_msg(currentuser->userid, 0,destid, destpid, msg, 1) == 1)
		printf("已经帮你送出离线消息");
	else
		printf("发送消息失败");
	printf("<script>top.fmsg.location='bbsgetmsg'</script>\n");
	if (!direct_reply) {
		printf
		    ("<br><form name=form1><input name=b1 type=button onclick='history.go(-2)' value='[返回]'>");
		printf("</form>");
	}
	http_quit();
	return 0;
}