private function dcms_save() { $time = time(); $user = User_helper::get_user(); $id = $this->input->post("uisc_id"); $status = $this->input->post("approval_status"); $uisc_type = $this->input->post("uisc_type"); $division = $this->input->post("division"); $zilla = $this->input->post("zilla"); $image = $this->input->post("user_image"); $upazilla = 0; $union = 0; $citycorporation = 0; $citycorporationward = 0; $municipal = 0; $municipalward = 0; $union_name = $this->input->post("union_name"); $city_corporation_name = $this->input->post("city_corporation_name"); $city_corporation_ward_name = $this->input->post("city_corporation_ward_name"); $municipal_name = $this->input->post("municipal_name"); $municipal_ward_name = $this->input->post("municipal_ward_name"); $entrepreneur_gender = $this->input->post("gender"); $uisc_center_name = ''; $ques_id = $this->input->post("ques_id"); $ques_ans = $this->input->post("ques_ans"); if ($uisc_type == $this->config->item('ONLINE_UNION_GROUP_ID')) { $upazilla = $this->input->post("upazilla"); $union = $this->input->post("union"); $serial = $this->Entrepreneur_approval_model->CountUnionServiceCenter($division, $zilla, $upazilla, $union); $number_of_user = $this->Entrepreneur_approval_model->Number_of_uisc_user($id); $user_id = $zilla . '-' . $upazilla . '-' . $union . '-' . str_pad($serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($number_of_user, 2, "0", STR_PAD_LEFT); //$uisc_center_name=$union_name." ".$this->lang->line('UNION_PARISHAD')." ".$this->lang->line('DIGITAL_CENTER')." - ".$serial; } elseif ($uisc_type == $this->config->item('ONLINE_CITY_CORPORATION_WORD_GROUP_ID')) { $citycorporation = $this->input->post("citycorporation"); $citycorporationward = $this->input->post("citycorporationward"); $serial = $this->Entrepreneur_approval_model->countCityServiceCenter($division, $zilla, $citycorporation, $citycorporationward); $number_of_user = $this->Entrepreneur_approval_model->Number_of_uisc_user($id); $user_id = $zilla . '-' . $citycorporation . '-' . $citycorporationward . '-' . str_pad($serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($number_of_user, 2, "0", STR_PAD_LEFT); //$uisc_center_name=$city_corporation_name." ".$city_corporation_ward_name." ".$this->lang->line('CITY_CORPORATION')." ".$this->lang->line('DIGITAL_CENTER')." - ".$serial; } elseif ($uisc_type == $this->config->item('ONLINE_MUNICIPAL_WORD_GROUP_ID')) { $municipal = $this->input->post("municipal"); $municipalward = $this->input->post("municipalward"); $serial = $this->Entrepreneur_approval_model->countMunicipalServiceCenter($division, $zilla, $municipal, $municipalward); $number_of_user = $this->Entrepreneur_approval_model->Number_of_uisc_user($id); $user_id = $zilla . '-' . $municipal . '-' . $municipalward . '-' . str_pad($serial, 2, "0", STR_PAD_LEFT) . '-' . str_pad($number_of_user, 2, "0", STR_PAD_LEFT); //$uisc_center_name=$municipal_name." ".$municipal_ward_name." ".$this->lang->line('MUNICIPALITY')." ".$this->lang->line('DIGITAL_CENTER')." - ".$serial; } if (!$this->check_validation()) { $ajax['status'] = false; $ajax['system_message'] = $this->message; $this->jsonReturn($ajax); } else { $uisc_info_update_data = array('status' => $status); //$entrepreneur_info_update_data = Array('user_id'=>$user_id); //$secretary_info_update_data = Array('user_id'=>$user_id); $user_data = array('username' => $user_id, 'password' => md5(md5($user_id)), 'user_group_id' => $this->config->item('UISC_GROUP_ID'), 'uisc_type' => $uisc_type, 'uisc_id' => $id, 'ques_id' => $ques_id, 'ques_ans' => $ques_ans, 'division' => $division, 'zilla' => $zilla, 'upazila' => $upazilla, 'unioun' => $union, 'citycorporation' => $citycorporation, 'citycorporationward' => $citycorporationward, 'municipal' => $municipal, 'municipalward' => $municipalward, 'gender' => $entrepreneur_gender, 'picture_name' => $image, 'create_by' => $user->id, 'create_date' => $time); if ($id > 0) { $uisc_info_update_data['update_by'] = $user->id; $uisc_info_update_data['update_date'] = $time; $this->db->trans_start(); //DB Transaction Handle START if ($status == 1) { $uisc_user_id = Query_helper::add($this->config->item('table_users'), $user_data); //$uisc_info_update_data['uisc_name']=$uisc_center_name; $entrepreneur_info_update_data['user_id'] = $uisc_user_id; $entrepreneur_info_update_data['update_by'] = $user->id; $entrepreneur_info_update_data['update_date'] = $time; $secretary_info_update_data['user_id'] = $uisc_user_id; $secretary_info_update_data['update_by'] = $user->id; $secretary_info_update_data['update_date'] = $time; $resources_info_update_data['user_id'] = $uisc_user_id; $resources_info_update_data['update_by'] = $user->id; $resources_info_update_data['update_date'] = $time; $device_info_update_data['user_id'] = $uisc_user_id; $device_info_update_data['update_by'] = $user->id; $device_info_update_data['update_date'] = $time; $center_location_info_update_data['user_id'] = $uisc_user_id; $center_location_info_update_data['update_by'] = $user->id; $center_location_info_update_data['update_date'] = $time; $education_info_update_data['user_id'] = $uisc_user_id; $education_info_update_data['update_by'] = $user->id; $education_info_update_data['update_date'] = $time; $electricity_info_update_data['user_id'] = $uisc_user_id; $electricity_info_update_data['update_by'] = $user->id; $electricity_info_update_data['update_date'] = $time; $investment_info_update_data['user_id'] = $uisc_user_id; $investment_info_update_data['update_by'] = $user->id; $investment_info_update_data['update_date'] = $time; $training_info_update_data['user_id'] = $uisc_user_id; $training_info_update_data['update_by'] = $user->id; $training_info_update_data['update_date'] = $time; Query_helper::update($this->config->item('table_uisc_infos'), $uisc_info_update_data, array("id = " . $id)); Query_helper::update($this->config->item('table_entrepreneur_infos'), $entrepreneur_info_update_data, array("uisc_id = " . $id)); Query_helper::update($this->config->item('table_secretary_infos'), $secretary_info_update_data, array("uisc_id = " . $id)); Query_helper::update($this->config->item('table_uisc_resources'), $resources_info_update_data, array("uisc_id = " . $id)); Query_helper::update($this->config->item('table_device_infos'), $device_info_update_data, array("uisc_id = " . $id)); Query_helper::update($this->config->item('table_center_location'), $center_location_info_update_data, array("uisc_id = " . $id)); Query_helper::update($this->config->item('table_entrepreneur_education'), $education_info_update_data, array("uisc_id = " . $id)); Query_helper::update($this->config->item('table_electricity'), $electricity_info_update_data, array("uisc_id = " . $id)); Query_helper::update($this->config->item('table_investment'), $investment_info_update_data, array("uisc_id = " . $id)); Query_helper::update($this->config->item('table_training'), $training_info_update_data, array("uisc_id = " . $id)); $user_detail_info = $this->Entrepreneur_approval_model->get_user_detail_info_from_entrepreneur($uisc_user_id, $id); $user_update_data['name_bn'] = $user_detail_info['entrepreneur_name']; $user_update_data['mobile'] = $user_detail_info['entrepreneur_mobile']; $user_update_data['email'] = $user_detail_info['entrepreneur_email']; $user_update_data['present_address'] = $user_detail_info['entrepreneur_address']; Query_helper::update($this->config->item('table_users'), $user_update_data, array("id = " . $uisc_user_id)); } elseif ($status == 2) { Query_helper::update($this->config->item('table_uisc_infos'), $uisc_info_update_data, array("id = " . $id)); } $this->db->trans_complete(); //DB Transaction Handle END if ($this->db->trans_status() === TRUE) { $ajax['status'] = true; if ($status == 1) { $subject = $this->lang->line('ADMIN_ENTREPRENEUR_APPROVED_SUBJECT_TITLE'); $msg = " প্রিয় উদ্যোক্তা আপনার রেজিষ্ট্রেশন অনুমোদন করা হয়েছে।\r\n আপনার ব্যবহারকারী নামঃ " . $user_id . " এবং পাসওয়ার্ডঃ " . $user_id; $from_email = $this->config->item('from_mail_address'); $to_email = $user_detail_info['entrepreneur_email']; $cc_email = $this->config->item('cc_mail_address_maraj'); User_helper::mail_send($from_email, $to_email, $cc_email, '', $subject, $msg); $ajax['system_message'] = $this->lang->line("MSG_SUCCESSFULLY_APPROVED"); } else { $ajax['system_message'] = $this->lang->line("MSG_SUCCESSFULLY_DENIED"); } $this->jsonReturn($ajax); } else { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL"); $this->jsonReturn($ajax); } } } }
private function system_save() { $user = User_helper::get_user(); $id = $this->input->post("id"); if ($id > 0) { if (!$this->permissions['edit']) { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS"); $this->jsonReturn($ajax); die; } } else { if (!$this->permissions['add']) { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS"); $this->jsonReturn($ajax); die; } } if (!$this->check_validation()) { $ajax['status'] = false; $ajax['system_message'] = $this->message; $this->jsonReturn($ajax); } else { $userDetail = array(); $userDetail['password'] = $this->input->post('password'); $userDetail['confirm_password'] = $this->input->post('confirm_password'); if ($id > 0) { if ($userDetail['password'] != "") { $actual_password = $userDetail['password']; $encryptPass = md5(md5($userDetail['password'])); unset($userDetail['password']); unset($userDetail['confirm_password']); $userDetail['password'] = $encryptPass; } else { unset($userDetail['password']); unset($userDetail['confirm_password']); } } else { $encryptPass = md5(md5($userDetail['password'])); unset($userDetail['password']); unset($userDetail['confirm_password']); $userDetail['password'] = $encryptPass; } if ($id > 0) { $userDetail['update_by'] = $user->id; $userDetail['update_date'] = time(); $this->db->trans_start(); //DB Transaction Handle START Query_helper::update($this->config->item('table_users'), $userDetail, array("id = " . $id)); $this->db->trans_complete(); //DB Transaction Handle END if ($this->db->trans_status() === TRUE) { // $this->load->library('email'); // $this->email->set_mailtype("html"); // $this->email->from('*****@*****.**'); // $this->email->to('*****@*****.**'); // $mail_body = $this->load->view('mail_all_applicant', $data, true); // $subject = "ইউজার আইডি ও পাসওয়ার্ড "; // $this->email->subject($subject); // $this->email->message($mail_body); // $email = $this->email->send(); // if ($email) { // $user_info = $this->test_model->email_sent('send', $user_infos['username'], $applicant_email); // } else { // $user_info = $this->test_model->email_sent('not send', $user_infos['username'], $applicant_email); // } // $this->email->print_debugger(); $this->message = $this->lang->line("MSG_UPDATE_SUCCESS"); $save_and_new = $this->input->post('system_save_new_status'); if ($save_and_new == 1) { $subject = $this->lang->line('ADMIN_PASSWORD_CHANGE_SUBJECT_TITLE'); $msg = "আপনার পাসওয়ার্ড পরিবর্তন করা হয়েছে। আপনার নতুন পাসওয়ার্ডঃ " . $actual_password; $from_email = $this->config->item('from_mail_address'); $to_email = $userDetail['email']; $cc_email = $from_email; User_helper::mail_send($from_email, $to_email, $cc_email, '', $subject, $msg); $this->system_edit(); } else { $this->system_edit(); } } else { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL"); $this->jsonReturn($ajax); } } else { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL"); $this->jsonReturn($ajax); } } }
private function dcms_save() { $user = User_helper::get_user(); $id = $this->input->post("id"); if ($id > 0) { if (!$this->permissions['edit']) { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS"); $this->jsonReturn($ajax); die; } } else { if (!$this->permissions['add']) { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS"); $this->jsonReturn($ajax); die; } } $userDetail = $this->input->post('user_detail'); if ($id > 0) { if ($userDetail['password'] != "") { $actual_password = $userDetail['password']; $encryptPass = md5(md5($userDetail['password'])); unset($userDetail['password']); unset($userDetail['confirm_password']); $userDetail['password'] = $encryptPass; } else { unset($userDetail['password']); unset($userDetail['confirm_password']); } if ($userDetail['ques_id'] == '') { unset($userDetail['ques_id']); unset($userDetail['ques_ans']); } } if ($id > 0) { $userDetail['update_by'] = $user->id; $userDetail['update_date'] = time(); $this->db->trans_start(); //DB Transaction Handle START Query_helper::update($this->config->item('table_users'), $userDetail, array("id = " . $id)); // Mail Function $this->db->trans_complete(); //DB Transaction Handle END if ($this->db->trans_status() === TRUE) { $this->message = $this->lang->line("MSG_UPDATE_SUCCESS"); $save_and_new = $this->input->post('system_save_new_status'); if ($save_and_new == 1) { $subject = $this->lang->line('ADMIN_PASSWORD_CHANGE_SUBJECT_TITLE'); $msg = "প্রিয় উদ্যোক্তা আপনার পাসওয়ার্ড পরিবর্তন করা হয়েছে। আপনার নতুন পাসওয়ার্ডঃ " . $actual_password; $from_email = $this->config->item('from_mail_address'); $to_email = $userDetail['email']; $cc_email = $from_email; User_helper::mail_send($from_email, $to_email, $cc_email, '', $subject, $msg); $this->dcms_list(); } else { $this->dcms_list(); } } else { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL"); $this->jsonReturn($ajax); } } else { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL"); $this->jsonReturn($ajax); } }
function send_mail() { $msg = "First line of text\nSecond line of text"; $msg = wordwrap($msg, 70); $user = User_helper::mail_send('*****@*****.**', '*****@*****.**', '', '', 'user password', $msg); echo $user; // the message // use wordwrap() if lines are longer than 70 characters // send email //mail("*****@*****.**","My subject",$msg); }
private function dcms_save() { $user = User_helper::get_user(); $id = $this->input->post("id"); $status = $this->input->post("approval_status"); if (!$this->check_validation()) { $ajax['status'] = false; $ajax['system_message'] = $this->message; $this->jsonReturn($ajax); } else { $user_data = array('status' => $status); $user_data['update_by'] = $user->id; $user_data['update_date'] = time(); if ($id > 0) { $this->db->trans_start(); //DB Transaction Handle START Query_helper::update($this->config->item('table_users'), $user_data, array("id = " . $id)); $entrepreneur = Query_helper::get_info($this->config->item('table_entrepreneur_infos'), array('entrepreneur_email'), array('user_id = ' . $id), 1); $user = Query_helper::get_info($this->config->item('table_users'), array('username'), array('id = ' . $id), 1); $this->db->trans_complete(); //DB Transaction Handle END if ($this->db->trans_status() === TRUE) { $ajax['status'] = true; if ($status == 1) { $subject = $this->lang->line('ADMIN_ENTREPRENEUR_APPROVED_SUBJECT_TITLE'); $msg = " প্রিয় উদ্যোক্তা আপনার রেজিষ্ট্রেশন অনুমোদন করা হয়েছে।\r\n আপনার ব্যবহারকারী নামঃ " . $user['username'] . " এবং পাসওয়ার্ডঃ " . $user['username']; $from_email = $this->config->item('from_mail_address'); $to_email = $entrepreneur['entrepreneur_email']; $cc_email = $this->config->item('cc_mail_address_maraj'); User_helper::mail_send($from_email, $to_email, $cc_email, '', $subject, $msg); $ajax['system_message'] = $this->lang->line("MSG_SUCCESSFULLY_APPROVED"); } else { $ajax['system_message'] = $this->lang->line("MSG_SUCCESSFULLY_DENIED"); } $this->jsonReturn($ajax); } else { $ajax['status'] = false; $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL"); $this->jsonReturn($ajax); } } } }