private function register_extra($user_id, $email, $password, $first_name) { //infusionsoft: $this->load->helper('infusionsoft/infusionsoft'); $infusionsoft_id = CreateInfusionsoftUser($first_name, $email, $password); $this->infusionsoft_model->insert_user_infusionsoft($user_id, $infusionsoft_id); }
/** * Infusionsoft Service for this controller. */ public function infusionsoft_create_login() { //this is the portal for infusionsoft campaign to communicate with, contactID, FirstName, LastName, Email, Password, Country, ZipCode, InfusionsoftEmail will be the post fields. //Written by Jifeng Sun at 30 July 2014 //Modified by Jifeng Sun at 08 August 2014 for additional email address if the email that doesn't contain anything. //Modified by Jifeng Sun at 11 August 2014 for bug fixes on previous change. //firstly to determine the password is empty or not $password = $this->input->post('Password', TRUE); $email = $this->input->post('Email', TRUE); $infusionsoft_email = $this->input->post('InfusionsoftEmail', TRUE); $country = $this->input->post('Country', TRUE); //Assign the rest post info to local variable $user_first_name = $this->input->post('FirstName', TRUE); $user_last_name = $this->input->post('LastName', TRUE); $user_infusionsoft_id = $this->input->post('contactID', TRUE); $user_zipcode = $this->input->post('ZipCode', TRUE); if ($password) { //already existed pre-defined password, assign it to local variable $user_password = $password; } else { //no pre-defined password, randomly generate one. $user_password = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'), 0, 10); } //Determine the email address is empty, if empty, will use InfusionsoftEmail instead. if ($email) { //already existed email $user_email = $email; } else { //no pre-defined email, use InfusionsoftEmail instead $user_email = $infusionsoft_email; } //Assign a default country short code for wrong country $user_country_id = "AU"; //Match Country from database to find out the short code. eg. Australia -> AU $countries = $this->user_model->get_all_countries(); foreach ($countries as $country_key => $country_value) { if ($country == $country_value['country']) { $user_country_id = $country_value['country_id']; break; } } //create user in database and lead the CreatePage info to step 1 $query_rem = "INSERT INTO `Users` (`email`, `password`, `name`, `surname`, `CreatePage`, `InfusionSoftId`, `country`, `zip`) VALUES ('" . mysql_real_escape_string($Email) . "', '" . mysql_real_escape_string($Password) . "', '" . mysql_real_escape_string($FirstName) . "', '" . mysql_real_escape_string($LastName) . "', '1','" . mysql_real_escape_string($contactID) . "', '" . mysql_real_escape_string($Country) . "', '" . mysql_real_escape_string($ZipCode) . "')"; mysql_query($query_rem, $db); if ($user_id = $this->flexi_auth->insert_user($user_email, FALSE, $user_password, FALSE, 3, TRUE)) { //do nothing } else { $user_id = $this->flexi_auth->get_users('uacc_id as user_id', array('uacc_email' => $user_email))->row()->user_id; } //Send back info to infusionsoft $this->load->helper('infusionsoft/infusionsoft'); CreateInfusionsoftUser($user_first_name, $user_email, $user_password, TRUE); $this->infusionsoft_model->insert_user_infusionsoft($user_id, $user_infusionsoft_id); }
//no pre-defined email, use InfusionsoftEmail instead $Email = $_POST["InfusionsoftEmail"]; } else { //already existed email $Email = $_POST["Email"]; } //Assign a default country short code for wrong country $Country = "AU"; //Match Country from database to find out the short code. eg. Australia -> AU $db = mysql_connect('localhost', 'stylefin_user', 'magnus'); mysql_select_db('stylefin_db', $db); $query_cnt = "SELECT `ccode`, `country` FROM `Countries` Order by `order`, `country`"; $result_cnt = mysql_query($query_cnt, $db) or error_handling(basename($_SERVER['PHP_SELF']) . ' - ' . mysql_error() . ' - ' . $query_cnt); while ($line_cnt = mysql_fetch_assoc($result_cnt)) { if ($line_cnt["country"] == $_POST["Country"]) { $Country = $line_cnt["ccode"]; break; } } //Assign the rest post info to local variable $FirstName = $_POST["FirstName"]; $LastName = $_POST["LastName"]; $contactID = $_POST["contactID"]; $ZipCode = $_POST["ZipCode"]; //create user in database and lead the CreatePage info to step 1 $query_rem = "INSERT INTO `Users` (`email`, `password`, `name`, `surname`, `CreatePage`, `InfusionSoftId`, `country`, `zip`) VALUES ('" . mysql_real_escape_string($Email) . "', '" . mysql_real_escape_string($Password) . "', '" . mysql_real_escape_string($FirstName) . "', '" . mysql_real_escape_string($LastName) . "', '1','" . mysql_real_escape_string($contactID) . "', '" . mysql_real_escape_string($Country) . "', '" . mysql_real_escape_string($ZipCode) . "')"; mysql_query($query_rem, $db); //Send back info to infusionsoft require_once 'infusionsoft.php'; CreateInfusionsoftUser($FirstName, $LastName, $Email, $Password, true);