Esempio n. 1
0
void
savemyclass()
{
	struct brcinfo *brcinfo;
	struct boardmem *bx;
	char *ptr = getparm("myclass");
	bx = getboard2(ptr);
	if (!bx) {
		printf("<b>没有找到 %s 版,请用“搜索”功能搜索版面</b><br>\n",
		       ptr);
		return;
	}
	if (!has_read_perm_x(currentuser, bx)) {
		printf
		    ("<b>%s 版是一个封闭版面,请先向版务申请加入,或者用“搜索”功能另选其他版面</b><br>\n",
		     ptr);
		return;
	}
	brcinfo = brc_readinfo(currentuser->userid);
	strsncpy(brcinfo->myclass, bx->header.filename,
		 sizeof (brcinfo->myclass));
	ptr = strtrim(getparm("myclasstitle"));
	if (!strcmp(ptr, "版面标题"))
		brcinfo->myclasstitle[0] = 0;
	else
		strsncpy(brcinfo->myclasstitle, ptr,
			 sizeof (brcinfo->myclasstitle));
	brc_saveinfo(currentuser->userid, brcinfo);
	printf
	    ("<b>设置成功</b>(以后可以到菜单“个人工具箱”-->“设定底栏显示的版面”进行修改)<br>");
	printf("<script>top.f4.location.reload();</script>");
}
Esempio n. 2
0
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(&currentuser, 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>");
}
Esempio n. 3
0
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(&currentuser);
        printf("[%s] �����޸ijɹ�.", currentuser.userid);
}
Esempio n. 4
0
int bbsfadd_main(void)
{
	if (!loginok)
		return BBS_ELGNREQ;
	const char *id = getparm("id");
	const char *desc = getparm("desc");
	if (*id != '\0') {
		override_t ov;
		memset(&ov, 0, sizeof(ov));
		strlcpy(ov.id, id, sizeof(ov.id));
		if (!searchuser(ov.id))
			return BBS_ENOUSR;
		strlcpy(ov.exp, desc, sizeof(ov.exp));
		char file[HOMELEN];
		sethomefile(file, currentuser.userid, "friends");
		if (get_num_records(file, sizeof(ov)) == MAXFRIENDS)
			return BBS_EFRNDQE;
		// TODO: be atomic
		if (!search_record(file, NULL, sizeof(ov), cmpname, ov.id))
			append_record(file, &ov, sizeof(ov));
		printf("Location: fall\n\n");
		return 0;
	}
	xml_header("bbs");
	printf("<bbsfadd ");
	print_session();
	printf(">%s</bbsfadd>", id);
	return 0;
}
Esempio n. 5
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;
}
Esempio n. 6
0
static void
addSubject(struct Blog *blog)
{
	int i, hide;
	char *title;
	printf("添加栏目...");
	title = getparm("title");
	if (!*title) {
		printf("没写栏目标题啊?<br>");
		return;
	}
	if (*getparm("hide"))
		hide = 1;
	else
		hide = 0;
	for (i = 0; i < blog->nSubject; i++) {
		if (!*blog->subject[i].title)
			break;
	}
	if (blogModifySubject(blog, i, title, hide) >= 0) {
		printf("编号:%d,标题:%s;隐藏:%s<br><br>",
		       i, title, hide ? "是" : "否");
	} else {
		printf("没有添加成功...<br><br>");
	}
}
Esempio n. 7
0
int bbspwd_main(void)
{
	if (!loginok)
		return BBS_ELGNREQ;
	parse_post_data();
	xml_header("bbs");
	printf("<bbspwd ");
	print_session();
	char *pw1 = getparm("pw1");
	if (*pw1 == '\0') {
		printf(" i='i'></bbspwd>");
		return 0;
	}
	printf(">", stdout);
	char *pw2 = getparm("pw2");
	char *pw3 = getparm("pw3");
	switch (set_password(pw1, pw2, pw3)) {
		case BBS_EWPSWD:
			printf("ÃÜÂë´íÎó");
			break;
		case BBS_EINVAL:
			printf("ÐÂÃÜÂ벻ƥÅä »ò ÐÂÃÜÂëÌ«¶Ì");
			break;
		default:
			break;
	}
	printf("</bbspwd>");
	return 0;
}
Esempio n. 8
0
static void
modifySubjects(struct Blog *blog)
{
	int i, hide, count = 0;
	char *title, buf[80];
	printf("修改标题...<br>");
	for (i = 0; i < blog->nSubject; ++i) {
		sprintf(buf, "title%d", i);
		title = getparm(buf);
		sprintf(buf, "hide%d", i);
		if (*getparm(buf))
			hide = 1;
		else
			hide = 0;
		if (!strcmp(title, blog->subject[i].title) &&
		    blog->subject[i].hide == hide)
			continue;
		blogModifySubject(blog, i, title, hide);
		printf("编号: %d,标题:%s,隐藏:%s<br>",
		       i, title, hide ? "是" : "否");
		count++;
	}
	if (!count)
		printf("没有进行任何修改!<br>");
	printf("<br>");
}
Esempio n. 9
0
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;
}
Esempio n. 10
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(&currentuser, board) && !HAS_PERM(PERM_SYSOP))
                http_fatal("错误的讨论区");
        if(!has_BM_perm(&currentuser, 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>\
Esempio n. 11
0
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;
}
Esempio n. 12
0
File: misc.c Progetto: vii1/edivc
/*! \brief Cambia el modo de la pantalla
 * \todo ¿más flags?
 *
 * Esta función permite distintas sintaxis:
 *	- Sintaxis de DIV2:
 *		@param modo Modo de pantalla indicado por una constante tipo mWWWxHHH ó por un identificador de video_modes[]
 *
 *	- Sintaxis de eDIV:
 *		@param anchura Ancho de la nueva resolución
 *		@param altura Alto de la nueva resolución
 *		@param [bpp] Profundidad de color, puede ser 8, 16, 24 ó 32 (por defecto es 8)
 *		@param [flags] Flags de la ventana del juego, puede ser una combinación de:
 *						  _fullscreen (1), ... ya veremos si añadimos más xD
 * .
 *
 * @return 0
 */
int eDIV_SET_MODE(FUNCTION_PARAMS)
{
    int modo;

    switch(fp->num_params) {
    case 4:
        fp->graphics->flags=getparm();
    case 3:
        fp->graphics->bpp=getparm();
        fp->graphics->alto=getparm();
        fp->graphics->ancho=getparm();
        break;
    case 1:
        modo=getparm();
        if(modo>1280960) {
            fp->graphics->ancho=modo/10000;
            fp->graphics->alto=modo%10000;
        }
        else {
            fp->graphics->ancho=modo/1000;
            fp->graphics->alto=modo%1000;
        }
        fp->graphics->bpp=8;
        fp->graphics->flags=0;
    }

    /* Esto avisa a las DLLs */
    fp->graphics->resflags|=GR_CHANGED;

    SDL_FreeSurface(fondo);
    SDL_FreeSurface(screen);

    screen=SDL_SetVideoMode(fp->graphics->ancho,fp->graphics->alto,fp->graphics->bpp,SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_HWACCEL|((fp->graphics->flags&GR_FULLSCREEN)?SDL_FULLSCREEN:0)|((fp->graphics->bpp==8)?SDL_HWPALETTE:0));
    fp->graphics->buffer=screen->pixels;

    if ( screen == NULL ) {
        fp->Critical_Error(7); /* No se pudo inicializar SDL */
        return 0;
    }

    fondo=SDL_CreateRGBSurface(SDL_HWSURFACE,fp->graphics->ancho,fp->graphics->alto,fp->graphics->bpp,0,0,0,0);
    fp->graphics->background=fondo->pixels;

    if(fp->graphics->bpp==8)
        PaletteCopy(fondo,screen);

    regions[0].w=fp->graphics->ancho;
    regions[0].h=fp->graphics->alto;

    return 0;
}
Esempio n. 13
0
int
bbsfoot_main()
{
	int dt = 0, mail_total = 0, mail_unread = 0, lasttime = 0;
	char *id = "guest";
	static int r = 0;
	html_header(2);
	printf("<script>function t(){return (new Date()).valueOf();}</script>");
	printf("<body topmargin=1 MARGINHEIGHT=1 class=foot>\n");
	if (loginok) {
		id = currentuser->userid;
		dt = abs(now_t - w_info->login_start_time) / 60;
	}
	printf("时间[%16.16s] ", Ctime(now_t));
	printf("在线[%d] ", count_online());
	printf("帐号[<a href=\"bbsqry?userid=%s\" target=f3>%s</a>] ", id, id);
	if (loginok && !isguest) {
		int thistime;
		lasttime = atoi(getparm("lt"));
		thistime = mails_time(id);
		if (thistime <= lasttime) {
			mail_total = atoi(getparm("mt"));
			mail_unread = atoi(getparm("mu"));
		} else {
			mail_total = mails(id, &mail_unread);
			lasttime = thistime;
		}
		if (mail_unread == 0) {
			printf("信箱[<a href=bbsmail target=f3>%d封</a>] ",
			       mail_total);
		} else {
			printf
			    ("信箱[<a href=bbsmail target=f3>%d(<font color=red>新信%d</font>)</a>] ",
			     mail_total, mail_unread);
		}
		showmyclass();
	}
#ifdef ENABLE_BLOG
	showmyblog();
#endif

	printf("停留[%d小时%d分] ", dt / 60, dt % 60);
	printf
	    ("<a href=# onclick='javascript:{location=location;return false;}'>刷新</a>");
	printf("<script>setTimeout('self.location.replace("
	       "\"bbsfoot?lt=%d&mt=%d&mu=%d&sn='+t()+'\")', %d);</script>",
	       lasttime, mail_total, mail_unread, 900000 + r * 1000);
	r = (r + dt + now_t) % 30;
	printf("</body>");
	return 0;
}
Esempio n. 14
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
		    ("<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;
}
Esempio n. 15
0
int bbsinfo_main(void)
{
	if (!loginok)
		return BBS_ELGNREQ;
	parse_post_data();
	char *type = getparm("type");
	xml_header("bbs");
	if (*type != '\0') {
		printf("<bbsinfo ");
		print_session();
		printf(">%s</bbsinfo>", check_info());
	} else {
		printf("<bbsinfo post='%d' login='******' stay='%d' "
				"since='%s' host='%s' year='%d' month='%d' "
				"day='%d' gender='%c' ", currentuser.numposts,
				currentuser.numlogins, currentuser.stay / 60,
				getdatestring(currentuser.firstlogin, DATE_XML),
				currentuser.lasthost, currentuser.birthyear,
				currentuser.birthmonth, currentuser.birthday,
				currentuser.gender);
		print_session();
		printf(" last='%s'><nick>",
				getdatestring(currentuser.lastlogin, DATE_XML));
		xml_fputs(currentuser.username, stdout);
		printf("</nick></bbsinfo>");
	}
	return 0;
}
Esempio n. 16
0
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;
}
Esempio n. 17
0
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++;
		}
	}
