Esempio n. 1
0
void check_register_info(void)
{
	struct userec *urec = &currentuser;
	FILE *fout;
	char buf[192], buf2[STRLEN];
	if (!(urec->userlevel & PERM_LOGIN)) {
		urec->userlevel = 0;
		return;
	}
#ifdef NEWCOMERREPORT
	if (urec->numlogins == 1) {
		screen_clear();
		file_temp_name(buf, sizeof(buf));
		if ((fout = fopen(buf, "w")) != NULL) {
			//% fprintf(fout, "大家好,\n\n");
			fprintf(fout, "\xb4\xf3\xbc\xd2\xba\xc3,\n\n");
			//% fprintf(fout, "我是 %s (%s), 来自 %s\n",
			fprintf(fout, "\xce\xd2\xca\xc7 %s (%s), \xc0\xb4\xd7\xd4 %s\n",
					currentuser.userid, urec->username, fromhost);
			//% fprintf(fout, "今天%s初来此站报到, 请大家多多指教。\n",
			fprintf(fout, "\xbd\xf1\xcc\xec%s\xb3\xf5\xc0\xb4\xb4\xcb\xd5\xbe\xb1\xa8\xb5\xbd, \xc7\xeb\xb4\xf3\xbc\xd2\xb6\xe0\xb6\xe0\xd6\xb8\xbd\xcc\xa1\xa3\n",
					//% (urec->gender == 'M') ? "小弟" : "小女子");
					(urec->gender == 'M') ? "\xd0\xa1\xb5\xdc" : "\xd0\xa1\xc5\xae\xd7\xd3");
			screen_move(2, 0);
			//% prints("非常欢迎 %s 光临本站,希望您能在本站找到属于自己的一片天空!\n\n", currentuser.userid);
			prints("\xb7\xc7\xb3\xa3\xbb\xb6\xd3\xad %s \xb9\xe2\xc1\xd9\xb1\xbe\xd5\xbe\xa3\xac\xcf\xa3\xcd\xfb\xc4\xfa\xc4\xdc\xd4\xda\xb1\xbe\xd5\xbe\xd5\xd2\xb5\xbd\xca\xf4\xd3\xda\xd7\xd4\xbc\xba\xb5\xc4\xd2\xbb\xc6\xac\xcc\xec\xbf\xd5\xa3\xa1\n\n", currentuser.userid);
			//% prints("请您作个简短的个人简介, 向本站其他使用者打个招呼\n");
			prints("\xc7\xeb\xc4\xfa\xd7\xf7\xb8\xf6\xbc\xf2\xb6\xcc\xb5\xc4\xb8\xf6\xc8\xcb\xbc\xf2\xbd\xe9, \xcf\xf2\xb1\xbe\xd5\xbe\xc6\xe4\xcb\xfb\xca\xb9\xd3\xc3\xd5\xdf\xb4\xf2\xb8\xf6\xd5\xd0\xba\xf4\n");
			//% prints("(简介最多三行, 写完可直接按 <Enter> 跳离)....");
			prints("(\xbc\xf2\xbd\xe9\xd7\xee\xb6\xe0\xc8\xfd\xd0\xd0, \xd0\xb4\xcd\xea\xbf\xc9\xd6\xb1\xbd\xd3\xb0\xb4 <Enter> \xcc\xf8\xc0\xeb)....");
			getdata(6, 0, ":", buf2, 75, DOECHO, YEA);
			if (buf2[0] != '\0') {
				//% fprintf(fout, "\n\n自我介绍:\n\n");
				fprintf(fout, "\n\n\xd7\xd4\xce\xd2\xbd\xe9\xc9\xdc:\n\n");
				fprintf(fout, "%s\n", buf2);
				getdata(7, 0, ":", buf2, 75, DOECHO, YEA);
				if (buf2[0] != '\0') {
					fprintf(fout, "%s\n", buf2);
					getdata(8, 0, ":", buf2, 75, DOECHO, YEA);
					if (buf2[0] != '\0') {
						fprintf(fout, "%s\n", buf2);
					}
				}
			}
			fclose(fout);
			//% sprintf(buf2, "新手上路: %s", urec->username);
			sprintf(buf2, "\xd0\xc2\xca\xd6\xc9\xcf\xc2\xb7: %s", urec->username);
			Postfile(buf, "newcomers", buf2, 2);
			unlink(buf);
		}
		pressanykey();
	}
#endif
#ifndef FDQUAN
	//检查邮箱
	while (!HAS_PERM(PERM_BINDMAIL)) {
		screen_clear();
		if (HAS_PERM(PERM_REGISTER)) {
			//% while (askyn("是否绑定复旦邮箱", NA, NA)== NA)
			while (askyn("\xca\xc7\xb7\xf1\xb0\xf3\xb6\xa8\xb8\xb4\xb5\xa9\xd3\xca\xcf\xe4", NA, NA)== NA)
			//add  by eefree.06.7.20
			{
				//% if (askyn("是否填写校友信息", NA, NA) == NA) {
				if (askyn("\xca\xc7\xb7\xf1\xcc\xee\xd0\xb4\xd0\xa3\xd3\xd1\xd0\xc5\xcf\xa2", NA, NA) == NA) {
					screen_clear();
					continue;
				}
				check_reg_extra();
				return;
			}
			//add end.
		}
		tui_check_reg_mail();
	}
#endif

	screen_clear();
	if (HAS_PERM(PERM_REGISTER))
		return;
#ifndef AUTOGETPERM

	if (check_register_ok()) {
#endif
		set_safe_record();
		urec->userlevel |= PERM_DEFAULT;
		substitut_record(PASSFILE, urec, sizeof(struct userec), usernum);
		return;
#ifndef AUTOGETPERM

	}
#endif

	if (!chkmail())
		fill_reg_form();
}
Esempio n. 2
0
void check_register_info() {
	struct userec *urec = &currentuser;
	FILE *fout;
	char buf[192], buf2[STRLEN];
#ifdef MAILCHECK

	char ans[4];
#ifdef CODE_VALID

	int i;
#endif
#endif

	if (!(urec->userlevel & PERM_LOGIN)) {
		urec->userlevel = 0;
		return;
	}
#ifdef NEWCOMERREPORT
	if (urec->numlogins == 1) {
		clear();
		sprintf(buf, "tmp/newcomer.%s", currentuser.userid);
		if ((fout = fopen(buf, "w")) != NULL) {
			fprintf(fout, "��Һ�,\n\n");
			fprintf(fout, "���� %s (%s), ���� %s\n",
					currentuser.userid, urec->username, fromhost);
			fprintf(fout, "����%s������վ����, ���Ҷ��ָ�̡�\n",
					(urec->gender == 'M') ? "С��" : "СŮ��");
			move(2, 0);
			prints("�dz���ӭ %s ���ٱ�վ��ϣ�������ڱ�վ�ҵ������Լ���һƬ��գ�\n\n", currentuser.userid);
			prints("����������̵ĸ��˼��, ��վ����ʹ���ߴ���к�\n");
			prints("(����������, д���ֱ�Ӱ� <Enter> ����)....");
			getdata(6, 0, ":", buf2, 75, DOECHO, YEA);
			if (buf2[0] != '\0') {
				fprintf(fout, "\n\n���ҽ���:\n\n");
				fprintf(fout, "%s\n", buf2);
				getdata(7, 0, ":", buf2, 75, DOECHO, YEA);
				if (buf2[0] != '\0') {
					fprintf(fout, "%s\n", buf2);
					getdata(8, 0, ":", buf2, 75, DOECHO, YEA);
					if (buf2[0] != '\0') {
						fprintf(fout, "%s\n", buf2);
					}
				}
			}
			fclose(fout);
			sprintf(buf2, "������·: %s", urec->username);
			Postfile(buf, "newcomers", buf2, 2);
			unlink(buf);
		}
		pressanykey();
	}
#endif
#ifdef PASSAFTERTHREEDAYS
	if (urec->lastlogin - urec->firstlogin < 3 * 86400) {
		if (!HAS_PERM(PERM_SYSOP)) {
			set_safe_record();
			urec->userlevel &= ~(PERM_DEFAULT);
			urec->userlevel |= PERM_LOGIN;
			substitut_record(PASSFILE, urec, sizeof(struct userec), usernum);
			ansimore("etc/newregister", YEA);
			return;
		}
	}
#endif
#ifndef FDQUAN
	//�������
	while (!HAS_PERM(PERM_BINDMAIL)) {
		clear();
		if (HAS_PERM(PERM_REGISTER)) {
			while (askyn("�Ƿ�󶨸�������", NA, NA)== NA)
			//add  by eefree.06.7.20
			{
				if (askyn("�Ƿ���дУ����Ϣ", NA, NA) == NA) {
					clear();
					continue;
				}
				check_reg_extra();
				return;
			}
			//add end.
		}
		check_reg_mail();
	}

#endif

	clear();
	if (HAS_PERM(PERM_REGISTER))
		return;
#ifndef AUTOGETPERM

	if (check_register_ok()) {
#endif
		set_safe_record();
		urec->userlevel |= PERM_DEFAULT;
		substitut_record(PASSFILE, urec, sizeof(struct userec), usernum);
		return;
#ifndef AUTOGETPERM

	}
#endif

#ifdef MAILCHECK
#ifdef CODE_VALID
	sethomefile(buf, currentuser.userid, ".regpass");
	if (dashf(buf)) {
		move(13, 0);
		prints("����δͨ�����ȷ��... \n");
		prints("�����ڱ�������ע��ȷ������, \"��֤����\"����Ϊ���ȷ��\n");
		prints("һ���� %d ���ַ�, ��Сд���в���, ��ע��.\n", RNDPASSLEN);
		prints("����ȡ�������������� [Enter] ��.\n");
		prints("��ע��, ����������һ����֤�������������������룡\n");
		if ((fout = fopen(buf, "r")) != NULL) {
			fscanf(fout, "%s", buf2);
			fclose(fout);
			for (i = 0; i < 3; i++) {
				move(18, 0);
				prints("������ %d ���\n", 3 - i);
				getdata(19,0,"��������֤����: ",genbuf,(RNDPASSLEN+1),DOECHO,YEA);
				if (strcmp(genbuf, "") != 0) {
					if (strcmp(genbuf, buf2) != 0)
					continue;
					else
					break;
				}
			}
		} else
		i = 3;
		if (i == 3) {
			prints("������֤ʧ��! ����Ҫ��дע�ᵥ�����ȷ������ȷ���������\n");
			getdata(22,0,"��ѡ��1.��ע�ᵥ 2.����ȷ���� [1]:",ans,2,DOECHO,YEA);
			if(ans[0] == '2') {
				send_regmail(&currentuser);
				pressanykey();
			} else
			x_fillform();
		} else {
			set_safe_record();
			urec->userlevel |= PERM_DEFAULT;
			substitut_record(PASSFILE, urec,sizeof(struct userec), usernum);
			prints("������!! ����˳����ɱ�վ��ʹ����ע������,\n");
			prints("������������ӵ��һ��ʹ���ߵ�Ȩ��������...\n");
			unlink(buf);
			mail_file("etc/smail", "SYSOP", "��ӭ���뱾վ����");
			pressanykey();
		}
		return;
	}
#endif
	if ( (!strstr(urec->email, BBSHOST)) && (!invalidaddr(urec->email)) &&
			(!invalid_email(urec->email))) {
		move(13, 0);
		prints("���ĵ������� ����ͨ��������֤...  \n");
		prints("    ��վ�����ϼ�һ����֤�Ÿ���,\n");
		prints("    ��ֻҪ�� %s ����, �Ϳ��Գ�Ϊ��վ�ϸ���.\n\n", urec->email);
		prints("    ��Ϊ��վ�ϸ���, �������и����Ȩ���!\n");
		prints("    ��Ҳ����ֱ����дע�ᵥ��Ȼ��ȴ�վ�����ֹ���֤��\n");
		getdata(21,0,"��ѡ��1.��ע�ᵥ 2.��ȷ���� [1]: ",ans,2,DOECHO,YEA);
		if(ans[0] == '2') {
			send_regmail(&currentuser);
			getdata(21,0,"ȷ�����Ѽij�, ��������Ŷ!! ",ans, 2, DOECHO, YEA);
			return;
		}
	}
#endif
	/* Following line modified by Amigo 2002.04.23. Fill form only when no new letter. */
	/*   x_fillform();*/
	if (!chkmail())
		x_fillform();
}