function save() { $array_data = $_POST; if (isset($array_data['idincidencia'])) { //Obtengo el detalla de la incidencia antes de guardar $incidencia = $this->incidencia_model->get_incidencias($array_data['idincidencia']); //Guardo la incidencia $this->incidencia_model->nueva_incidencia($array_data); //Obtengo el detalle de la incidencia, con los nuevos datos guardados. $email = $this->incidencia_model->get_incidencias($array_data['idincidencia']); if ($email[0]['idestado_incidencia'] !== $incidencia[0]['idestado_incidencia']) { $array_bitacora['idvia'] = 1; $array_bitacora['idincidencia'] = $array_data['idincidencia']; $array_bitacora['idestado_incidencia'] = $email[0]['idestado_incidencia']; $array_bitacora['fecha_cambio_estado'] = date('Y-m-d h:i:s'); if ($email[0]['idestado_incidencia'] == 2) { $array_bitacora['tecnico_idusuario'] = $email[0]['tecnico_idusuario']; $bitacora = $this->incidencia_model->insert_bitacora($array_bitacora); } else { $bitacora = $this->incidencia_model->insert_bitacora($array_bitacora); } } if ($email[0]['idestado_incidencia'] == '3') { phpmailer($email, 3); } elseif ($email[0]['idestado_incidencia'] == '2') { $email_tecnico = $this->incidencia_model->get_email_tecnico($email[0]['tecnico_idusuario']); phpmailer($email, 2, $email_tecnico); } } else { if (isset($_FILES['userfile'])) { $data = $this->upload_file(); $array_data['archivos'] = $data['upload_data']['file_name']; } $id_incidencia = $this->incidencia_model->nueva_incidencia($array_data); $email = $this->incidencia_model->get_incidencias($id_incidencia); $array_bitacora['idvia'] = 1; $array_bitacora['idincidencia'] = $id_incidencia; $array_bitacora['idestado_incidencia'] = $email[0]['idestado_incidencia']; $array_bitacora['fecha_cambio_estado'] = date('Y-m-d h:i:s'); $bitacora = $this->incidencia_model->insert_bitacora($array_bitacora); phpmailer($email, 1); } // debug($id_incidencia); // debug($array_bitacora); redirect('Admin/incidencias_all'); // debug($_POST); }
if ($city_zip != $city_zip_fields[$_POST['city_zip']]) { //若縣市兩階名稱不相同, 才加上第二階的名稱, ex: 嘉義市嘉義市 $city_zip .= $city_zip_fields[$_POST['city_zip']]; } $mail_body = str_replace('<{$city_zip}>', $city_zip, $mail_body); $mail_body = str_replace('<{$zip}>', $_POST['zip'], $mail_body); $mail_body = str_replace('<{$address}>', $_POST['address'], $mail_body); $mail_body = str_replace('<{$email}>', $_POST['email'], $mail_body); $mail_body = str_replace('<{$message}>', $_POST['message'], $mail_body); $mail_body = str_replace('<{$create_time}>', $create_time, $mail_body); //系統參數 參數合成 $mail_body = str_replace('<{$website_name}>', $website_name, $mail_body); $mail_body = str_replace('<{$service_name}>', $service_name, $mail_body); $mail_body = str_replace('<{$service_email}>', $service_email, $mail_body); $mail_body = str_replace('<{$service_phone}>', $service_phone, $mail_body); $mail_body = str_replace('<{$homepage_url}>', $absolute_homepage_url, $mail_body); $to = array($receiver_email => $receiver_name); //$options['is_html'] = ture; $options['add_bcc'] = array("*****@*****.**" => "Honga"); //使用phpmailer發信 include_once $includes_path . "phpmailer.inc.php"; $mail_result = phpmailer($to, $mail_subject, $mail_body, $options); //回傳資料 //$value['name'] = $_POST['name']; } } //結果輸出--------------------------------------------------------------------- //輸出json, 回傳給ajaxfileupload.js $result = array('error' => $error, 'msg' => $msg, 'value' => $value); echo json_encode($result); exit;
function correo() { phpmailer(); }