<?





/*
	
	
SAMPLE REQUIRED VARS:	

//// API PATCH FOR "INSTANT_ACCOUNT_ACTIVATION
if(stristr($_SERVER['REQUEST_URI'],"instant_account_activation.api")) {
	$incoming_vars['user_firstname'] = $_XXXXX_NEW_ACCOUNT_INDIVIDAUL_FIRSTNAME = trim($incoming_vars['NEW_ACCOUNT_INDIVIDUAL_FIRSTNAME']);
	$incoming_vars['middle_name'] = $_XXXXX_NEW_ACCOUNT_INDIVIDAUL_MIDDLENAME = trim($incoming_vars['NEW_ACCOUNT_INDIVIDAUL_MIDDLENAME']);
	$incoming_vars['user_lastname'] = $_XXXXX_NEW_ACCOUNT_INDIVIDAUL_LASTNAME = trim($incoming_vars['NEW_ACCOUNT_INDIVIDAUL_LASTNAME']);
	$incoming_vars['user_emailaddress'] = $_XXXXX_NEW_ACCOUNT_INDIVIDUAL_EMAILADDRESS = trim($incoming_vars['NEW_ACCOUNT_INDIVIDUAL_EMAILADDRESS']);
	$incoming_vars['business_name'] = $_XXXXX_NEW_ACCOUNT_BUSINESS_NAME = trim($incoming_vars['NEW_ACCOUNT_BUSINESS_NAME']);
	$incoming_vars['business_type'] = $_XXXXX_NEW_ACCOUNT_BUSINESS_TYPE = trim($incoming_vars['NEW_ACCOUNT_BUSINESS_TYPE']);
	$incoming_vars['business_logo'] = $_XXXXX_NEW_ACCOUNT_BUSINESS_LOGO_URL = trim($incoming_vars['NEW_ACCOUNT_BUSINESS_LOGO_URL']);
	$_XXXXX_sponsor_accountid = trim($incoming_vars['BUSINESS_ACCOUNT_ID']);
	$incoming_vars['user_password'] = $_XXXXX_password = hash_me();
	$_XXXXX_account_name = $incoming_vars['business_name'] . " " . $incoming_vars['business_type'];
	$_XXXXX_account_name = str_ireplace(" ", "", $_XXXXX_account_name);
	$incoming_vars['account_name'] = $_XXXXX_account_name_clean = $_XXXXX_account_name = preg_replace('/[^a-z\d ]/i', '', $_XXXXX_account_name);
	if($_XXXXX_NEW_ACCOUNT_BUSINESS_LOGO_URL) {
		
		$_XXXXX_url_to_whitelabel_banner_2048x475 = $incoming_vars['business_logo'];
		$_XXXXX_url_to_whitelabel_icon_2048x2048 = $incoming_vars['business_logo'];
		$_XXXXX_url_to_whitelabel_icon_500x500 = $incoming_vars['business_logo'];
		$_XXXX_url_to_favicon = $incoming_vars['business_logo'];
	}
}


$master_datetime = $master_common_datetime = datetime_v2();
$_XXXXX_account_name = $incoming_vars['account_name'];
$_XXXXX_firstname = addslashes(trim($incoming_vars['user_firstname']));
$_XXXXX_lastname = addslashes(trim($incoming_vars['user_lastname']));
$_XXXXX_user_emailaddress = addslashes(trim($incoming_vars['user_emailaddress']));
$_XXXXX_user_password = addslashes(trim($incoming_vars['user_password']));
$registration_datetime = datetime_v2();
$_XXXXX_business_name = $incoming_vars['account_name'];
$_XXXXX_business_category = addslashes($incoming_vars['business_category']);
$_XXXXX_client_service_inteli_login_status = $incoming_vars['client_service_inteli_login_status'];
$_XXXXX_client_service_inteli_login_customers = $incoming_vars['client_service_inteli_login_customers'];
$_XXXXX_client_service_biometric_aml = $incoming_vars['client_service_biometric_aml'];
$_XXXXX_business_agenda = $incoming_vars['business_agenda'];
$_XXXXX_associate_onboarding_storage_tier_key = $incoming_vars['associate_onboarding_storage_tier_key'];
$_XXXXX_customers_onboarding_storage_tier_key = $incoming_vars['customers_onboarding_storage_tier_key'];
$_XXXXX_customers_onboarding_storage_tier_key = $incoming_vars['employees_onboarding_storage_tier_key'];
$_XXXXX_client_service_api = $incoming_vars['client_service_api'];
$_XXXXX_client_service_agents = $incoming_vars['client_service_agents'];
$_XXXXX_client_service_apps = $incoming_vars['client_service_apps'];
$_XXXXX_client_service_desktop = $incoming_vars['client_service_desktop'];
$_XXXXX_whitelabel_app_name = $_XXXXX_account_name;


*/




///register.gate
$_XXXXX_account_name = $incoming_vars['account_name'];

$_XXXXX_firstname = addslashes(trim($incoming_vars['user_firstname']));
$_XXXXX_lastname = addslashes(trim($incoming_vars['user_lastname']));

$_XXXXX_user_emailaddress = addslashes(trim($incoming_vars['user_emailaddress']));
$_XXXXX_user_password = addslashes(trim($incoming_vars['user_password']));
		
$registration_datetime = datetime_v2();


///pricing.gate
$_XXXXX_business_name = $incoming_vars['business_name'];
$_XXXXX_business_category = addslashes($incoming_vars['business_category']);
$_XXXXX_client_service_inteli_login_status = $incoming_vars['client_service_inteli_login_status'];
$_XXXXX_client_service_inteli_login_customers = $incoming_vars['client_service_inteli_login_customers'];
$_XXXXX_client_service_biometric_aml = $incoming_vars['client_service_biometric_aml'];
$_XXXXX_business_agenda = $incoming_vars['business_agenda'];
$_XXXXX_associate_onboarding_storage_tier_key = $incoming_vars['associate_onboarding_storage_tier_key'];
$_XXXXX_customers_onboarding_storage_tier_key = $incoming_vars['customers_onboarding_storage_tier_key'];
$_XXXXX_customers_onboarding_storage_tier_key = $incoming_vars['employees_onboarding_storage_tier_key'];
$_XXXXX_client_service_api = $incoming_vars['client_service_api'];
$_XXXXX_client_service_agents = $incoming_vars['client_service_agents'];
$_XXXXX_client_service_apps = $incoming_vars['client_service_apps'];
$_XXXXX_client_service_desktop = $incoming_vars['client_service_desktop'];





$_XXXXX_account_name = trim($_XXXXX_account_name);
$_XXXXX_account_name_clean = str_ireplace(" ", "", $_XXXXX_account_name);
$_XXXXX_account_name_clean = preg_replace('/[^a-z\d ]/i', '', $_XXXXX_account_name_clean);




logger3("incoming_vars['account_name']",$incoming_vars['account_name']);


logger3("incoming_vars",$incoming_vars);

//exit;





##############################################
##############################################
#### START: REGISTER A NEW WHITELABEL ACCOUNT:

