function send_mail_process() { $message_info = ''; $email_data = $this->session->flashdata('mail_info'); $keppo_admin_email = $this->m_custom->web_setting_get('keppo_admin_email', 'set_desc'); $get_status = send_mail_simple($keppo_admin_email, 'Keppo Inquiry : ' . $email_data['subject'], '<br/>Name : ' . $email_data['name'] . '<br/>Email : ' . $email_data['email'] . '<br/>Phone : ' . $email_data['phone'] . '<br/>Message : ' . $email_data['message'], 'keppo_contact_us_send_email_success', 0); if ($get_status) { $message_info = add_message_info($message_info, 'Thank you! Success send your email inquiry to Keppo admin.'); } else { $message_info = add_message_info($message_info, 'Some error happen, system send email fail, sorry for this, please call us or manually send to ' . $keppo_admin_email); } $this->session->set_flashdata('message', $message_info); redirect('contact_us', 'refresh'); }
function create_user() { $controller = $this->uri->segment(2); $function_use_for = 'user/create_user'; if ($controller == 'create_user') { $this->data['title'] = "Create User"; if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin()) { redirect('user', 'refresh'); } } else { $this->data['title'] = "User Sign Up"; $function_use_for = 'user/register'; } $this->data['function_use_for'] = $function_use_for; $this->load->library('user_agent'); $hide_fb = 0; if ($this->agent->is_mobile('android') && $this->agent->is_browser('Chrome')) { $hide_fb = 1; } $this->data['hide_fb'] = $hide_fb; $tables = $this->config->item('tables', 'ion_auth'); if (isset($_POST) && !empty($_POST)) { $this->d_year = $_POST['year']; $this->d_month = $_POST['month']; $this->d_day = $_POST['day']; $_POST['dob'] = $this->d_year . '-' . $this->d_month . '-' . $this->d_day; } // validate form input $this->form_validation->set_rules('first_name', $this->lang->line('create_user_validation_fname_label'), 'required'); $this->form_validation->set_rules('last_name', $this->lang->line('create_user_validation_lname_label')); //$this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'required|valid_contact_number'); $this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'required'); $this->form_validation->set_rules('dob', $this->lang->line('create_user_validation_dob_label'), 'callback_date_check'); $this->form_validation->set_rules('gender_id', $this->lang->line('create_user_validation_gender_label'), 'callback_check_gender_id'); $this->form_validation->set_rules('race_id', $this->lang->line('create_user_validation_race_label'), 'callback_check_race_id'); $this->form_validation->set_rules('race_other', $this->lang->line('create_user_race_other_label')); $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'trim|required|valid_email|is_unique[' . $tables['users'] . '.email]'); $this->form_validation->set_rules('username', $this->lang->line('create_user_validation_username_label'), 'trim|required|is_unique[' . $tables['users'] . '.username]'); if ($this->strong_password == 1) { $this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|matches[password_confirm]|min_length[8]|callback_password_check'); } else { $this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]'); } $this->form_validation->set_rules('password_confirm', $this->lang->line('create_user_validation_password_confirm_label'), 'required'); $this->form_validation->set_rules('promo_code', $this->lang->line('create_user_promo_code_label2')); $this->form_validation->set_rules('accept_terms', '...', 'callback_accept_terms'); if ($this->form_validation->run() == true) { $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); //$phone = '+60'.$this->input->post('phone'); $phone = $this->input->post('phone'); $username = strtolower($this->input->post('username')); $email = strtolower($this->input->post('email')); $password = $this->input->post('password'); $race_other = $this->input->post('race_other'); $additional_data = array('first_name' => $first_name, 'last_name' => $last_name, 'phone' => $phone, 'us_birthday' => $this->input->post('dob'), 'us_age' => age_count($this->input->post('dob')), 'us_gender_id' => $this->input->post('gender_id'), 'us_race_id' => $this->input->post('race_id'), 'us_race_other' => $race_other, 'username' => $username, 'password_visible' => $password, 'main_group_id' => $this->main_group_id, 'us_promo_code_temp' => $this->input->post('promo_code')); } $group_ids = array($this->main_group_id); if ($this->form_validation->run() == true && $this->ion_auth->register($username, $password, $email, $additional_data, $group_ids)) { $this->session->set_flashdata('message', $this->ion_auth->messages()); $get_status = send_mail_simple($email, 'Your Keppo User Account Success Created', 'Name : ' . $first_name . ' ' . $last_name . '<br/>Contact Number : ' . $phone . '<br/>Username : '******'<br/>E-mail : ' . $email . '<br/>Password : '******'create_user_send_email_success'); if ($get_status) { redirect("user/login", 'refresh'); } else { $this->session->set_flashdata('message', $this->ion_auth->errors()); redirect("user/register", 'refresh'); } } else { $this->data['message'] = validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')); $this->data['username'] = array('name' => 'username', 'id' => 'username', 'type' => 'text', 'value' => $this->form_validation->set_value('username')); $this->data['first_name'] = array('name' => 'first_name', 'id' => 'first_name', 'type' => 'text', 'value' => $this->form_validation->set_value('first_name')); $this->data['last_name'] = array('name' => 'last_name', 'id' => 'last_name', 'type' => 'text', 'value' => $this->form_validation->set_value('last_name')); $this->data['email'] = array('name' => 'email', 'id' => 'email', 'type' => 'text', 'value' => $this->form_validation->set_value('email')); $this->data['day_list'] = generate_number_option(1, 31); $this->data['day'] = array('name' => 'day', 'id' => 'day'); $this->data['month_list'] = $this->ion_auth->get_static_option_list('month'); $this->data['month'] = array('name' => 'month', 'id' => 'month'); $this->data['year_list'] = generate_number_option(1930, 2010); $this->data['year'] = array('name' => 'year', 'id' => 'year'); //$this->data['gender_list'] = $this->ion_auth->get_static_option_list('gender'); $this->data['gender_list'] = $this->m_custom->get_static_option_array('gender', '0', 'Please Select'); $this->data['gender_id'] = array('name' => 'gender_id', 'id' => 'gender_id', 'value' => $this->form_validation->set_value('gender_id')); //$this->data['race_list'] = $this->ion_auth->get_static_option_list('race'); $this->data['race_list'] = $this->m_custom->get_static_option_array('race', '0', 'Please Select'); $this->data['race_id'] = array('name' => 'race_id', 'id' => 'race_id', 'onchange' => 'showraceother()', 'value' => $this->form_validation->set_value('race_id')); $this->data['race_other'] = array('name' => 'race_other', 'id' => 'race_other', 'type' => 'text', 'style' => 'display:none', 'value' => $this->form_validation->set_value('race_other')); $this->data['phone'] = array('name' => 'phone', 'id' => 'phone', 'type' => 'text', 'value' => $this->form_validation->set_value('phone'), 'class' => 'phone_blur'); $this->data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password', 'placeholder' => $this->config->item('password_example'), 'value' => $this->form_validation->set_value('password')); $this->data['password_confirm'] = array('name' => 'password_confirm', 'id' => 'password_confirm', 'type' => 'password', 'placeholder' => $this->config->item('password_example'), 'value' => $this->form_validation->set_value('password_confirm')); $this->data['promo_code'] = array('name' => 'promo_code', 'id' => 'promo_code', 'type' => 'text', 'value' => $this->form_validation->set_value('promo_code')); $meta = array(array('property' => 'og:type', 'content' => 'article'), array('property' => 'og:image', 'content' => base_url('image/logo-keppo-fb.png'))); $this->data['meta_fb'] = meta_fb($meta); $this->data['page_path_name'] = 'user/create_user'; $this->load->view('template/layout', $this->data); } }
function create_user() { $controller = $this->uri->segment(2); $function_use_for = 'merchant/create_user'; if ($controller == 'create_user') { $this->data['title'] = "Create Merchant"; if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin()) { redirect('merchant', 'refresh'); } } else { $this->data['title'] = "Merchant Sign Up"; $function_use_for = 'merchant/register'; } $this->data['function_use_for'] = $function_use_for; $tables = $this->config->item('tables', 'ion_auth'); if (isset($_POST) && !empty($_POST)) { $_POST['slug'] = generate_slug($_POST['company']); $slug = $_POST['slug']; } // validate form input $this->form_validation->set_rules('accept_terms', '...', 'callback_accept_terms'); $this->form_validation->set_rules('company_main', $this->lang->line('create_merchant_validation_company_main_label'), "trim|required|min_length[3]"); $this->form_validation->set_rules('me_ssm', $this->lang->line('create_merchant_validation_companyssm_label'), 'required'); $this->form_validation->set_rules('company', $this->lang->line('create_merchant_validation_company_label'), "trim|required|min_length[3]"); $this->form_validation->set_rules('slug', $this->lang->line('create_merchant_validation_company_label'), 'trim|is_unique[' . $tables['users'] . '.slug]'); $this->form_validation->set_rules('address', $this->lang->line('create_merchant_validation_address_label'), 'required'); $this->form_validation->set_rules('postcode', $this->lang->line('create_merchant_validation_postcode_label'), 'required|numeric'); $this->form_validation->set_rules('me_state_id', $this->lang->line('create_merchant_validation_state_label'), 'callback_check_state_id'); $this->form_validation->set_rules('me_country', $this->lang->line('create_merchant_validation_country_label'), 'required'); $this->form_validation->set_rules('me_category_id', $this->lang->line('create_merchant_category_label'), 'callback_check_main_category'); $this->form_validation->set_rules('me_sub_category_id', $this->lang->line('create_merchant_sub_category_label'), 'callback_check_sub_category'); //$this->form_validation->set_rules('phone', $this->lang->line('create_merchant_validation_phone_label'), 'required|valid_contact_number'); $this->form_validation->set_rules('phone', $this->lang->line('create_merchant_validation_phone_label')); $this->form_validation->set_rules('username', $this->lang->line('create_merchant_validation_username_label'), 'trim|required|is_unique[' . $tables['users'] . '.username]'); $this->form_validation->set_rules('email', $this->lang->line('create_merchant_validation_email_label'), 'trim|required|valid_email|is_unique[' . $tables['users'] . '.email]'); if ($this->strong_password == 1) { $this->form_validation->set_rules('password', $this->lang->line('create_merchant_validation_password_label'), 'required|matches[password_confirm]|min_length[8]|callback_password_check'); } else { $this->form_validation->set_rules('password', $this->lang->line('create_merchant_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]'); } $this->form_validation->set_rules('password_confirm', $this->lang->line('create_merchant_validation_password_confirm_label'), 'required'); if ($this->form_validation->run() == true) { //$username = strtolower($this->input->post('first_name')) . ' ' . strtolower($this->input->post('last_name')); $username = strtolower($this->input->post('username')); $email = strtolower($this->input->post('email')); $password = $this->input->post('password'); $company_main = $this->input->post('company_main'); $company = $this->input->post('company'); $me_ssm = $this->input->post('me_ssm'); $address = $this->input->post('address'); $postcode = $this->input->post('postcode'); $state = $this->input->post('me_state_id'); $country = $this->input->post('me_country'); //$phone = '+60' . $this->input->post('phone'); $phone = $this->input->post('phone'); //$me_is_halal = $this->input->post('me_is_halal') == NULL ? 0 : 1; $me_halal_way = $this->input->post('me_halal_way'); $additional_data = array('username' => $username, 'company_main' => $company_main, 'company' => $company, 'slug' => $slug, 'address' => $address, 'postcode' => $postcode, 'country' => $country, 'me_state_id' => $state, 'me_category_id' => $this->input->post('me_category_id'), 'me_sub_category_id' => $this->input->post('me_sub_category_id'), 'phone' => $phone, 'me_ssm' => $me_ssm, 'main_group_id' => $this->main_group_id, 'password_visible' => $password, 'me_halal_way' => $me_halal_way); } $group_ids = array($this->main_group_id); if ($this->form_validation->run() == true && $this->ion_auth->register($username, $password, $email, $additional_data, $group_ids)) { $this->session->set_flashdata('message', $this->ion_auth->messages()); $get_status = send_mail_simple($email, 'Keppo Merchant Account Success Created', 'Company Name : ' . $company_main . '<br/>Register No(SSM) : ' . $me_ssm . '<br/>Shop Name : ' . $company . '<br/>Company Address : ' . $address . '<br/>Contact Number : ' . $phone . '<br/>Username : '******'<br/>E-mail : ' . $email . '<br/>Password : '******'create_user_send_email_success', 1, 1); if ($get_status) { redirect("merchant/login", 'refresh'); } else { $this->session->set_flashdata('message', $this->ion_auth->errors()); redirect("merchant/register", 'refresh'); } } else { $this->data['message'] = validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')); $this->data['username'] = array('name' => 'username', 'id' => 'username', 'type' => 'text', 'value' => $this->form_validation->set_value('username')); $this->data['email'] = array('name' => 'email', 'id' => 'email', 'type' => 'text', 'value' => $this->form_validation->set_value('email')); $this->data['company_main'] = array('name' => 'company_main', 'id' => 'company_main', 'type' => 'text', 'value' => $this->form_validation->set_value('company_main')); $this->data['company'] = array('name' => 'company', 'id' => 'company', 'type' => 'text', 'value' => $this->form_validation->set_value('company')); $this->data['address'] = array('name' => 'address', 'id' => 'address', 'value' => $this->form_validation->set_value('address')); $this->data['postcode'] = array('name' => 'postcode', 'id' => 'postcode', 'type' => 'text', 'value' => $this->form_validation->set_value('postcode')); $this->data['state_list'] = $this->m_custom->get_static_option_array('state', '0', 'Please Select'); $this->data['me_state_id'] = array('name' => 'me_state_id', 'id' => 'me_state_id', 'value' => $this->form_validation->set_value('me_state_id')); $this->data['country_list'] = array('Malaysia' => 'Malaysia'); $this->data['me_country'] = array('name' => 'me_country', 'id' => 'me_country', 'value' => $this->form_validation->set_value('me_country')); $me_category_id = $this->form_validation->set_value('me_category_id') == '' ? '' : $this->form_validation->set_value('me_category_id'); $this->data['category_list'] = $this->m_custom->getCategoryList('0', 'Please Select'); $this->data['me_category_id'] = array('name' => 'me_category_id', 'id' => 'me_category_id', 'value' => $me_category_id, 'onChange' => "get_SubCategory()"); $this->data['sub_category_list'] = $this->m_custom->getSubCategoryList(NULL, NULL, $me_category_id); $this->data['me_sub_category_id'] = array('name' => 'me_sub_category_id', 'id' => 'me_sub_category_id', 'value' => $this->form_validation->set_value('me_sub_category_id')); $this->data['phone'] = array('name' => 'phone', 'id' => 'phone', 'type' => 'text', 'value' => $this->form_validation->set_value('phone'), 'class' => 'phone_blur'); $this->data['me_ssm'] = array('name' => 'me_ssm', 'id' => 'me_ssm', 'type' => 'text', 'value' => $this->form_validation->set_value('me_ssm')); $this->data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password', 'placeholder' => $this->config->item('password_example'), 'value' => $this->form_validation->set_value('password')); $this->data['password_confirm'] = array('name' => 'password_confirm', 'id' => 'password_confirm', 'type' => 'password', 'placeholder' => $this->config->item('password_example'), 'value' => $this->form_validation->set_value('password_confirm')); // $this->data['me_is_halal'] = array( // 'name' => 'me_is_halal', // 'id' => 'me_is_halal', // 'value' => '1', //Just to have some value, checkbox have to have value // ); $this->data['halal_way_list'] = $this->ion_auth->get_static_option_list('halal_way'); $this->data['me_halal_way'] = array('name' => 'me_halal_way', 'id' => 'me_halal_way'); $meta = array(array('property' => 'og:type', 'content' => 'article'), array('property' => 'og:image', 'content' => base_url('image/logo-keppo-fb.png'))); $this->data['meta_fb'] = meta_fb($meta); $this->data['page_path_name'] = 'merchant/create_user'; $this->load->view('template/layout', $this->data); } }
function send_mail_process() { $identity = $this->session->flashdata('mail_info'); $get_status = send_mail_simple($identity->email, 'Your Keppo Admin Account Login Info', 'Username:'******'<br/>Email:' . $identity->email . '<br/>Password:'******'forgot_password_send_email_success'); if ($get_status) { set_simple_message('Thank you!', 'An email will be sent to your registered email address.', "If you don't receive in the next 10 minutes, please check your spam folder and if you still haven't received it please try again...", 'admin/login', 'Go to Log In Page', 'all/simple_message'); } else { $this->session->set_flashdata('message', $this->ion_auth->errors()); redirect("admin/retrieve_password", 'refresh'); } }
function send_test_mail_process($to_email = 'wilkinwilly999', $to_email_domain = 'gmail.com', $to_subject = 'Test Mail', $to_message = 'Testing send email.') { $get_status = send_mail_simple($to_email . '@' . $to_email_domain, $to_subject, $to_message, '', 0); if ($get_status) { echo "Success Send Email"; } else { echo "Fail Send Email"; } }