function save_temp_company() { $this->load->model('email_handler', 'emailhandler'); # Merge roles array for ease of saving $_POST['roles'] = implode(',', $_POST['role']); #Insert temp company record $result1 = $this->db->query($this->Query_reader->get_query_by_code('insert_temp_company', $_POST)); #Send user email so that they can confirm their email $_POST['messageid'] = "AC" . strtotime('now'); $_POST['confirmationid'] = encryptValue("AC" . $this->db->insert_id()); $_POST['username'] = generate_user_details($this->db->insert_id(), 'username'); $_POST['password'] = generate_user_details($this->db->insert_id(), 'password'); $result2 = $this->db->query($this->Query_reader->get_query_by_code('update_temp_user_record', array_merge(array('userid' => $this->db->insert_id()), $_POST))); $response = $this->emailhandler->send_email(array('admin' => 'FROM**ACRAV Website Administration**' . SITE_ADMIN_MAILID, 'user' => 'TO**' . $_POST['useremailaddress']), $_POST, 'registration'); if ($response && $result1) { $ans = 'Y'; } else { $ans = 'N'; } redirect('/user/register/m/emailsent/ans/' . $ans, 'refresh'); exit; }
function process_form_data($urldata, $formdata, $action) { $query = ''; # Determine what to do with the form data based on the action if ($action == 'delete') { $query = $this->Query_reader->get_query_by_code('delete_user', array('user_id' => $urldata['user_id'])); } else { if ($action == 'save') { # Before saving this data, add slashes so that bad additions and quotes are 'neutralised' $formdata = clean_form_data($formdata); # User is editing if ($urldata['user_id'] !== FALSE) { $query = $this->Query_reader->get_query_by_code('update_user', array_merge(array('user_id' => $urldata['user_id']), $formdata)); } else { $previous_query_array = $this->Query_reader->get_row_as_array('pick_user_by_email', array('emailaddress' => $formdata['emailaddress'])); # User data doesnt exist if (count($previous_query_array) == 0) { $result = $this->db->query($this->Query_reader->get_query_by_code('insert_new_user_for_comp', $formdata)); //$result2 = $this->db->query($this->Query_reader->get_query_by_code('update_user_credentials', array_merge(array('userid'=>$this->db->insert_id()), $_POST))); if ($result) { #Send user email so that they can confirm their email $_POST['messageid'] = "AC" . strtotime('now'); $_POST['confirmationid'] = encryptValue("AC" . $this->db->insert_id()); $_POST['username'] = generate_user_details($this->db->insert_id(), 'username'); $_POST['password'] = generate_user_details($this->db->insert_id(), 'password'); $_POST['adminname'] = htmlentities($this->session->userdata('names')); //$result = $this->db->query($this->Query_reader->get_query_by_code('update_user_credentials', array_merge(array('userid'=>$this->db->insert_id()), $_POST))); // $this->Query_reader->get_query_by_code('update_user_credentials', array_merge(array('userid'=>$this->db->insert_id()), $_POST)); //$response = $this->emailhandler->send_email(array('admin'=>'FROM**ACRAV Website Administration**'.SITE_ADMIN_MAILID, //'user'=>'TO**'.$this->session->userdata('emailaddress').', '.$_POST['emailaddress'].', '.SITE_ADMIN_MAILID, //user'=>'CC**'.$this->session->userdata('emailaddress')), $_POST, 'newcompanyuser'); } $query = $this->Query_reader->get_query_by_code('insert_user', $formdata); } } } } //return $result; return $this->db->query($query); }
function save_temp_company() { # check if email exits $query = $this->db->get_where('temp_company_data', array('useremailaddress' => $_POST['useremailaddress']), 1, 0); if ($query->num_rows() == 1) { $data['msg'] .= "ERROR: The email was not sent. The email account is already in use try again."; $this->load->view('companyprofile/register', $data); } elseif ($query->num_rows() == 0) { $this->load->model('email_handler', 'emailhandler'); # Merge roles array for ease of saving $_POST['roles'] = implode(',', $_POST['role']); #Insert temp company record $result1 = $this->db->query($this->Query_reader->get_query_by_code('insert_temp_company', $_POST)); #Send user email so that they can confirm their email $_POST['messageid'] = "AC" . strtotime('now'); $_POST['confirmationid'] = encryptValue("AC" . $this->db->insert_id()); $_POST['username'] = generate_user_details($this->db->insert_id(), 'username'); $_POST['password'] = generate_user_details($this->db->insert_id(), 'password'); $result2 = $this->db->query($this->Query_reader->get_query_by_code('update_temp_user_record', array_merge(array('userid' => $this->db->insert_id()), $_POST))); $response = $this->emailhandler->send_email(array('admin' => 'FROM**ACRAV Website Administration**' . SITE_ADMIN_MAILID, 'user' => 'TO**' . $_POST['useremailaddress']), $_POST, 'registration'); } if ($response && $result1) { $ans = 'Y'; } else { $ans = 'N'; } redirect('/user/register/m/emailsent/ans/' . $ans, 'refresh'); exit; }