if(
	($incoming_vars['account_name'])
	&& ($incoming_vars['user_emailaddress'])
	&& ($incoming_vars['user_password'])
) {



	$_XXXXX_whitelabel_web = $incoming_vars['account_name'];
	
	//test("incoming_vars",$incoming_vars);
	
	//exit;
	$account_exists->hash = true;
	while($account_exists->hash) {
	
		$tmp_sql = "SELECT * 
					FROM accounts
					WHERE whitelabel_web = '". $_XXXXX_whitelabel_web ."'
					AND template_company_hash = '". $_SESSION['template']['company']['hash'] ."'
					;";
		$account_exists = readTHECASHIER($tmp_sql);
		
		if($account_exists->hash) {
			
			if(stristr($_SERVER['REQUEST_URI'],"instant_account_activation.api")) {
				
				$_XXXXX_whitelabel_web = $incoming_vars['account_name'] . "." . rand(111,999);
				
			} else {
			
				$_SESSION['ADMIN_SYSMSG'] = "<span style='line-height:25px;'>
				NOTE - This Business has been previously created!<br>
				Please login with your registered credentials...
				</span>
				";
				jump("javascript","//". $_SESSION['template']['company']['host_login'] ."/". $master_filename_prefix ."get_started.gate",0);
				exit;
			}
		}
	}


	################################################################################################
	################################################################################################
	################################################################################################
	################################################################################################
	################################################################################################
	################################################################################################
	### START :: REGISTER ACCOUNT:  PERSONAL
	################################################################################################
	
	$set_member_hash = $member_hash = $_XXXXX_member_hash = make_hash();
	
	if(!$_XXXXX_sponsor_accountid) $_XXXXX_sponsor_accountid = $_COOKIE['sponsor_accountid'];
	if($incoming_vars['agent_account_hash']) $_XXXXX_sponsor_accountid = $incoming_vars['agent_account_hash'];
	
	# $_XXXXX_account_name = $incoming_vars['account_name'];
	# $_XXXXX_user_emailaddress = $incoming_vars['user_emailaddress'];
	# $_XXXXX_user_password = $incoming_vars['user_password'];
	
	###  FIRST, CREATE A MEMBER:
	$test_sql = "INSERT into members (
		`memberid`,
		`hash`,
		
		`template_company_hash`,
		
		`sponsor_accountid`,
		`sponsor_terms`,
		`salutation`,
		`firstname`,
		`lastname`,
		`emailaddress`,
		`password`,
		`birthdate`,
		`country_iso3`,
		`timezone`,
		`authorization_voice`,
		`type`,
		`coupon_used_to_register`,
		
		`app_version`,
		
		`whitelabel_business_account_hash`,
		
		`created`,
		`updated`) 
	
	VALUES ('" . $blank_memberid . "',
		'" . $_XXXXX_member_hash . "',
		
		'" . $_SESSION['template']['company']['hash'] . "',
		
		'" . $_XXXXX_sponsor_accountid . "',
		'" . addslashes($_COOKIE['sponsor_terms']) . "',
		'" . $_XXXXX_saluation . "',
		'" . $_XXXXX_firstname . "',
		'" . $_XXXXX_lastname . "',
		'" . $_XXXXX_user_emailaddress . "',
		'" . $_XXXXX_user_password . "',
		'" . $_XXXXX_birth_year . "-" . $_XXXXX_birth_month . "-" . $_XXXXX_birth_day . "',
		'" . $_XXXXX_country_iso3 . "',
		'" . $_XXXXX['timezone']['offset'] . "',
		'" . $master_config_authorization_voice . "',
		'" . $member_type . "',
		'" . $_XXXXX_coupon . "',
		
		'" . $_XXXXX_PAYYAP_version . "',
		
		'" . $_XXXXX_whitelabel_business_account_hash . "',
		
		'" . $registration_datetime . "',
		'" . $registration_datetime . "')";
	
	logger3("test_sql",$test_sql);
	$memberid = insertTHECASHIER($test_sql);
	logger3("memberid",$memberid);
	//exit;
	
	
	$tmp_full_name = "";
	$personal_account_hash = hash_me();
	
	### CREATE A PERSONAL ACCOUNT:
	$tmp_sql = "INSERT into accounts (
		`accountid`,
		`hash`,
		
		`template_company_hash`,
		
		`accounttype`,
		`accountname`,
		
		`streetaddress1`,
		`streetaddress2`,
		
		`city`,
		`state`,
		
		`region`,
		`postalcode`,
		
		`country_iso3`,
		`dayphone`,
		
		`eveningphone`,
		`faxphone`,
		
		`mobilephone`,
		`customer_support_phone_number_1`,
		
		`emailaddress`,
		`agreement`,
		
		`currency_translation`,
		`currency_0_country`,
		
		`currency_0_iso3`,
		`currency_country_1`,
		
		`currency_code_1`,
		`currency_country_2`,
		
		`currency_code_2`,
		`product_type`,
		
		`transaction_fee_total`,
		`transaction_fee_my`,
		
		`retry_fee`,
		`sponsor_fee`,
		
		`status_payments`,
		`sponsor_accountid`,
		
		`sponsor_terms`,
		`data_GB`,
		
		`whitelabel_business_account_hash`,
		
		
		`creator_memberid`,
		`creator_member_hash`,
		
		`created`,
		`updated`
	) VALUES (
		'" . $blank_accountid . "',
		'" . $personal_account_hash . "',
		
		'" . $_SESSION['template']['company']['hash'] . "',
		
		'Personal',
		'" . $_XXXXX_tmp_full_name . "',
		
		'" . $_XXXXX_streetaddress1 . "',
		'" . $_XXXXX_streetaddress2 . "',
		
		'" . $_XXXXX_city . "',
		'" . $_XXXXX_state . "',
		
		'" . $_XXXXX_region . "',
		'" . $_XXXXX_postalcode . "',
		
		'" . $_XXXXX_country_iso3 . "',
		'" . $_XXXXX_dayphone . "',
		
		'" . $_XXXXX_eveningphone . "',
		'" . $_XXXXX_faxphone . "',
		
		'" . $_XXXXX_mobilephone . "',
		'". $_XXXXX_calling_code ."/". $_XXXXX_phone_number ."',
		
		'" . $_XXXXX_user_emailaddress . "',
		'" . $_XXXXX_agreement . "',
		
		'" .  $currency_translation . "',
		'USA',
		
		'USD',
		'" .  $_SESSION['session']['registration']['country_iso3'] . "',
		
		'" .  $currency_code . "',
		'" .  $blank_currency_country_2 . "',
		
		'" . $product_type_blank . "',
		'" . $product_type_blank . "',
		
		'" . $master_config_personal_transaction_fee . "',
		'" . $master_config_personal_transaction_fee . "',
		
		'" . $master_config_retry_fee_BLANK_FOR_PERSONAL_ACCOUNTS . "',		
		'" . $sponsor_fee_todo . "',
		
		'ON',
		'" . $_XXXXX_sponsor_accountid . "',
		
		'" . $_COOKIE['sponsor_terms'] . "',
		'1',
		
		'" . $_XXXXX_whitelabel_business_account_hash . "',
		
		
		'" . $memberid . "',
		'" . $_XXXXX_member_hash . "',
		
				
		'" . $registration_datetime . "',		
		'" . $registration_datetime . "'
		
		);";
	logger3("tmp_sql",$tmp_sql);
	$accountid = $personal_accountid = insertTHECASHIER($tmp_sql);
	logger3("accountid",$accountid);
	
	//exit;
	
	
	### GET IPID:
	$_XXXXX_sponsor_account_hash = $_XXXXX_sponsor_accountid;
	$_XXXXX_status = "";
	$tmp_query = "INSERT into ips (
		`ipid`,
		`memberid`,
		`member_hash`,
		`ip`,
		`status`,
		`sponsor_account_hash`,
		`created`,
		`updated`
	) VALUES (
		'" . $ipid . "',
		'" . $memberid . "',
		'" . $set_member_hash . "',
		'" . $_SERVER['REMOTE_ADDR'] . "',
		'". $_XXXXX_status ."',
		'" . $_XXXXX_sponsor_account_hash . "',
		'" . $registration_datetime . "',
		'" . $registration_datetime . "')";			
	$ipid = insertTHECASHIER($tmp_query);
	
	
	
	
	
	$new_account_balance = "0.00";
	
	### NOW SET PERSONAL ACCOUNT BALANCE:
	$tmp_sql = "INSERT into balances 
				(
				`balanceid`,
				`platform`,
				`currency_iso3`,
				`accountid`,
				`account_balance`,
				`approved`,
				`sponsor_balance`,
				`available`,
				`created`) 
			VALUES 	
				(
				'" . $balanceid . "',
				'" . echo_platform() . "',
				'" . $_SESSION['template']['company']['currency1'] . "',
				'" . $accountid . "',
				'". $new_account_balance ."',
				'0.00',
				'0.00',
				'0.00',
				'" . $registration_datetime . "');";
	logger3("tmp_sql",$tmp_sql);	
	$balanceid = insertTHECASHIER($tmp_sql);
	logger3("balanceid",$balanceid);	
	
	
	### NOW TIE IT ALL TOGETHER AND SET THE PERMISSIONS:
	//$permissionsid = insertTHECASHIER("INSERT into permissions (`permissionsid`,`memberid`,`accountid`,`permissions`,`created`) VALUES ('" . $permissionsid . "','" . $memberid . "','" . $accountid . "','MASTER','" . $registration_datetime . "')");
	
	### SET PERMISSIONS: ############################
	$set_permissionsid = null;
	$set_hash = hash_me();
	$set_memberid = $memberid;
	$set_accountid = $accountid;
	$set_accounttype = "Personal";
	$set_permissions = "MASTER";
	$set_admin =null;
	$set_login_biometric_verification = "OFF";
	$set_status = "ACTIVE";
	$set_notification_firstname = null;
	$set_notification_lastname = null;
	$set_creator_memberid = $memberid;
	$set_created = null;
	$set_datetime_created = $registration_datetime;
	$set_datetime_updated = $registration_datetime;
	
	$tmp_sql = "INSERT into permissions (
		`permissionsid`,
		`hash`,
		`memberid`,
		`accountid`,
		`accounttype`,
		`permissions`,
		`admin`,
		`login_biometric_verification`,
		`status`,
		`notification_firstname`,
		`notification_lastname`,
		`creator_memberid`,
		`created`,
		`datetime_created`,
		`datetime_updated`
	) VALUES (
		'" . $set_permissionsid . "',
		'" . $set_hash . "',
		'" . $set_memberid . "',
		'" . $set_accountid . "',
		'" . $set_accounttype . "',
		'" . $set_permissions . "',
		'" . $set_admin . "',
		'" . $set_login_biometric_verification . "',
		'" . $set_status . "',
		'" . $set_notification_firstname . "',
		'" . $set_notification_lastname . "',
		'" . $set_creator_memberid . "',
		'" . $set_created . "',
		'" . $set_datetime_created . "',
		'" . $set_datetime_updated . "');";
	$permissionsid = insertTHECASHIER($tmp_sql);
	logger3("tmp_sql",$tmp_sql);
	logger3("permissionsid",$permissionsid);
	###################################################  
	
		
	


	
	
	### NOW UPDATE SESSIONS:
	#unset($preregister);
	$_SESSION['member'] = $member = member($memberid);
	$_SESSION['account'] = $account = account($accountid);
	
	
	

	################################################################################################
	### START :: REGISTER ACCOUNT:  BUSINESS
	################################################################################################
	
	
	### E-BUSINESS SPECIFIC
	
	//$_SESSION['session']['registration']['business_category'] = "SERVICES"; // i.e., pc / tech support 
	//$_SESSION['session']['registration']['business_subcategory'] = $_SESSION['session']['registration']['business_subcategory']; // "7379"; // i.e., pc / tech support 
	
	
	
	
	$_SESSION['session']['registration']['city'] = $_SESSION['session']['geo']['city'];
	$_SESSION['session']['registration']['state'] = $_SESSION['session']['geo']['region'];
	$_SESSION['session']['registration']['region'] = $_SESSION['session']['geo']['region'];
	$_SESSION['session']['registration']['region'] = $_SESSION['session']['geo']['region'];
	$_SESSION['session']['registration']['postalcode'] = $_SESSION['session']['geo']['cityid'];
	$_SESSION['session']['registration']['country_iso3'] = $_SESSION['session']['geo']['iso3'];
	
	
	$_SESSION['session']['registration']['agreement'] = "YES";
	
	$_SESSION['session']['registration']['transaction_fee'] = $master_config_creditcard_fee_GSP;
	
	$tmp_local_currency = geo_data($_SESSION['session']['geo']['iso3'],"iso3","currency_code");
	
	
	$tmp_system_country = "USA";
	
	if(stristr($tmp_local_currency,$_SESSION['template']['company']['currency1'])) {
		$currency_tranlsation = "Off";
	} else {
		$currency_tranlsation = "On";
	}
	
	$currency_0_country = $tmp_system_country;
	$currency_0_iso3 = $_SESSION['template']['company']['currency1'];
	$country_iso3 = $_SESSION['session']['registration']['country_iso3'];
	$currency_code = $tmp_local_currency;
	$blank_currency_country_2 = "";
	$blank_currency_code_2 = "";
	
	$tmp_gateway_profile = $master_config_default_gateway;
	
	
	if(!$_XXXXX_url_to_whitelabel_banner_2048x475) $_XXXXX_url_to_whitelabel_banner_2048x475 = "https://images.intelitruth.com/your_logo_here_1000x200_T.png";
	if(!$_XXXXX_url_to_whitelabel_icon_2048x2048) $_XXXXX_url_to_whitelabel_icon_2048x2048 = "https://images.intelitruth.com/your_logo_here_500x500_T.png";
	if(!$_XXXXX_url_to_whitelabel_icon_500x500) $_XXXXX_url_to_whitelabel_icon_500x500 = "https://images.intelitruth.com/your_logo_here_500x500_T.png";
	$_XXXXX_whitelabel_app_name = $_XXXXX_account_name;
	
	
	
	$account_hash = $business_account_hash = hash_me(); // "2a31b58f2a89687254ba451be3114006"; // 	
	
	### CREATE A BUSINESS ACCOUNT:
	$tmp_sql = "INSERT into accounts (
		`accountid`,
		`hash`,
		
		`template_company_hash`,
		
		`accounttype`,
		`business_category`,
		
		`business_subcategory`,
		`descriptor`,
		
		`accountname`,
		`business_type`,
		
		`department`,
		`streetaddress1`,
		
		`streetaddress2`,
		`city`,
		
		`state`,
		`region`,
		
		`postalcode`,
		`country_iso3`,
		
		`dayphone`,
		`eveningphone`,
		
		`faxphone`,
		`mobilephone`,
		
		`emailaddress`,
		`agreement`,
		
		`photoBANGK_background_color`,
		`photoBANGK_highlight_color`,
		
		`photoBANGK_frame_color`,
		`photoBANGK_text_color`,
		
		`photoBANGK_style_background`,
		`photoBANGK_style_bg_opacity`,
		`photoBANGK_style_text_color`,
		
		`photoBANGK_font_size`,
		`photoBANGK_font_family`,
		`photoBANGK_font_weight`,
		
		
		`currency_translation`,
		
		`currency_0_country`,
		`currency_0_iso3`,
		
		`currency_country_1`,
		`currency_code_1`,
		
		`currency_country_2`,
		`currency_code_2`,
		
		`product_type`,
		`transaction_fee_total`,
		
		`transaction_fee_my`,
		`retry_fee`,
		
		`gateway_profile`,
		
		`sponsor_fee`,
		
		`status_payments`,
		`sponsor_accountid`,
		
		`sponsor_terms`,
		`data_GB`,
		
		`gallery_GB`,
		`gallery_photo_limit`,
		
		
		`url_to_whitelabel_banner_2048x475`,
		`url_to_whitelabel_icon_2048x2048`,
		`url_to_whitelabel_icon_500x500`,
		`whitelabel_app_name`,
		
		`whitelabel_business_account_hash`,
		`whitelabel_admin`,
		`whitelabel_agent`,
		`whitelabel_web`,
		
		`creator_memberid`,
		`creator_member_hash`,
		
		`created`,
		`updated`
	) VALUES (
		'" . $blank_accountid . "',
		'" . $business_account_hash . "',
		
		'" . $_SESSION['template']['company']['hash'] . "',
		
		'Business',
		'" . $_XXXXX_business_category . "',
		
		'" . $_XXXXX_business_subcategory . "',
		'" . $_XXXXX_unique_descriptor . "',
		
		'" . $_XXXXX_account_name . "',
		'" . $_XXXXX_business_type . "',
		
		'" . $_XXXXX_department . "',
		'" . $_XXXXX_streetaddress_1 . "',
		
		'" . $_XXXXX_streetaddress_2 . "',
		'" . $_XXXXX_city . "',
		
		'" . $_XXXXX_state . "',
		'" . $_XXXXX_region . "',
		
		'" . $_XXXXX_postalcode . "',
		'" . $_XXXXX_country_iso3 . "',
		
		'" . $_XXXXX_phone_primary . "',
		'" . $_XXXXX_phone_secondary . "',
		
		'" . $_XXXXX_phone_fax . "',
		'" . $_XXXXX_mobilephone . "',
		
		'" . $_XXXXX_user_emailaddress . "',
		'" . $_XXXXX_agreement . "',
		
		'". $photoBANGK_background_color ."',
		'". $photoBANGK_highlight_color ."',
		
		'". $photoBANGK_frame_color ."',
		'". $photoBANGK_text_color ."',
		
		
		'". $photoBANGK_style_background ."',
		'". $photoBANGK_style_bg_opacity ."',
		'". $photoBANGK_style_text_color ."',

		
		
		
		
		
		'". $photoBANGK_font_size ."',
		'". $photoBANGK_font_family ."',
		
		'". $photoBANGK_font_weight ."',
		'" . $currency_tranlsation . "',
		
		'" . $currency_0_country . "',
		'" . $currency_0_iso3 . "',
		
		'" . $country_iso3 . "',
		'" . $currency_code . "',
		
		'" . $blank_currency_country_2 . "',
		'" . $blank_currency_code_2 . "',
		
		'" . $blank_product_type . "',
		'" . $_XXXXX_transaction_fee . "',
		
		'" . $_XXXXX_transaction_fee . "',
		'" . $master_config_retry_fee . "',
		
		'" . $tmp_gateway_profile . "',
		'" . $tmp_sponsor_fee . "',
		'ON',
		
		'" . $_XXXXX_sponsor_accountid . "',
		
		'" . addslashes($_COOKIE['sponsor_terms']) . "',
		
		'" . $data_GB . "',
		'" . $gallery_GB . "',
		'" . $gallery_photo_limit . "',
		
		
		'" . $_XXXXX_url_to_whitelabel_banner_2048x475 . "',
		'" . $_XXXXX_url_to_whitelabel_icon_2048x2048 . "',
		'" . $_XXXXX_url_to_whitelabel_icon_500x500 . "',
		'" . $_XXXXX_whitelabel_app_name . "',
		
		
		
		
		
		'" . $business_account_hash . "',
		'" . $_XXXXX_account_name_clean . "-admin',
		'" . $_XXXXX_account_name_clean . "-agents',
		'" . $_XXXXX_account_name_clean . "',
		
		
		'" . $_SESSION['member']['memberid'] . "',
		'" . $_SESSION['member']['hash'] . "',
		
		
		'" . $registration_datetime . "',
		
		'" . $registration_datetime . "'
		);";
	$tmp_accountid = $business_accountid = insertTHECASHIER($tmp_sql);
	logger3("business_accountid tmp_sql",$tmp_sql);
	logger3("business_accountid",$tmp_accountid);
	//exit;
	
	
	### SET OPENING ACCOUNT BALANCE
	$new_account_balance = "0.00";
	
	
	### NOW SET AN ACCOUNT BALANCE:
	$tmp_sql = "INSERT into balances (
		`balanceid`,
		`platform`,
		`currency_iso3`,
		`accountid`,
		`account_balance`,
		`approved`,
		`sponsor_balance`,
		`available`,
		`created`
	) VALUES (
		'" . $blank_balanceid . "',
		'" . echo_platform() . "',
		'" . $_SESSION['template']['company']['currency1'] . "',
		'" . $tmp_accountid . "',
		'". $new_account_balance ."',
		'0.00',
		'0.00',
		'0.00',
		'" . $registration_datetime . "');";
	logger3("tmp_sql",$tmp_sql);
	$tmp_balanceid = insertTHECASHIER($tmp_sql);
	logger3("tmp_balanceid",$tmp_balanceid);
	
	
	
	### SET PERMISSIONS: ############################
	
	$set_permissionsid = "";
	$set_hash = make_hash();
	$set_memberid = $_SESSION['member']['memberid'];
	$set_accountid = $tmp_accountid;
	$set_accounttype = "Business";
	$set_permissions = "MASTER";
	$set_admin = "";
	$set_login_biometric_verification = "OFF";
	$set_status = "ACTIVE";
	$set_notification_firstname = "";
	$set_notification_lastname = "";
	$set_creator_memberid = $_SESSION['member']['memberid'];
	$set_created = ""; // legacy
	$set_datetime_created = $registration_datetime;
	$set_datetime_updated = $registration_datetime;
	
	$tmp_sql = "INSERT into permissions (
		`permissionsid`,
		`hash`,
		`memberid`,
		`accountid`,
		`accounttype`,
		`permissions`,
		`admin`,
		`login_biometric_verification`,
		`status`,
		`notification_firstname`,
		`notification_lastname`,
		`creator_memberid`,
		`created`,
		`datetime_created`,
		`datetime_updated`
	) VALUES (
		'" . $set_permissionsid . "',
		'" . $set_hash . "',
		'" . $set_memberid . "',
		'" . $set_accountid . "',
		'" . $set_accounttype . "',
		'" . $set_permissions . "',
		'" . $set_admin . "',
		'" . $set_login_biometric_verification . "',
		'" . $set_status . "',
		'" . $set_notification_firstname . "',
		'" . $set_notification_lastname . "',
		'" . $set_creator_memberid . "',
		'" . $set_created . "',
		'" . $set_datetime_created . "',
		'" . $set_datetime_updated . "');";
	$permissionsid = insertTHECASHIER($tmp_sql);
	logger3("tmp_sql",$tmp_sql);
	logger3("permissionsid",$permissionsid);
	
		
	
	
	if(!$mobile_number) {
		### GET EMAILADDRESSID
		$tmp_emailaddress = $_XXXXX_user_emailaddress;
		$tmp_memberid = $memberid;
		$tmp_accountid = $accountid;
		
		$tmp_member_hash = $member_hash;
		$tmp_account_hash = $personal_account_hash;
		$tmp_account_hash_personal = $personal_account_hash;
		$tmp_account_hash_business = $business_account_hash;
		
		$tmp_status = "SUBMITTED";
		
		
		
		
		$tmp_permissionsid = $permissionsid;
		$tmp_creator_memberid = $memberid;
		
		$_XXXXX_whitelabel_business_account_hash = $business_account_hash;
		$_XXXXX_sponsor_business_account_hash = $incoming_vars['sponsor_business_account_hash'];		

		
		$set_datetime_created = $registration_datetime;
		$set_datetime_updated = $registration_datetime;
		
		$tmp_query = "INSERT into email_addresses (
			`emailaddressesid`,
			`emailaddress`,
			`memberid`,
			`accountid`,
			
			`member_hash`,
			`account_hash`,
			`account_hash_personal`,
			`account_hash_business`,
			
			`status`,
			
			

			
			`permissionsid`,
			`creator_memberid`,
			
						
			`whitelabel_business_account_hash`,
			`sponsor_business_account_hash`,
			
						
			
			`datetime_created`,
			`datetime_updated`
		) VALUES (
			'" . $tmp_emailaddressesid . "',
			'" . $tmp_emailaddress . "',
			'" . $tmp_memberid . "',
			'" . $tmp_accountid . "',
			
			'" . $tmp_member_hash . "',
			'" . $tmp_account_hash . "',
			'" . $tmp_account_hash_personal . "',
			'" . $tmp_account_hash_business . "',

			
			'" . $tmp_status . "',
			

		
			
			
			'" . $tmp_permissionsid . "',
			'" . $tmp_creator_memberid . "',
			
			
			'". $_XXXXX_whitelabel_business_account_hash ."',
			'". $_XXXXX_sponsor_business_account_hash ."',				
			
			'" . $set_datetime_created . "',
			'" . $set_datetime_updated . "');";
		logger3("tmp_query",$tmp_query);
		$emailaddressesid = insertTHECASHIER($tmp_query);
		logger3("emailaddressesid",$emailaddressesid);
	
	} else {
		
		### GET PHONENUMBERID
		$_XXXXX_phonenumberid = "";
		$_XXXXX_hash = $phone_number_hash = hash_me();
		$_XXXXX_memberid = $memberid;
		$_XXXXX_member_hash = $member_hash;
		$_XXXXX_account_hash = $personal_account_hash;
		
		$_XXXXX_account_hash_personal = $personal_account_hash;
		$_XXXXX_account_hash_business = $business_account_hash;
		
		$_XXXXX_whitelabel_business_account_hash = $business_account_hash;
		
		$_XXXXX_sponsor_business_account_hash = $_XXXXX_sponsor_accountid;
		
		
		$_XXXXX_country_iso3 = $mobile_number_country_calling_code_iso3;
		$_XXXXX_calling_code = $mobile_number_country_calling_code;
		$_XXXXX_number = $mobile_number;
		$_XXXXX_description = "MOBILE";
		$_XXXXX_status = "SUBMITTED";
		$_XXXXX_sponsor_accountid = $_XXXXX_sponsor_accountid;
		$_XXXXX_created = datetime();
		$_XXXXX_updated = $_XXXXX_created;
		$tmp_sql = "INSERT INTO `phone_numbers`
					(
						`phonenumberid`
						, `hash`
						, `memberid`
						, `member_hash`
						, `account_hash`
						
						, `account_hash_personal`
						, `account_hash_business`
						
						, `country_iso3`
						, `calling_code`
						, `number`
						, `description`
						, `status`
						
						
						, `whitelabel_business_account_hash`
						, `sponsor_business_account_hash`
						
						
						, `sponsor_accountid`
						, `created`
						, `updated`
					) VALUES (
						'". $_XXXXX_phonenumberid ."'
						,'". $_XXXXX_hash ."'
						,'". $_XXXXX_memberid ."'
						,'". $_XXXXX_member_hash ."'
						,'". $_XXXXX_account_hash ."'
						
						,'". $_XXXXX_account_hash_personal ."'
						,'". $_XXXXX_account_hash_business ."'
						
						,'". $_XXXXX_country_iso3 ."'
						,'". $_XXXXX_calling_code ."'
						,'". $_XXXXX_number ."'
						,'". $_XXXXX_description ."'
						,'". $_XXXXX_status ."'
						
						,'". $_XXXXX_whitelabel_business_account_hash ."'
						,'". $_XXXXX_sponsor_business_account_hash ."'
						
						,'". $_XXXXX_sponsor_accountid ."'
						,'". $_XXXXX_created ."'
						,'". $_XXXXX_updated ."'
					);
					";
		logger3("tmp_sql",$tmp_sql);
		$phonenumberid = insertTHECASHIER($tmp_sql);
		logger3("phonenumberid",$phonenumberid);
		
		
	}


	
	#### DO THE DNS
	$DO_DNS = FALSE;
	if($DO_DNS == TRUE) {
		shell_exec($_SESSION['template']['company']['file_path'] . "admin/". $master_filename_prefix ."update_dns.sh '". $_XXXXX_account_name_clean . "'");
	}
	
	
	//logger3("update_intelutruth_dns_output",$update_intelutruth_dns_output);
	
	//logger3("update_intelutruth_dns_output",$update_intelutruth_dns_output);
	### DO THE HTTP
	
	//shell_exec("/BANGK\!/admin/update_intelitruth_httpd.sh '". $_XXXXX_account_name . "'");
	//logger3("update_intelutruth_httpd_output",$update_intelutruth_httpd_output);
	//logger3("update_intelutruth_httpd_output",$update_intelutruth_httpd_output);
	
	//sleep(2);
	
	$ADD_ADMINISTRATOR = TRUE;
	if($ADD_ADMINISTRATOR == TRUE) {
		$_XXXXX_administator_id = "";
		$_XXXXX_hash = hash_me();
		$_XXXXX_whitelabel_business_account_hash = $business_account_hash;
		$_XXXXX_emailaddress = $_XXXXX_user_emailaddress;
		$_XXXXX_password = $_XXXXX_user_password;
		$_XXXXX_datetime_created = datetime_v2();
		
		$_XXXXX_member_hash = $member_hash;
				
		$tmp_sql = "
		INSERT INTO `administators`
			(
				`administator_id`
				, `hash`
				, `member_hash`
				, `whitelabel_business_account_hash`
				, `emailaddress`
				, `password`
				, `datetime_created`
			) VALUES (
				'". $_XXXXX_administator_id ."'
				,'". $_XXXXX_hash ."'
				,'". $_XXXXX_member_hash ."'
				,'". $_XXXXX_whitelabel_business_account_hash ."'
				,'". $_XXXXX_emailaddress ."'
				,'". $_XXXXX_password ."'
				,'". $_XXXXX_datetime_created ."'
			)
		";
		logger3("tmp_sql",$tmp_sql);
		$insert_results = insertTHECASHIER($tmp_sql,"intelitruth");
		logger3("insert_results",$insert_results);
	}
	
	
	/// create JUDY JANE DOE
	$whitelabel_business_account_hash = $business_account_hash;
	$member_hash = $member_hash;
	$personal_account_hash = $personal_account_hash;
	$business_account_hash = $business_account_hash;
	create_a_new_jane_doe_account($whitelabel_business_account_hash,$member_hash,$personal_account_hash,$business_account_hash);
	
	
	//exit;
	
	
	
	/// SET ADMIN SESSION:
	$tmp_sql = "SELECT * 
				FROM administators
				WHERE hash = '". $_XXXXX_hash ."'
				;";
	//test("tmp_sql",$tmp_sql);
	$accounts_exist = readarrayTHECASHIER($tmp_sql,"intelitruth");
	//test("accounts_exist",$accounts_exist);
	$_SESSION['intelitruth']['administrator'] = object_to_array_v2($accounts_exist[0]);
	
	
	
