示例#1
0
int main(int argc, char *argv[])
{
    char account_id[ACCOUNT_LEN+1];
    menu_options_e current_option;

    /* Initian account_id. */
    memset(account_id, '\0', sizeof(account_id));
    current_option = mo_login; /* make sure current_option not equal mo_exit. */
    announce();
    database_initialize();

    /* Now we wait for user to input command. */
    while (current_option != mo_exit) {
        current_option = show_menu(account_id);

        switch(current_option) {
            case mo_new:
                create_new_account();
                break;
            case mo_reset:
                reset_passwd();
                break;
            case mo_loss:
                report_loss();
                break;
            case mo_login:
                login(account_id);
                break;
            case mo_query:
                query(account_id);
                break;
            case mo_store:
                store_money(account_id);
                break;
            case mo_draw:
                draw_money(account_id);
                break;
            case mo_renewal:
                renewal(account_id);
                break;
            case mo_change_passwd:
                change_passwd(account_id);
                break;
            case mo_logout:
                logout(account_id);
                break;
            case mo_exit:
            case mo_invalid:
            default:
                break;
        } /* switch */
    } /* while */

    database_close();
    exit(EXIT_SUCCESS);
} 
示例#2
0
	//Open a new account
	bank_account* bank_entity::open_new_account( long owner )
	{
		bank_account_id id = -1;
		bank_account* acc = create_new_account( owner );
		if( acc != nullptr )
		{
			id = acc->bank_acc_id;
			set_the_interest_rate( acc );
			//Adding the account
			bank_accounts[ id ] = acc;
			LOG("bank_entity::open_new_account(): New bank account, ID:",id,", owner EU:",owner );
		}
		return acc;
	}
示例#3
0
int
insert_custinfo(int account_no)
{
  ARBOR_CMF                  abp_cmf;
  ARBOR_CUST_SERVICE_CENTERS abp_svc_cntrs;
  ARBOR_CMF_STATUS_HISTORY   abp_cmf_sh;
  ARBOR_CMF_EXEMPT           abp_cmf_exempt;
  ARBOR_CCARD_LIST           abp_ccard_list;

  init_arbor_structs_from_cmf(cmf_ptr,
                              &abp_cmf,
                              &abp_svc_cntrs,
                              &abp_cmf_sh,
                              &abp_cmf_exempt,
                              &abp_ccard_list);

  if (create_new_account(dbcatalog, dbproc1,
                         cmf_ptr->server_id,
                         &abp_cmf,
                         (cmf_ptr->join   ? &abp_svc_cntrs  : NULL),
                         &abp_cmf_sh,
                         (cmf_ptr->exempt ? &abp_cmf_exempt : NULL),
                         (cmf_ptr->ccard  ? &abp_ccard_list : NULL))
      != SUCCESS)
  {
    return FAILURE;
  }

  /* now do inserts on project specific data */
  if (insert_project_custinfo(cmf_ptr->account_no) != SUCCESS)
  {
    /* should never happen, but just in case.... */
    /* error already posted by message handler */
    return FAILURE;
  }

  return SUCCESS;

} /* end insert_custinfo */
示例#4
0
static int try_login(void)
{
	char username[300];
	int retvalue, passwdcnt;
	
	DDPut(sd[usernamestr]);
	username[0] = 0;
	
	Prompt(username, 25, 0);
	removespaces(username);
	if (!checkcarrier())
		return -1;
	if (!username[0]) {		
		DDPut("");
		return -1;
	}
	if (!strcasecmp("new", username) && 
		!(maincfg.CFG_FLAGS & (1L << 17))) {
		CreateNewAccount();
		return -1;
	}
	if (!strcasecmp("logoff", username))
		return 0;
	if (!strcasecmp("chat", username)) {
		pagesysop(0);
		return -1;
	}

	retvalue = checklogon(username);
	if (!retvalue && !(maincfg.CFG_FLAGS & (1L << 17))) {
		if (maincfg.CFG_FLAGS & (1L << 9))
			return create_new_account() ? 0 : -1;
		else {
			DDPut(sd[unknownuserstr]);
			return -1;
		}
	} else {
		if (retvalue != 1 && !(maincfg.CFG_FLAGS & (1L << 18)))
			return -1;
		for (passwdcnt = 0; passwdcnt < 3; passwdcnt++) {
			username[0] = 0;
			if (ispw() || retvalue != 1) {
				DDPut(sd[passwordstr]);
				Prompt(username, 25, PROMPT_SECRET);
			}
			if (!checkcarrier()) 
				return -1;
			if (retvalue > 0 && (!ispw() || 
				cmppasswds(username, user.user_password))) {
				if (retvalue == 2) 
					DDPut(sd[alreadyonlinestr]);
				else
					getin();
				return 0;
			} else {
				if (passwdcnt != 2)
					DDPut(sd[tryagainstr]);
				clog.cl_flags |= CL_PASSWDFAIL;
			}
		}
		if (retvalue != 2) {
			TypeFile("passwordfailure", TYPE_MAKE);
			DDPut(sd[excessivepwfailstr]);
			return 0;
		} 
	}

	return -1;
}