Esempio n. 18
0
File: cps.c Progetto: timburrow/ovj3
/*-----------------------------------------------------------------
|	putstr()/2
|	Sets a vnmr parmeter to a given string.
+------------------------------------------------------------------*/
void putstr(char *paramname, char *paramstring)
{
   int stat,expnum;
   char	message[STDVAR];
   char addr[MAXSTR];

   expnum = getExpNum();
   stat = -1;
   if (getparm("vnmraddr","string",GLOBAL,addr,MAXSTR))
   {
	sprintf(addr,"putval: cannot get Vnmr address for %s.\n",paramname);
        text_error(addr);
   }
   else
   {
   	sprintf(message,"sysputval(%d,'%s','%s')\n",
					expnum,paramname,paramstring);
   	stat = deliverMessageSuid(addr,message);
	if (stat < 0)
	{
	   sprintf(addr,"putval: Error in parameter: %s.\n",paramname);
           text_error(addr);
	}
   }

}
Esempio n. 19
0
/*-----------------------------------------------------------------
|	vnmremsg()/1
|	Sends error to vnmr error window.
+------------------------------------------------------------------*/
void vnmremsg(const char *paramstring)
{
    int stat;
    char	message[MAXSTR];
    char addr[MAXSTR];

    stat = -1;
    if (getparm("vnmraddr","string",GLOBAL,addr,MAXSTR))
    {
        text_error("vnmremsg: cannot get Vnmr address.\n");
    }
    else if (strcmp(addr,"Autoproc"))
    {
        int i = 0;
        sprintf(message,"write('error',`%s`,'noReformat')\n",paramstring);
        while ( (i<MAXSTR) && (message[i] != '\0') )
        {
            if (((message[i] < ' ') || (message[i] > '~') ) &&
                    (message[i] != '\n') )
            {
                message[i] = ' ';
            }
            i++;
        }
        stat = deliverMessageSuid(addr,message);
        /*
        	if (stat < 0)
        	{
        	   sprintf(addr,"vnmremsg: Error sending msg:%s.\n",paramstring);
                   text_error(addr);
        	}
         */
    }

}
Esempio n. 20
0
static int edit_user_file(const char *file, const char *desc, const char *submit)
{
	if (!loginok)
		return BBS_ELGNREQ;
	char buf[HOMELEN];
	sethomefile(buf, currentuser.userid, file);
	parse_post_data();
	char *text = getparm("text");
	if (*text != '\0') {
		int fd = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0644);
		if (fd < 0)
			return BBS_EINTNL;
		fb_flock(fd, LOCK_EX);
		safer_write(fd, text, strlen(text));
		fb_flock(fd, LOCK_UN);
		close(fd);
		xml_header("bbs");
		printf("<bbseufile ");
		print_session();
		printf(" desc='%s'></bbseufile>", desc);
	} else {
		xml_header("bbs");
		printf("<bbseufile ");
		print_session();
		printf(" desc='%s' submit='%s'>", desc, submit);
		xml_printfile(buf, stdout);
		printf("</bbseufile>");
	}
	return 0;
}
Esempio n. 21
0
int bbssel_main(void)
{
	xml_header("bbssel");
	printf("<bbssel ");
	print_session();
	printf(">");
	char *brd = getparm("brd");
	if (*brd != '\0') {
		struct boardheader *bp;
		int found = 0;
		for (int i = 0; i < MAXBOARD; i++) {
			bp = bcache + i;
			if (!hasreadperm(&currentuser, bp))
				continue;
			if (strcasestr(bp->filename, brd)
					|| strcasestr(bp->title, brd)) {
				printf("<brd dir='%d' title='%s' desc='%s' />",
						is_board_dir(bp), bp->filename, get_board_desc(bp));
				found++;
			}
		}
		if (!found)
			printf("<notfound />");
	}
	printf("</bbssel>");
	return 0;
}
Esempio n. 22
0
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;
}
Esempio n. 23
0
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();
}
Esempio n. 24
0
int save_plan(char *plan)
{
        char buf[10000];
        /* add by yiyo 过滤说明档多余字符
                char* p;
                int i;
         
                p = buf;
                i = 0;
                while (*p) {
                        if (13 != *p) {
                                buf[i] = *p;
                                i++;
                        }
                        p++;
                }
                buf[i] = 0;
        /* add end by yiyo */
        fp=fopen(plan, "w");
        strsncpy(buf, getparm("text"), 9999);
        fprintf(fp, "%s", buf);
        fclose(fp);
        printf("个人说明档修改成功。");
        http_quit();
}
Esempio n. 25
0
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();
}
Esempio n. 26
0
int main()
{
        init_all();
        struct compact p;
        char board[STRLEN],path[STRLEN];
        strsncpy(board, getparm("board"), 20);
        sprintf(path,"compact/%s/compact",board);
        int   total=get_num_records(path,sizeof(p));
        if(total==0) {
                showinfo("该板尚无过刊.");
                return 1;
        }

        printf("<center>%s 过刊区<br>",board);
        printf("----------------------------------------------------------");
        printf("<table width=80% boarder=0 align=center>");
        printf("<tr><td>序号</td><td>名称</td><td>文章总数</td><td>建立日期</td></tr>");
        FILE *fp=fopen(path,"r");
        if(fp==0) {
                printf("文件读取错误,请重试.");
                return 1;
        }
        int  i=1;
        while(1) {
                if(fread(&p, sizeof(p), 1, fp)<=0)
                        break;
                printf("<tr><td>%d</td><td><a href=bbsdoc?board=%s&&mode=c&&num=%d>%s</a></td><td>%d</td><td>%6.6s</td></tr>\
                       ",i,board,i,p.name,p.total,ctime(&p.time)+4);
                i++;
        }

        printf("</table>");
        fclose(fp);
        return 0;
}
Esempio n. 27
0
File: param.c Progetto: E-LLP/QuIP
static void getarrel(QSP_ARG_DECL  Param *p,int pindex)
{
	Param tprm;
	char pmpt[160];
	int max;

	tprm.p_comment=(&pmpt[0]);
	tprm.p_name=p->p_name;
	max=(int)((p->p_type & NELTMASK) + 1);
	if( pindex < 0 || pindex >= max ){
		sprintf(ERROR_STRING,"legal indices:0 to %d",max);
		WARN(ERROR_STRING);
		return;
	}
	if( IS_FLOAT_ARRAY_PARAM(p) ){
		tprm.p_type=FLOATP;
		tprm.u.fp=p->u.fp+pindex;
	} else if( IS_SHORT_ARRAY_PARAM(p) ){
		tprm.p_type=SHORTP;
		tprm.u.sp=p->u.sp+pindex;
	} else if( IS_INT_ARRAY_PARAM(p) ){
		tprm.p_type=INTP;
		tprm.u.ip=p->u.ip+pindex;
	}
	switch(pindex){
		case 0: sprintf(pmpt,"(1st) "); break;
		case 1: sprintf(pmpt,"(2nd) "); break;
		case 2: sprintf(pmpt,"(3rd) "); break;
		default: sprintf(pmpt,"(%dth) ",pindex+1); break;
	}
	strcat(pmpt,p->p_comment);
	getparm(QSP_ARG   &tprm );
}
Esempio n. 28
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();
}
Esempio n. 29
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();
}
Esempio n. 30
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(&currentuser, board))
                http_fatal("错误的讨论区");
        if(!has_BM_perm(&currentuser, 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();
}