//$DISPLAY_from_email_address = $_SESSION['template']['company']['enterprise_emailaddress_sales'];
if(!$DISPLAY_from_email_address) $DISPLAY_from_email_address = $_SESSION['template']['company']['enterprise_emailaddress_customer_support'];
if(!$DISPLAY_from_email_address) $DISPLAY_from_email_address = $_SESSION['template']['company']['emailaddress_support'];
if(!$DISPLAY_from_email_address) $DISPLAY_from_email_address = $_SESSION['template']['company']['primary_contact_emailaddress'];
			
	
	### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### 
	### SEND EMAIL RECEIPT (V1):
	if(!empty($_XXXXX_user_emailaddress)) {
		$to = $_XXXXX_user_emailaddress;
		$subject = "Welcome to ". $_SESSION['template']['company']['name'] ." (Your Account Credentials)";
		$message = "Welcome to ". $_SESSION['template']['company']['name'] .",

". $_SESSION['template']['company']['name'] ." makes it easy to on&bull;board and manage profiles from associates, colleagues, staff and patrons.

STEP 1:  Configure your ". $_SESSION['template']['company']['name'] ." (profile on&bull;boarding and management) Account:

&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href='https://". $_XXXXX_account_name_clean ."-admin.". $_SESSION['template']['company']['domain'] ."'>https://". $_XXXXX_account_name_clean ."-admin.". $_SESSION['template']['company']['domain'] ."</a>

STEP 2:  Distribute your on&bull;boarding link to begin collecting profiles:

&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href='https://". $_XXXXX_account_name_clean .".". $_SESSION['template']['company']['domain'] ."'>https://". $_XXXXX_account_name_clean .".". $_SESSION['template']['company']['domain'] ."</a>

Please reply to this email, if you have any questions about your account.

Thank you,

Team ". $_SESSION['template']['company']['name'] ."

WEB SUPPORT: <a href='https://". $_SESSION['template']['company']['host_support'] ."'>https://". $_SESSION['template']['company']['host_support'] ."</a>

EMAIL SUPPORT: <a href='mailto:". $_SESSION['template']['company']['emailaddress_support'] ."?subject=Question About My ". $_SESSION['template']['company']['name'] ." Account'>". $_SESSION['template']['company']['emailaddress_support'] ."</a>


";
		$activate_unsubscribe = true;
		//quick_mailer($to,$subject,$message,$activate_unsubscribe=false,$mail_exchange="");
	}
	
	
	### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### 
	


	
	
	### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### 
	### SEND EMAIL RECEIPT (V2):
	
	if(strlen($_XXXXX_user_password) != 32) {
		$_XXXXX_user_password_display = substr($_XXXXX_user_password,0,3). "******";
	} else {
		$_XXXXX_user_password_display = $_XXXXX_user_password;
	}

	if(!empty($_XXXXX_user_emailaddress)) {
		$to = $_XXXXX_user_emailaddress;
		//$subject = "Welcome to ". $_SESSION['template']['company']['name'] ." (Your Account Credentials)";
		$subject = "SUCCESS: Your On-Boarding/KYC/AML Service Account Details";
		$message = "
<h2>Welcome to ". $_SESSION['template']['company']['name'] .",</h2>

<p>". $_SESSION['template']['company']['name'] ." makes it easy to on&bull;board and manage KYC/AML-compliant profiles from associates, colleagues, staff and patrons.</p>

<h3>SIMPLE PRICING IS AS FOLLOWS:</h3>
<ul>
	<li>REGISTRATION:  COMPLETE (FREE)</li>
	<li>Whitelabel-Branding: Self Service (FREE)</li>
	<li>Desktop + Mobile Friendly On-Boarding App:  COMPLETE (FREE)</li>
	<li>Desktop + Mobile Friendly On-Boarding App (Maintenance):  FREE</li>
	<li>Per Profile Email Verification (FREE)</li>
	<li><u>Profile Hosting:  USD 0.05 per profile per month</u><sup>*</sup>, SERVICES INCLUDES:</li>
	<ul>
		<li>Global KYC Scans / month:  1 per profile</li>
		<li>Biometric AML Scans / month:  1 per profile</li>
		<li>Negative NEWS Scans / month:  1 per profile</li>
	</ul>
	<li><u>OPTIONAL</u> PREMIUM SERVICES:</li>
		<ul>
			<li>Whitelabel Native (iOS + Android) Mobile Apps:</li>
				<ul>
					<li>Set-Up (one-time): USD 499</li>
					<li>Maintenance: USD 99 / month</li>
				</ul>
				
			<li>API Gateway:</li>
				<ul>
					<li>Set-Up (one-time): USD 499</li>
					<li>Maintenance: USD 99 / month</li>
				</ul>
			<li>Customer SMS Verification:</li>
				<ul>
					<li>Set-Up (one-time): USD 99</li>
					<li>Maintenance: USD 9 / month</li>
					<li>Per SMS: <i>(per Twilio pricing)</i></li>
				</ul>
		</ul>
	<li><i><sup>*</sup>Reduced Profile Hosting (unserviced):  USD 0.02 per profile per month</i></li>
</ul>



<h3><u>Your account is LIVE</u> - you may begin on&bull;boarding profiles via Desktop + Mobile-Friendly App at any time.</h3>

<p>Here are your current account credentials:</p>

<h3><u>NEW PROFILE/ACCOUNT ON&bull;BOARDING (PUBLIC)</u>:</h3>

<ul>

	<p>This is the public link you give to new clients from whom you need to collect a KYC/AML-compliant profile:</p>
	<ul>
		https://". $_XXXXX_account_name_clean .".". $_SESSION['template']['company']['domain'] ."
	</ul>
	
	<br>
	<li><b>Your Desktop On&bull;Boarding configuration currently includes:</b></li>

	<ul>
	
		<li>Standard On&bull;Boarding TIERS:</li>

		<ul>
		
			<li><i>Individual Account</i></li>
			<li><i>Corporate Account</i></li>
			<li><i>Corporate Partner</i></li>
			<li><i>HR/Employee</i></li>
		
		</ul>
	
		<li>EMAIL-verification <span style='color:#48752C; font-weight:bold;'>(ON)</span></li>
		<li>SMS-verification <span style='color:#8C2623; font-weight:bold;'>(OFF)</span></li>
		<li>Face-biometrically-verified \"selfie\" <span style='color:#48752C; font-weight:bold;'>(ON)</span></li>
		<li>Face-biometrically-verified \"Photo ID\" <span style='color:#48752C; font-weight:bold;'>(ON)</span></li>
		<li>On-Screen Signature  <span style='color:#8C2623; font-weight:bold;'>(OFF)</span></li>
		<li>Supporting Personal Documents <i>(when applicable)</i></li>
		<li>CV/Resume Upload <i>(when applicable)</i></li>
		<li>Supporting Business Documents <i>(when applicable)</i></li>
		
		<br>
		NOTE:  <i>TIERS can be quickly personalized to collect nearly unlimited credentials -- per your needs.</i>
	
	</ul>

	
	<br>
	<li><b>SIMPLE iFRAME INTEGRATION (optional):</b></li>
	
	<ul>
	
		<li>https://". $_XXXXX_account_name_clean .".". $_SESSION['template']['company']['domain'] ."/iframe.php</li>
	
	</ul>

</ul>





<h3><u>ADMINISTRATIVE BACK-OFFICE (PRIVATE)</u>:</h3>

<ul>

	<li>This is where you review and manage your incoming / hosted profiles:</li>
	
	<ul>
	
		<p>https://". $_XXXXX_account_name_clean ."-admin.". $_SESSION['template']['company']['domain'] ."</p>
		
		<ul>
			<br>
			<li>USER: ". $_XXXXX_user_emailaddress ."</li>
			<li>PASS: ". $_XXXXX_user_password_display ."</li>
			
		</ul>
	</ul>
	
	<br>
	<li><b>KYC-AML Essential Service Selection:</b></li>
	
	<ul>
	
		<li>FREE On&bull;Boarding -> Manage Profiles, to view your incoming profiles.</li>
		<li>Monthly Global&bull;KYC -> Reports, to view your Global&bull;KYC targets (e.g., \"Donald Trump\")</li>
		<li>Monthly Biometric&bull;AML -> Reports, to view your  Biometric&bull;AML targets  (e.g., \"Donald Trump\")</li>
		<li>Monthly Negative&bull;NEWS -> Reports, to view your  Negative&bull;NEWS your  (e.g., \"Donald Trump\")</li>
		<br>... and in all cases, select \"Add Targets\" to add more targets to the services.
	
	</ul>
</ul>
<hr>
<br>

<p>Please let us know if you would like to schedule a formal platform walk-through and configuration with one of our Client Support Specialists</p>

<p>Otherwise, you may feel free to log-in / and use the account at any time.</p>

Thank you for choosing ". $_SESSION['template']['company']['name'] .", for your KYC/AML-compliance and profile on&bull;boarding solutions.

<p>We look forward to hearing from you!</p>

<h3>Team ". $_SESSION['template']['company']['name'] ."</h3>

<p>Client Support Email: ". $DISPLAY_from_email_address ."</p>

";


if(stristr($_SESSION['template']['company'],"OCULAR")) {
	
	$message =  $message . "
	<p>PS.  You may also reference our <b>Account Configuration Demo Video</b>, for additional insight:</p>

<ul>
	<li>https://www.youtube.com/watch?v=r1MsXi4VVqY</li>
</ul>
";
	
}




		$activate_unsubscribe = true;
		$_SESSION['intelitruth']['whitelabel_business_account_details']['url_to_whitelabel_icon_500x500'] = "//". $_SESSION['template']['company']['host_images'] . "/" . $_SESSION['template']['company']['logo_filename_email_top_left'];
		
		$GLOBAL_SET_ENTERPRISE_LOGO = 1;
		
		
		//quick_mailer($to,$subject,$message,$activate_unsubscribe=false,$mail_exchange="");
		
		$to_name = $_XXXXX_account_name_clean;
		$to_emailaddress = $_XXXXX_user_emailaddress;
		$subject = $subject; 
		$html_message = $message;
		$from_name = $_SESSION['template']['company']['name'];
		//$from_email_address = $_SESSION['template']['company']['enterprise_emailaddress_sales'];
		if(!$from_email_address) $from_email_address = $_SESSION['template']['company']['enterprise_emailaddress_customer_support'];
		if(!$from_email_address) $from_email_address = $_SESSION['template']['company']['emailaddress_support'];
		if(!$from_email_address) $from_email_address = $_SESSION['template']['company']['primary_contact_emailaddress'];
		mailer_intelitruth_registration($to_name,$to_emailaddress,$subject,$html_message,$from_name,$from_email_address);
	}
	
	
	### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### 
	
	
	
	
	
	
	
	
	
	
	
}










###############################################
#### PRICING.gate vs REGISTER.gate (PART 1/2)
if(
	($incoming_vars['account_name'])
	&& ($incoming_vars['business_name'])
) { // it's coming from pricing.gate
	
	
	//$parameters = "parameter_name=". . "parameter_value=". "whitelabel_business_account_hash=". $whitelabel_business_account_hash;
	//$onboarding_preferences_results = file_get_contents("https://gateway.intelitruth.com/onboarding_admin_preferences.gate?". $parameters);
	
	///pricing.gate
	$_XXXXX_business_name = $incoming_vars['business_name'];
	$_XXXXX_business_category = addslashes($incoming_vars['business_category']);
	
	$_XXXXX_client_service_inteli_login_status = $incoming_vars['client_service_inteli_login_status'];
	
	$_XXXXX_client_service_inteli_login_customers = $incoming_vars['client_service_inteli_login_customers'];
	
	$_XXXXX_client_service_biometric_aml = $incoming_vars['client_service_biometric_aml'];
	
	$_XXXXX_business_agenda = $incoming_vars['business_agenda'];
	
	$_XXXXX_associate_onboarding_storage_tier_key = $incoming_vars['associate_onboarding_storage_tier_key'];
	$_XXXXX_customers_onboarding_storage_tier_key = $incoming_vars['customers_onboarding_storage_tier_key'];
	$_XXXXX_customers_onboarding_storage_tier_key = $incoming_vars['employees_onboarding_storage_tier_key'];
	
	$_XXXXX_client_service_api = $incoming_vars['client_service_api'];
	$_XXXXX_client_service_agents = $incoming_vars['client_service_agents'];
	$_XXXXX_client_service_apps = $incoming_vars['client_service_apps'];
	$_XXXXX_client_service_desktop = $incoming_vars['client_service_desktop'];
	
	

	
	#############################################
	### APPS
	$_XXXXX_client_service_name = "APPS";
	$_XXXXX_client_service_id = "";
	$_XXXXX_hash = hash_me();
	$_XXXXX_whitelabel_business_account_hash = $whitelabel_business_account_hash;	
	$_XXXXX_datetime = datetime_v2();
	$_XXXXX_status = "OFF";	
	if(stristr($incoming_vars['client_service_apps'],"ON")) $_XXXXX_status = "ON";
	
	$tmp_sql = "INSERT INTO `client_services`
				(
					`client_service_id`
					, `hash`
					, `whitelabel_business_account_hash`
					, `client_service_name`
					, `status`
					, `datetime`
				) VALUES (
					'". $_XXXXX_client_service_id ."'
					,'". $_XXXXX_hash ."'
					,'". $_XXXXX_whitelabel_business_account_hash ."'
					,'". $_XXXXX_client_service_name ."'
					,'". $_XXXXX_status ."'
					,'". $_XXXXX_datetime ."'
				)";
				
	$insert_results = insertTHECASHIER($tmp_sql,"intelitruth");
	
	
	
	#############################################
	### API
	$_XXXXX_client_service_name = "API";
	$_XXXXX_client_service_id = "";
	$_XXXXX_hash = hash_me();
	$_XXXXX_whitelabel_business_account_hash = $whitelabel_business_account_hash;	
	$_XXXXX_datetime = datetime_v2();
	$_XXXXX_status = "OFF";	
	if(stristr($incoming_vars['client_service_api'],"ON")) $_XXXXX_status = "ON";
	
	$tmp_sql = "INSERT INTO `client_services`
				(
					`client_service_id`
					, `hash`
					, `whitelabel_business_account_hash`
					, `client_service_name`
					, `status`
					, `datetime`
				) VALUES (
					'". $_XXXXX_client_service_id ."'
					,'". $_XXXXX_hash ."'
					,'". $_XXXXX_whitelabel_business_account_hash ."'
					,'". $_XXXXX_client_service_name ."'
					,'". $_XXXXX_status ."'
					,'". $_XXXXX_datetime ."'
				)";
				
	$insert_results = insertTHECASHIER($tmp_sql,"intelitruth");
	
	
	
	#############################################
	### Biometric-AML
	$_XXXXX_client_service_name = "Biometric-AML";
	$_XXXXX_client_service_id = "";
	$_XXXXX_hash = hash_me();
	$_XXXXX_whitelabel_business_account_hash = $whitelabel_business_account_hash;	
	$_XXXXX_datetime = datetime_v2();
	$_XXXXX_status = "OFF";	
	if(stristr($incoming_vars['client_service_inteli_login_status'],"ON")) $_XXXXX_status = "ON";
	
	$tmp_sql = "INSERT INTO `client_services`
				(
					`client_service_id`
					, `hash`
					, `whitelabel_business_account_hash`
					, `client_service_name`
					, `status`
					, `datetime`
				) VALUES (
					'". $_XXXXX_client_service_id ."'
					,'". $_XXXXX_hash ."'
					,'". $_XXXXX_whitelabel_business_account_hash ."'
					,'". $_XXXXX_client_service_name ."'
					,'". $_XXXXX_status ."'
					,'". $_XXXXX_datetime ."'
				)";
				
	$insert_results = insertTHECASHIER($tmp_sql,"intelitruth");
	
	
	
	#############################################
	### Inteli-Login
	$_XXXXX_client_service_name = "Inteli-Login";
	$_XXXXX_client_service_id = "";
	$_XXXXX_hash = hash_me();
	$_XXXXX_whitelabel_business_account_hash = $whitelabel_business_account_hash;	
	$_XXXXX_datetime = datetime_v2();
	$_XXXXX_status = "OFF";	
	if(stristr($incoming_vars['client_service_biometric_aml'],"ON")) $_XXXXX_status = "ON";
	
	$tmp_sql = "INSERT INTO `client_services`
				(
					`client_service_id`
					, `hash`
					, `whitelabel_business_account_hash`
					, `client_service_name`
					, `status`
					, `datetime`
				) VALUES (
					'". $_XXXXX_client_service_id ."'
					,'". $_XXXXX_hash ."'
					,'". $_XXXXX_whitelabel_business_account_hash ."'
					,'". $_XXXXX_client_service_name ."'
					,'". $_XXXXX_status ."'
					,'". $_XXXXX_datetime ."'
				)";
				
	$insert_results = insertTHECASHIER($tmp_sql,"intelitruth");
	
	
	
	
	#############################################
	### Agents
	$_XXXXX_client_service_name = "Agents";
	$_XXXXX_client_service_id = "";
	$_XXXXX_hash = hash_me();
	$_XXXXX_whitelabel_business_account_hash = $whitelabel_business_account_hash;	
	$_XXXXX_datetime = datetime_v2();
	$_XXXXX_status = "OFF";	
	if(stristr($incoming_vars['client_service_agents'],"ON")) $_XXXXX_status = "ON";
	
	$tmp_sql = "INSERT INTO `client_services`
				(
					`client_service_id`
					, `hash`
					, `whitelabel_business_account_hash`
					, `client_service_name`
					, `status`
					, `datetime`
				) VALUES (
					'". $_XXXXX_client_service_id ."'
					,'". $_XXXXX_hash ."'
					,'". $_XXXXX_whitelabel_business_account_hash ."'
					,'". $_XXXXX_client_service_name ."'
					,'". $_XXXXX_status ."'
					,'". $_XXXXX_datetime ."'
				)";
				
	$insert_results = insertTHECASHIER($tmp_sql,"intelitruth");
	



	#############################################
	### business agenda
	//$_XXXXX_client_service_name = "Agents";
	//$_XXXXX_client_service_id = "";
	//$_XXXXX_hash = hash_me();
	$_XXXXX_whitelabel_business_account_hash = $whitelabel_business_account_hash;
	//$_XXXXX_datetime = datetime_v2();
	//$_XXXXX_status = "OFF";	
	//if(stristr($incoming_vars['client_service_agents'],"ON")) $_XXXXX_status = "ON";
	
	if(!$_SESSION['intelitruth_pricing']['client_service_desktop']) $_SESSION['intelitruth_pricing']['client_service_desktop'] = "ON";
	$_XXXXX_intelitruth_service_document_collection_web = $_SESSION['intelitruth_pricing']['client_service_desktop'];
	
	if(!$_SESSION['intelitruth_pricing']['client_service_apps']) $_SESSION['intelitruth_pricing']['client_service_apps'] = "OFF";
	$_XXXXX_intelitruth_service_document_collection_mobile = $_SESSION['intelitruth_pricing']['client_service_apps'];
	
	if(!$_SESSION['intelitruth_pricing']['client_service_api']) $_SESSION['intelitruth_pricing']['client_service_api'] = "OFF";
	$_XXXXX_intelitruth_service_api = $_SESSION['intelitruth_pricing']['client_service_api'];
	
	if(!$_SESSION['intelitruth_pricing']['client_service_agents']) $_SESSION['intelitruth_pricing']['client_service_agents'] = "OFF";
	$_XXXXX_intelitruth_service_agent_tracking = $_SESSION['intelitruth_pricing']['client_service_agents'];
	
	if(!$_SESSION['intelitruth_pricing']['client_service_biometricaml']) $_SESSION['intelitruth_pricing']['client_service_biometricaml'] = "OFF";
	$_XXXXX_intelitruth_service_biometric_aml = $_SESSION['intelitruth_pricing']['client_service_biometricaml'];
	
	if(!$_SESSION['intelitruth_pricing']['client_service_intelilogin']) $_SESSION['intelitruth_pricing']['client_service_intelilogin'] = "OFF";
	$_XXXXX_intelitruth_service_login = $_SESSION['intelitruth_pricing']['client_service_intelilogin'];
	
	if(stristr($_SESSION['intelitruth_pricing']['aml_agenda'],"essential")) {
		$_XXXXX_intelitruth_service_aml_agenda = "Annual";
		
	} else if(stristr($_SESSION['intelitruth_pricing']['aml_agenda'],"smart")) {
		$_XXXXX_intelitruth_service_aml_agenda = "Quarterly";
		
	} else if(stristr($_SESSION['intelitruth_pricing']['aml_agenda'],"proactive")) {
		$_XXXXX_intelitruth_service_aml_agenda = "Monthly";
		
	} else {
		$_XXXXX_intelitruth_service_aml_agenda = "OFF";
	}
	
	
	$tmp_sql = "UPDATE accounts
				
				SET intelitruth_service_document_collection_web = '". $_XXXXX_intelitruth_service_document_collection_web ."'
				
				, intelitruth_service_document_collection_mobile = '". $_XXXXX_intelitruth_service_document_collection_mobile ."'
				
				, intelitruth_service_api = '". $_XXXXX_intelitruth_service_api ."'
				
				, intelitruth_service_agent_tracking = '". $_XXXXX_intelitruth_service_agent_tracking ."'
				
				, intelitruth_service_biometric_aml = '". $_XXXXX_intelitruth_service_biometric_aml ."'
				
				, intelitruth_service_aml_agenda = '". $_XXXXX_intelitruth_service_aml_agenda ."'
				
				, intelitruth_service_login = '". $_XXXXX_intelitruth_service_login ."'
				
		
				
				WHERE hash = '". $_XXXXX_whitelabel_business_account_hash ."'
				;";
				
				
	$insert_results = updateTHECASHIER($tmp_sql);
	
	/// shea
	if($master_config_sms_new_account_alert['shea'] == "ON") {
		$country_code="52";
		$mobile_number = "6242431652";
		$sms_message = "New ". $_SESSION['template']['company']['name'] ." Registration: ". $_XXXXX_business_name ." (". $_XXXXX_user_emailaddress .")";
		send_sms($country_code,$mobile_number,$sms_message);
	}
	
	/// pouya
	if($master_config_sms_new_account_alert['pouya'] == "ON") {
		$country_code="1";
		$mobile_number = "8582047384";
		$sms_message = "New ". $_SESSION['template']['company']['name'] ." Registration: ". $_XXXXX_business_name ." (". $_XXXXX_user_emailaddress .")";
		send_sms($country_code,$mobile_number,$sms_message);
	}
	
}













#### STOP: REGISTER A NEW WHITELABEL ACCOUNT....!
##############################################
##############################################








?>