function create_member_site() { $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'User Name', 'required|is_unique[user.username]'); $this->form_validation->set_rules('password', 'Password', 'required|matches[password_confirm]'); $this->form_validation->set_rules('password_confirm', 'Password Confirmation', 'required'); $this->form_validation->set_rules('create_email', 'Email Address', 'trim|required|valid_email|is_unique[user.primary_email]|matches[create_email_confirm]'); $this->form_validation->set_rules('create_email_confirm', 'Email Address Confirmation', 'required'); $this->form_validation->set_message('is_unique', 'The %s is already taken! Please choose another.'); $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">×</a><strong>', '</strong></div>'); if ($this->form_validation->run()) { $email = $this->input->post('create_email'); if (valid_email($email)) { $get_admin_detail = get_admin_detail(); $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; $config['mailtype'] = 'html'; $config['priority'] = 1; $this->email->initialize($config); $this->email->from($get_admin_detail['email'], $get_admin_detail['name']); $this->email->to($email); $this->email->set_mailtype("html"); $this->email->subject('StacksClassifieds.com new account:' . $email); $mail_data['url'] = site_url() . 'affiliate/affiliate_confirm/' . base64url_encode($email); $mail_data['email'] = $email; $message = $this->load->view('mail_templates/affiliate_confirmation_user', $mail_data, true); $this->email->message($message); if (!$this->email->send()) { $msgadd = "<strong>E-mail not sent </strong>"; $data['flash_message'] = TRUE; $this->session->set_flashdata('flash_class', 'alert-error'); $this->session->set_flashdata('flash_message', $msgadd); redirect('affiliate/affiliate_singup_user'); } else { $affiliate_number = affiliate_number(); $pass = $this->input->post('password'); $data_to_store = array('username' => $this->input->post('username'), 'password' => md5($pass), 'firstname' => $this->input->post('username'), 'primary_email' => $email, 'type_of_membership' => 'Affilite', 'type' => $this->input->post('type'), 'affiliate_number' => $affiliate_number, 'status' => 'Inactive'); if ($this->user_model->store_user($data_to_store)) { $data['flash_message'] = TRUE; $this->session->set_flashdata('flash_class', 'alert-success'); $this->session->set_flashdata('flash_message', '<strong>Well done!</strong> We have sent you a link to confirm your Account.'); redirect('home'); } else { $data['flash_message'] = TRUE; $this->session->set_flashdata('flash_class', 'alert-error'); $this->session->set_flashdata('flash_message', '<strong>Oh snap!</strong> change a few things up and try submitting again.'); redirect('affiliate/affiliate_singup_user'); } } } } else { $this->session->set_flashdata('validation_error_messages', validation_errors()); redirect('affiliate/affiliate_singup_user'); } }
function affiliate_number_account() { $user_id = $this->uri->segment(3); $whereStr = " AND user_id={$user_id}"; $affi_number = $this->common_model->getFieldData('user', 'affiliate_number', $whereStr); if (!empty($affi_number)) { redirect("signin/signin_user/{$user_id}/affiliate"); } else { $affiliate_number = affiliate_number(); $data_store = array('affiliate_number' => $affiliate_number, 'type' => 'affiliate'); $this->common_model->update_by_field('user', 'user_id', $user_id, $data_store); redirect("signin/signin_user/{$user_id}/affiliate"); } }