function send_link($username, $stored_mail, $code) { global $mailsender, $website, $sendername; if (enviarEmail($sendername, $mailsender, $stored_mail, "Please confirm", "Click Here {$website}/resetcode.php?code={$code}", $tipoEmail = "text/plain")) { return true; } else { return false; } }
public function process(Vtiger_Request $request) { global $log, $adb, $moduleName; $currentUserModel = Users_Record_Model::getCurrentUserModel(); $request->set('assigned_user_id', $currentUserModel->getId()); $request->set('userid', $currentUserModel->getId()); $recordModel = $this->saveRecord($request); $fieldModelList = $recordModel->getModule()->getFields(); $result = array(); foreach ($fieldModelList as $fieldName => $fieldModel) { $fieldValue = $recordModel->get($fieldName); $result[$fieldName] = array('value' => $fieldValue, 'display_value' => $fieldModel->getDisplayValue($fieldValue)); } $result['id'] = $recordModel->getId(); $result['_recordLabel'] = $recordModel->getName(); $result['_recordId'] = $recordModel->getId(); //modify by jmangarret 11jun2015 Enviar email $idCaso = $request->get("related_to"); $userid = $request->get("userid"); $comment = $request->get("commentcontent"); $query = $adb->pquery("select smcreatorid, smownerid from vtiger_crmentity where setype='HelpDesk' and crmid = ? ", array($idCaso)); $row = $adb->fetchByAssoc($query); $idowner = $row['smownerid']; $idcreator = $row['smcreatorid']; if ($userid == $idowner) { $userid = $idcreator; } else { $userid = $idowner; } $query = $adb->pquery("select * from vtiger_troubletickets where ticketid = ? ", array($idCaso)); $row = $adb->fetchByAssoc($query); $title = $row['title']; //Para Validar si es un comentario de un caso $ticket = $row['ticket_no']; //Para Validar si es un comentario de un caso if ($title && $idowner != $idcreator) { $query = $adb->pquery("select * from vtiger_users where id = ? ", array($userid)); $row = $adb->fetchByAssoc($query); $email = $row["email1"]; $nombre = $row["first_name"]; $asunto = "Informacion"; $mensaje = " \n\t\t\t\t<html> \n\t\t\t\t<head> \n\t\t\t\t<title>Info - Tu Agencia 24</title> \n\t\t\t\t</head> \n\t\t\t\t<body> \n\t\t\t\t<p>" . $nombre . ",</p>\n\t\t\t\t<p>El siguiente caso ha sido comentado:</p>\n\t\t\t\t<p><b>Nro. Ticket: </b>" . $ticket . "</p>\n\t\t\t\t<p><b>Caso: </b>" . $title . "</p>\n\t\t\t\t<p><b>Comentario: </b>" . $comment . "</p>\n\t\t\t\t<BR><BR><BR>\n\t\t\t\t<i>\n\t\t\t\tGracias,\t\t\n\t\t\t\t<p>Equipo TuAgencia24.com</p>\n\t\t\t\t</i>\n\t\t\t\t</body> \n\t\t\t\t</html> "; enviarEmail($email, $asunto, $mensaje); } //Fin enviar email $response = new Vtiger_Response(); $response->setEmitType(Vtiger_Response::$EMIT_JSON); $response->setResult($result); $response->emit(); }
function addMensajeProyecto($idProyecto, $mensaje) { $con = mysqli_connect(DBhost, DBuser, DBpassword, DATABASE); $json = array(); mysqli_set_charset($con, "UTF-8"); $mensaje = mysqli_real_escape_string($con, $mensaje); $result = mysqli_query($con, "select * from proyecto_alumno_profesor where IDProyecto={$idProyecto}"); $datos = mysqli_fetch_array($result); $idProfesor = $datos['IDProfesor']; $idAlumno = $datos['IDAlumno']; if (mysqli_query($con, "insert into observaciones values(default, '{$mensaje}', {$idProyecto}, {$idAlumno}, 1, now());")) { $json['warning'] = 0; } else { $json['warning'] = 1; } echo json_encode($json); $razon = "Nuevo mensaje de proyecto"; $body = "Se ha añadido un nuevo mensaje a tu proyecto, revísalo."; $proyecto = $idProyecto; $whoSend = 0; enviarEmail($razon, $body, $proyecto, $whoSend); $razon = "Nuevo mensaje de proyecto"; $body = "Se ha añadido un nuevo mensaje a tu proyecto, revísalo."; $proyecto = $idProyecto; $whoSend = 1; enviarEmail($razon, $body, $proyecto, $whoSend); }
include '../../config/config.php'; $denuncias = $_POST['denuncia_true']; $direcciones = $_POST['direcciones_destino']; $descripcion = $_POST['descripcion']; if (!empty($denuncias) && !empty($direcciones)) { //actualizar estatus de la denuncia obtenerDenuncias($denuncias); //buscar datos de la denuncia list($resultado, $motivos, $archivos) = obtenerDatosDenuncia($denuncias); //obtener emails de direcciones $emailsArray = obtenerCorreosDirecciones($direcciones); insertAsignacion($denuncias, $direcciones); //generar pdf //generarPdf(); //mandar emails if (enviarEmail($emailsArray, $descripcion, $resultado, $motivos, $archivos, $base_url)) { header('location:' . $base_url . 'App/mod_denuncias/denuncias.php?msjd=Se Envío la(s) denuncia(s) exitosamente&asg=1'); } else { header('location:' . $base_url . 'App/mod_denuncias/denuncias.php?msjd=Error al enviar&asg=1'); } } else { header('location:' . $base_url . 'App/mod_denuncias/denuncias.php?msjd=Error al enviar&asg=1'); } /* Nombre: obtenerDenuncias param * denuncias = array con los id de las denuncias */ function obtenerDenuncias($denuncias) { //$ids = transformarArray($denuncias,",");
<?php session_start(); include_once "../conectbd.php"; require_once '../funciones.php'; $link = Conectar(); $email = $_POST['email']; if ($email != "") { $resultado = $link->query(" SELECT * FROM Usuario WHERE email = '{$email}' "); if ($resultado->num_rows > 0) { $usuario = $resultado->fetch_assoc(); $linkTemporal = generarLinkTemporal($usuario['email'], $link); if ($linkTemporal) { enviarEmail($usuario['email'], generarMensaje($linkTemporal)); echo '<div class="alert alert-info"> Un correo ha sido enviado a su cuenta de email con las instrucciones para restablecer la contraseña </div>'; } else { echo 'No puedo generarse la accion'; } } else { echo '<div class="alert alert-warning"> No existe una cuenta asociada a ese correo. </div>'; } } else { echo "Debes introducir el email de la cuenta"; } function generarLinkTemporal($email, $link) { // Se genera una cadena para validar el cambio de contraseña $cadena = $email . rand(1, 9999999) . date('Y-m-d'); // Se cifra la cadena para que nadie mas tenga acceso a ella ni pueda averiguar como se ha formado $token = sha1($cadena); $result = $link->query("INSERT INTO tblreseteopass (email, token) VALUES('{$email}','{$token}')");
function save_module($module) { global $log, $adb, $current_user; //Inserting into Ticket Comment Table $this->insertIntoTicketCommentTable("vtiger_ticketcomments", $module); //Inserting into vtiger_attachments $this->insertIntoAttachment($this->id, $module); //service contract update $return_action = $_REQUEST['return_action']; $for_module = $_REQUEST['return_module']; $for_crmid = $_REQUEST['return_id']; if ($return_action && $for_module && $for_crmid) { if ($for_module == 'ServiceContracts') { $on_focus = CRMEntity::getInstance($for_module); $on_focus->save_related_module($for_module, $for_crmid, $module, $this->id); } } //// modified by jmangarret 21/04/2015 for Envio de Email //$var=json_encode($_REQUEST); //die($var); $userid = $current_user->id; $tarea = $_REQUEST['ticket_title']; $severity = vtranslate($_REQUEST['ticketseverities']); $descripcion = $_REQUEST["description"]; $prioridad = vtranslate($_REQUEST["ticketpriorities"]); $ticket_no = $_REQUEST["ticket_no"]; $ticketid = $this->id; $status = vtranslate($_REQUEST["ticketstatus"]); $solution = $_REQUEST["solution"]; $ticketcategories = $_REQUEST["ticketcategories"]; $query = $adb->pquery("select ticket_no from vtiger_troubletickets where ticketid = ? ", array($ticketid)); $row = $adb->fetchByAssoc($query); $ticket_no = $row['ticket_no']; $query = $adb->pquery("select smcreatorid, smownerid from vtiger_crmentity where setype='HelpDesk' and crmid = ? ", array($ticketid)); $row = $adb->fetchByAssoc($query); $idowner = $row['smownerid']; $idcreator = $row['smcreatorid']; if ($status == "Open") { $title = "Se te ha asignado una nuevo caso con los siguientes datos:"; $userid = $idowner; } if ($status == "Closed") { $title = "Se ha cerrado una tarea/caso con los siguientes datos:"; $userid = $idcreator; } if ($status == "Open" || $status == "Closed") { $query = $adb->pquery("select * from vtiger_users where id = ? ", array($userid)); $row = $adb->fetchByAssoc($query); $email = $row["email1"]; $nombre = $row["first_name"]; $asunto = "Informacion"; $mensaje = " \n\t\t\t<html> \n\t\t\t<head> \n\t\t\t<title>Info - Tu Agencia 24</title> \n\t\t\t</head> \n\t\t\t<body> \n\t\t\t<p>" . $nombre . ",</p>\n\t\t\t<p>" . $title . "</p>\n\t\t\t<p><b>Nro. Ticket: </b>" . $ticket_no . "</p>\n\t\t\t<p><b>Caso: </b>" . $tarea . "</p>\n\t\t\t<p><b>Descripcion: </b>" . $descripcion . "</p>\t\t\n\t\t\t<p><b>Prioridad: </b>" . $prioridad . "</p>\t\t\n\t\t\t<p><b>Importancia: </b>" . $severity . "</p>"; if ($status == "Closed") { $mensaje .= "<p><b>Solución: </b>" . $solution . "</p>"; } $mensaje .= "<BR><BR><BR>\n\t\t\t<i>\n\t\t\tGracias,\t\t\n\t\t\t<p>Equipo TuAgencia24.com</p>\n\t\t\t</i>\n\t\t\t</body> \n\t\t\t</html> "; $log->debug("Envio de email: " . $email . $mensaje); enviarEmail($email, $asunto, $mensaje); } //// Fin envio de email }
<?php require_once "admin/bibliotecas/PHPMailer/class.phpmailer.php"; require_once "admin/bibliotecas/PHPMailer/class.phpmailer.php"; require_once "admin/bibliotecas/PHPMailer/PHPMailerAutoload.php"; global $obrigatorio; if (isset($_POST['enviarContato'])) { $name = obrigatorio("name", $_POST['name']); $email = obrigatorio("email", $_POST['email']); $phone = obrigatorio("phone", $_POST['phone']); $city = obrigatorio("city", $_POST['city']); $assunto = obrigatorio("assunto", $_POST['assunto']); $msg = obrigatorio("msg", $_POST['msg']); if (!isset($obrigatorio)) { /* ENVIAR EMAIL */ if (enviarEmail($name, $email, $assunto, $phone, $msg)) { $mensagem = "Email enviado com sucesso!"; } else { $erro = "Erro ao enviar email"; } } else { $erro = $obrigatorio; } } ?> <div id="contato" class="txt"> <h1>Contato</h1> <form action="" method="post"> <label for="name">Nome:</label> <input type="text" name="name" />
<p> <strong>Enlace para restablecer tu contraseña</strong><br> <a href="' . $link . '"> Restablecer contraseña </a> </p> </body> </html>'; $cabeceras = 'MIME-Version: 1.0' . "\r\n"; $cabeceras .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $cabeceras .= 'From: Escuela <*****@*****.**>' . "\r\n"; mail($email, "Recuperar contraseña", $mensaje, $cabeceras); } $email = $_POST['email']; $respuesta = new stdClass(); if ($email != "") { $conexion = new mysqli('localhost', 'root', 'root', 'escuelapos'); $sql = " SELECT * FROM administrativo, alumno, profesor WHERE email = '{$email}' "; $resultado = $conexion->query($sql); if ($resultado->num_rows > 0) { $usuario = $resultado->fetch_assoc(); $linkTemporal = generarLinkTemporal($usuario['id'], $usuario['username']); if ($linkTemporal) { enviarEmail($email, $linkTemporal); $respuesta->mensaje = '<div class="alert alert-info"> Un correo ha sido enviado a su cuenta de email con las instrucciones para restablecer la contraseña </div>'; } } else { $respuesta->mensaje = '<div class="alert alert-warning"> No existe una cuenta asociada a ese correo. </div>'; } } else { $respuesta->mensaje = "Debes introducir el email de la cuenta"; } echo json_encode($respuesta);
public static function processarNotificacao($id_integracao, $notificationCode) { // Logar notificacao self::logarNotificacao($_POST); /* @var $integracao Integracao */ $integracao = Integracoes::getInstance()->getById($id_integracao); // Processar notificação if (strtolower($integracao->servico) == 'pagseguro') { $transacao = PagSeguroUtil::getTransacaoNotificacao($integracao, $notificationCode); if (get_class($transacao) == 'PagSeguroTransaction') { $return = Inscricoes::getInstance()->processarTransacaoPagSeguro($transacao); if (get_class($return) != 'Inscricao') { throw new Exception('PagSeguro - ' . $return); } } else { throw new Exception("Falha ao obter transação da notificação: {$notificationCode}"); } } elseif (strtolower($integracao->servico) == 'cielo') { // Me notificar pra eu entender a coisa $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; enviarEmail(TGO_EVENTO_ADMIN, 'Notificacao cielo', 'URL: ' . $actual_link . '<br><br>GET:<pre>' . print_r($_POST, true) . '</pre><br><br>POST<pre>:' . print_r($_POST, true) . '</pre>'); $transacao = $_POST; $return = Inscricoes::getInstance()->processarTransacaoCielo($transacao); if (get_class($return) != 'Inscricao') { throw new Exception('Cielo - ' . $return); } else { echo '<status>OK</status>'; } } }
include '../../../resources/select/funciones.php'; include '../../config/config.php'; $quejas = $_POST['quejas_true']; $direcciones = $_POST['direcciones_destino']; $descripcion = $_POST['descripcion']; //var_dump($quejas,'-',$direcciones); exit(); if (!empty($quejas) && !empty($direcciones)) { //actualizar estatus de la denuncia actualizarQuejas($quejas); //obtener emails de direcciones $emailsArray = obtenerCorreosDirecciones($direcciones); //buscar datos de las quejas list($resultado, $archivos) = obtenerDatosQuejas($quejas); insertAsignacion($quejas, $direcciones); //mandar emails if (enviarEmail($emailsArray, $descripcion, $resultado, $archivos)) { header('location:' . $base_url . 'App/mod_denuncias/quejas.php?msjd=Se envio la(s) queja(s) correctamente&asg=1'); } else { header('location:' . $base_url . 'App/mod_denuncias/quejas.php?msjd=Error al enviar&asg=1'); } //header('location:http://desarrollofiscalizacion.ivss.int/App/mod_denuncias/quejas.php?msjd=Envio exitoso&asg=1'); } else { header('location:' . $base_url . 'App/mod_denuncias/quejas.php?msjd=Debe seleccionar una queja y direcciones&asg=1'); } /* CAMBIAR DE ESTATUS LA QUEJA A ASIGNADA */ function actualizarQuejas($quejas) { //$ids = transformarArray($denuncias,","); $conex = DataBase::getInstance();
function save_module($module) { global $adb, $log; //Handling module specific save //Insert into seactivity rel if (isset($this->column_fields['parent_id']) && $this->column_fields['parent_id'] != '') { $this->insertIntoEntityTable("vtiger_seactivityrel", $module); } elseif ($this->column_fields['parent_id'] == '' && $insertion_mode == "edit") { $this->deleteRelation("vtiger_seactivityrel"); } //Insert into cntactivity rel if (isset($this->column_fields['contact_id']) && $this->column_fields['contact_id'] != '') { $this->insertIntoEntityTable('vtiger_cntactivityrel', $module); } elseif ($this->column_fields['contact_id'] == '' && $insertion_mode == "edit") { $this->deleteRelation('vtiger_cntactivityrel'); } $recordId = $this->id; if (isset($_REQUEST['contactidlist']) && $_REQUEST['contactidlist'] != '') { $adb->pquery('DELETE from vtiger_cntactivityrel WHERE activityid = ?', array($recordId)); $contactIdsList = explode(';', $_REQUEST['contactidlist']); $count = count($contactIdsList); $sql = 'INSERT INTO vtiger_cntactivityrel VALUES '; for ($i = 0; $i < $count; $i++) { $sql .= " ({$contactIdsList[$i]}, {$recordId})"; if ($i != $count - 1) { $sql .= ','; } } $adb->pquery($sql, array()); } $recur_type = ''; if (($recur_type == "--None--" || $recur_type == '') && $this->mode == "edit") { $sql = 'delete from vtiger_recurringevents where activityid=?'; $adb->pquery($sql, array($this->id)); } //Handling for recurring type //Insert into vtiger_recurring event table if (isset($this->column_fields['recurringtype']) && $this->column_fields['recurringtype'] != '' && $this->column_fields['recurringtype'] != '--None--') { $recur_type = trim($this->column_fields['recurringtype']); $recur_data = getrecurringObjValue(); if (is_object($recur_data)) { $this->insertIntoRecurringTable($recur_data); } } //Insert into vtiger_activity_remainder table $this->insertIntoReminderTable('vtiger_activity_reminder', $module, ""); //Handling for invitees $selected_users_string = $_REQUEST['inviteesid']; $invitees_array = explode(';', $selected_users_string); $this->insertIntoInviteeTable($module, $invitees_array); //Inserting into sales man activity rel $this->insertIntoSmActivityRel($module); $this->insertIntoActivityReminderPopup($module); /////// Modified by jmangarret 08/05/2015 ENVIO DE EMAIL /////// /* array(40) { ["picklistDependency"]=> string(2) "[]" ["module"]=> string(6) "Events" ["action"]=> string(4) "Save" ["record"]=> string(0) "" ["defaultCallDuration"]=> string(1) "5" ["defaultOtherEventDuration"]=> string(1) "5" ["subject"]=> string(6) "prueba" ["assigned_user_id"]=> string(1) "1" ["date_start"]=> string(10) "07-05-2015" ["time_start"]=> string(8) "12:54:00" ["due_date"]=> string(10) "07-05-2015" ["time_end"]=> string(8) "12:59:00" ["eventstatus"]=> string(7) "Planned" ["sendnotification"]=> string(1) "0" ["activitytype"]=> string(4) "Call" ["location"]=> string(0) "" ["taskpriority"]=> string(0) "" ["visibility"]=> string(6) "Public" ["followup_date_start"]=> string(10) "07-05-2015" ["followup_time_start"]=> string(8) "12:54 PM" ["remdays"]=> string(1) "0" ["remhrs"]=> string(1) "0" ["remmin"]=> string(1) "1" ["repeat_frequency"]=> string(1) "1" ["recurringtype"]=> string(8) "--None--" ["calendar_repeat_limit_date"]=> string(10) "08-05-2015" ["repeatMonth"]=> string(4) "date" ["repeatMonth_date"]=> string(1) "2" ["repeatMonth_daytype"]=> string(5) "first" ["repeatMonth_day"]=> string(1) "0" ["popupReferenceModule"]=> string(8) "Accounts" ["contact_id_display"]=> string(0) "" ["relatedContactInfo"]=> string(0) "" ["parent_id"]=> string(0) "" ["parent_id_display"]=> string(0) "" ["description"]=> string(0) "" ["contactidlist"]=> string(0) "" ["inviteesid"]=> string(0) "" ["set_reminder"]=> string(2) "No" ["currentid"]=> int(9389) } */ $userid = $_REQUEST['assigned_user_id']; $tarea = $_REQUEST['subject']; $notificar = $_REQUEST['sendnotification']; $descripcion = $_REQUEST["description"]; $fini = $_REQUEST["date_start"]; $ffin = $_REQUEST["due_date"]; $prioridad = $_REQUEST["taskpriority"]; $descripcion = $_REQUEST["description"]; $query = $adb->pquery("select * from vtiger_users where id = ? ", array($userid)); $row = $adb->fetchByAssoc($query); $email = $row["email1"]; $nombre = $row["first_name"]; $asunto = "Informacion"; $mensaje = " \n\t\t<html> \n\t\t<head> \n\t\t<title>Info - Tu Agencia 24</title> \n\t\t</head> \n\t\t<body> \n\t\t<p>" . $nombre . ",</p>\n\t\t<p>Se te ha asignado una nueva tarea con los siguientes datos:</p>\n\t\t<p><b>Tarea: </b>" . $tarea . "</p>\n\t\t<p><b>Fecha Inicio: </b>" . $fini . "</p>\n\t\t<p><b>Fecha Final: </b>" . $ffin . "</p>\t\t\n\t\t<p><b>Prioridad: </b>" . $prioridad . "</p>\t\t\n\t\t<p><b>Descripcion: </b>" . $descripcion . "</p>\t\t\n\t\t<BR><BR><BR>\n\t\t<i>\n\t\tGracias,\t\t\n\t\t<p>Equipo TuAgencia24.com</p>\n\t\t</i>\n\t\t</body> \n\t\t</html> "; if ($notificar) { enviarEmail($email, $asunto, $mensaje); } /////////////////////////////////////////////////// FIN ENVIO DE EMAIL ////////////////////////// }
$consulta_staff = "SELECT firstname, lastname, email FROM ost_staff WHERE staff_id = " . $staffid; $result = $mysqli->query($consulta_staff); $row = $result->fetch_array(); $asesor = $row['email']; //07/11/2016 RURIEPE - FIN //07/11/2016 RURIEPE - SE CONCANTENA EL NOMBRE Y APELLIDO EN UNA VRIABLE Y SE CREA UNA VARIABLE CON EL TEXTO PARA AGREGAR A LA TABLA THREAD $nombre_staff = $row['firstname'] . ' ' . $row['lastname']; $cuerpo = "Se realiza envio de terminos y condiciones al cliente: <b>" . $nombre_cliente . "</b><br> http://ticket.tuagencia24.com/upload/scp/terminoscliente/" . $filename; //07/11/2016 RURIEPE - FIN //07/11/2016 RURIEPE - SE CREA REGISTRO EN LA TABLA OST_THREAD PARA INDICAR Y DEJAS RASTRO DE LA CREACION Y ENVIO DE TERMINOS Y CONDICIONES A CLIENTE $ost_thread = $mysqli->query("INSERT INTO ost_ticket_thread\n (pid,\n ticket_id,\n staff_id,\n user_id,\n thread_type,\n poster,\n source,\n title,\n body,\n format,\n ip_address,\n created,updated)\n VALUES\n (0,\n {$id_ticket},\n {$staffid},\n 0,\n 'R',\n '{$nombre_staff}',\n ' ',\n 'Terminos y Condiciones',\n '{$cuerpo}',\n 'html',\n '{$ip_address}',\n '{$fecha_actual}',\n '0000-00-00 00:00:00');"); //07/11/2016 RURIEPE - FIN //18/11/2016 RURIEPE -ENVIO DE CORREO ELECTRONICO //19/10/2016 RURIEPE - SE INCLUYE ARCHIVO enviar_email.php PARA CAPTURAR EL VALOR DE LA VRAIBLE VALIDACION PARA REALILZAR EL ENVIO DEL CORREO $_REQUEST['filename']; include_once '../include/PHPMailer/enviar_email.php'; //19/10/2016 RURIEPE - VARIABLES PARA EL ENVIO DE CORREO ELECTRONICO $asunto = "Terminos y Condiciones Tu Agencia 24"; $mensaje = "<div style='font-size:12pt; text-align:justify;'>Estimado: <b>" . $nombre_cliente . "</b><br><br> En el siguiente correo usted podra realizar la lectura de los terminos y condiciones generales de TuAgencia24. Su respuesta debe ser enviada mediante la respuesta de este correo.<br><br> Sin mas que agregar, quedamos atentos sus a dudas e inquitudes.<br><br></div>"; $correo = "*****@*****.**"; $responder_a = array(array('correo' => $asesor, 'nombre_correo' => $nombre_staff), array('correo' => '*****@*****.**', 'nombre_correo' => 'Tu Agencia 24')); //19/10/2016 RURIEPE - LLAMADO DE FUNCION Y ENVIO DE LOS VALORES POR PARAMETRO, PARA REALILZAR EL ENVIO DEL CORREO MEDIANTE PHPMAILER $envio = enviarEmail($correo_cliente, $asunto, $mensaje, $responder_a); //18/11/2016 RURIEPE -FIN //13/10/2016 RURIEPE -FIN } else { //18/11/2016 RURIEPE - SE REALIZA ECHO PARA QUE SEA TOMADO EN EL SUCCESS echo "false"; } //17/11/2016 RURIEPE - FIN //17/11/2016 RURIEPE - FIN
function send_link($stored_mail, $password) { $message = "\n Your new password is: {$password}\n\n This change may take up to 5 minutes, please be patient\n\n Thanks"; global $mailsender, $sendername; if (enviarEmail($sendername, $mailsender, $stored_mail, $message, $tipoEmail = "text/plain")) { return true; } else { return false; } }
// Tipo técnico $conteudo_email = "Olá,<br /><br />\r\n\t\tO usuário " . $usuario['nomeCompleto'] . " fez um comentário sobre o chamado " . $chamado['titulo'] . ". <br /><br />\r\n\t\t\r\n\t\t<a href='{$url}'>Acompanhe clicando aqui.</a> (É preciso estar logado no sistema)\r\n\t\t\t<br />\r\n\t\t\t<br />\r\n\t\t\t<p>Atenciosamente,<br />\r\n\t\t\tEquipe IGSIS</p>\r\n\t\t"; $subject = "O usuário " . $usuario['nomeCompleto'] . " fez um comentário sobre o chamado " . $chamado['titulo']; $evento = 0; $num_pedidos = -1; } if ($tipo01['tipo'] == '2') { // Tipo técnico $evento = $chamado['idEvento']; $sql_pedidos = "SELECT * FROM igsis_pedido_contratacao WHERE publicado = '1' AND idEvento = '{$evento}'"; $query_pedidos = mysqli_query($con, $sql_pedidos); $num_pedidos = mysqli_num_rows($query_pedidos); $conteudo_email = "Olá,<br /><br />\r\n\t\t\tO usuário " . $usuario['nomeCompleto'] . " fez um comentário sobre o chamado " . $tipo01['chamado'] . " - " . $chamado['titulo'] . ". <br /><br />\r\n\t\t\r\n\t\t<a href='{$url}'>Acompanhe clicando aqui.</a> (É preciso estar logado no sistema)\r\n\t\t\t<br />\r\n\t\t\t<br />\r\n\t\t\t<p>Atenciosamente,<br />\r\n\t\t\tEquipe IGSIS</p>\r\n\t\t"; $subject = "O usuário " . $usuario['nomeCompleto'] . " fez um comentário sobre o chamado " . $chamado['titulo'] . " - " . $tipo01['chamado']; } if (enviarEmail($conteudo_email, $_SESSION['idInstituicao'], $subject, $evento, $num_pedidos)) { $mensagem = "Email enviado com sucesso. <br />"; } $mensagem .= "Comentário inserido com sucesso."; } else { $mensagem = "Erro"; } } $chamado = recuperaDados("igsis_chamado", $_GET['id'], "idChamado"); $tipo = recuperaDados("igsis_tipo_chamado", $chamado['tipo'], "idTipoChamado"); ?> <section id="list_items" class="home-section bg-white"> <div class="container"> <div class="row"> <div class="col-md-offset-2 col-md-8"> <div class="section-heading">
public static function getUrlPagSeguro(Evento $evento, Pessoa $pessoa, Inscricao $inscricao, $urlRetorno = null) { // Preparar pagamento PagSeguro $valor = number_format($inscricao->valor_inscricao, 2, '.', ''); $reference = $inscricao->id; if ($reference == null || $reference == 0) { throw new Exception("Referencia null"); } $nome = utf8_decode(trim($pessoa->nome)); $email = trim($pessoa->email); $celular = ltrim(PLib::only_numbers($pessoa->celular), '0'); if (strlen($celular) == 8) { $ddd = 32; } else { $ddd = substr($celular, 0, 2); $celular = substr($celular, 2); } if ($urlRetorno == null) { $urlRetorno = get_permalink() . "?inscricao=1&id_integracao=" . $evento->id_integracao_pagseguro; } // var_dump($ddd); // var_dump($celular); // die(); // Incluir PagSeguro include_once PLUGINPATH . '/vendor/PagSeguro/PagSeguroLibrary.php'; // Criar requisição PagSeguro $paymentRequest = new PagSeguroPaymentRequest(); $paymentRequest->setCurrency("BRL"); $paymentRequest->setRedirectURL($urlRetorno); $paymentRequest->addItem('0001', 'Inscrição para ' . $evento->titulo, 1, $valor); $paymentRequest->setReference($reference); $paymentRequest->setSender($nome, $email, $ddd, $celular); $paymentRequest->setRedirectUrl($urlRetorno); if ($reference == null || $reference < 1) { throw new Exception("Erro na inscrição. Falta de referencia para pagamento. Inscricao: " . $inscricao->id); } try { // Obter integração $integracao = $evento->getIntegracaoPagSeguro(); if ($integracao == null) { enviarEmail(TGO_EVENTO_ADMIN, 'Evento sem gateway informado', 'O evento ' . $evento->titulo . ' está recebendo dados de pagseguro, porém, se integração definida.'); } // Criar credenticias $credentials = new PagSeguroAccountCredentials($integracao->client, $integracao->token); $urlPagSeguro = $paymentRequest->register($credentials); return $urlPagSeguro; } catch (PagSeguroServiceException $e) { // "Desvendar" erros do pagseguro.. if (strpos($e->getMessage(), 'senderPhone') != false) { self::$erro = "O telefone informado ({$ddd}){$celular} não foi aceito pelo PagSeguro. Clique em voltar e informe um novo número."; } else { if (strpos($e->getMessage(), 'senderName') != false) { self::$erro = "O nome informado ({$nome}) não foi aceito pelo PagSeguro. Clique em voltar e informe corretamente."; } else { if (strpos($e->getMessage(), 'senderEmail') != false) { self::$erro = "O email informado ({$email}) não foi aceito pelo PagSeguro. Clique em voltar e informe corretamente."; } else { if (strpos($e->getMessage(), 'shipping') != false) { self::$erro = "O endereço informado não foi aceito pelo PagSeguro. Clique em voltar e informe corretamente."; } else { if (strpos($e->getMessage(), 'senderAreaCode') != false) { self::$erro = "O DDD do telefone deve ter apenas dois dígitos. Clique em voltar e informe corretamente."; } else { self::$erro = "Ocorreu um erro desconhecido no PagSeguro, o desenvolvedor foi avisado por email para rápida correção. Tente novamente em algumas horas."; $evento->organizador()->enviarEmail(TGO_EVENTO_ADMIN, 'Erro com PagSeguro 1', $e->getMessage() . '<br><br><br>post:<br>' . print_r($_POST, true) . '<br><br><br>pessoa:' . print_r($pessoa, true) . '<br><br><br>inscrição:' . print_r($inscricao, true) . '<br><br><br>exception:' . print_r($e, true) . '<br><br><br>paymentRequest:' . print_r($paymentRequest, true)); } } } } } if (self::$erro != null) { echo self::$erro; } throw new Exception($e); return false; } }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento sem título</title> </head> <?php @ini_set('display_errors', '1'); error_reporting(E_ALL); include "../funcoes/funcoesGerais.php"; include "../funcoes/funcoesConecta.php"; if (isset($_POST['assunto'])) { $conteudo_email = $_POST['corpo']; $instituicao = '5'; $subject = $_POST['assunto']; $email = "*****@*****.**"; $usuario = "marcioyonamine"; enviarEmail($conteudo_email, $instituicao, $subject, $email, $usuario); } ?> <body> <form action="?" method="post"><br /> <input type="text" name="assunto"/><br /> <textarea name="corpo"></textarea><br /> <input type="submit" value="Enviar" /><br /> </form> </body> </html>
function subirArchivo($idProyecto) { $fileName = $_SERVER['HTTP_X_FILE_NAME']; $contentLength = $_SERVER['CONTENT_LENGTH']; $path = '../files/'; file_put_contents($path . $fileName, file_get_contents("php://input")); $idUsuario = $_SESSION['id']; $con = mysqli_connect(DBhost, DBuser, DBpassword, DATABASE); $consulta = mysqli_query($con, "select * from proyecto_alumno_profesor where IDProyecto={$idProyecto} order by IDProyecto desc limit 1;"); $datos = mysqli_fetch_array($consulta); $idAlumno = $datos['IDAlumno']; mysqli_query($con, "insert into documentos values(default,'{$fileName}',{$idProyecto},{$idUsuario},1,now())"); mysqli_close($con); $razon = "Nuevo documento de proyecto"; $body = "Se ha subido un nuevo documento a su proyecto, revíselo"; $proyecto = $idProyecto; $whoSend = 1; enviarEmail($razon, $body, $proyecto, $whoSend); }
$cabeceras .= 'From: SARECA <*****@*****.**>' . "\r\n"; $submit = mail($email, 'Reiniciar contraseña', $mensaje, $cabeceras); return $submit; } $id_usuario = $_POST['usuario-modal']; if ($id_usuario != "") { $sql = "SELECT correo FROM usuario WHERE Id = '{$id_usuario}' "; $res = $conectar->query($sql); if ($res->num_rows > 0) { $usuario = $res->fetch_object(); $password = generaPass(); $encrypt_pass = md5($password); $sql = "UPDATE usuario SET Contrasena = '{$encrypt_pass}' WHERE Id = '{$id_usuario}'"; $conectar->query($sql); if ($conectar->affected_rows > 0) { $submit = enviarEmail($usuario->correo, $password); if ($submit) { $mensaje = ' <div class="alert alert-dismissible alert-info fadeInUp animated"> <button type="button" class="close" data-dismiss="alert"><span class="glyphicon glyphicon-remove-circle"></span></button> <strong>Un correo ha sido enviado a su cuenta de correo electronico con una nueva contraseña.</strong> </div>'; } else { $mensaje = ' <div class="alert alert-dismissible alert-warning fadeInUp animated"> <button type="button" class="close" data-dismiss="alert"><span class="glyphicon glyphicon-remove-circle"></span></button> <strong>No fue posible enviar el correo electronico con la nueva contraseña, por favor contacte al administrador del sistema.</strong> </div>'; } } else { $mensaje = '
function verificarLogin($user, $pass) { //El password obtenido se le aplica el crypt(md5) //Posteriormente se compara en el query $pass_c = sha1(md5($pass)); $q = "select * from Usuario where email='{$user}' and password='******'"; //obtenemos el link de la BD y ejecutamos la consulta $link = Conectar(); $result = $link->query($q); //Si el resultado obtenido no tiene nada if ($result->num_rows == 0) { $q = "select intentos, estado from Usuario where email='{$user}'"; $result = $link->query($q); if ($result->num_rows != 0) { $res = mysqli_fetch_assoc($result); //si estado es bloqueado //Muestra un error y redirige al index if ($res['estado'] == 'bloqueado') { echo 'El usuario esta bloqueado, se le ha enviado un email para restaurarlo'; } else { $intentos = $res['intentos']; $intentos = $intentos + 1; //Si es el tercer intento fallido, se bloquea el usuario //Muestra un error y redirige al index if ($intentos == 3) { $q = "UPDATE Usuario SET intentos='{$intentos}', estado='bloqueado' where email='{$user}'"; $result = $link->query($q); $linktemporal = generarLinkTemporal($user, $link); enviarEmail($user, generarMensaje($linktemporal)); echo 'El usuario ha sido bloqueado, se le ha enviado un email para restaurarlo'; } else { $q = "UPDATE Usuario SET intentos='{$intentos}' where email='{$user}'"; $result = $link->query($q); echo 'Usuario o Contrasenia Incorrecta'; } } } else { echo 'Usuario o Contrasenia Incorrecta'; } } else { $reg = mysqli_fetch_assoc($result); if ($reg['estado'] != 'bloqueado') { session_start(); $_SESSION["codSesion"] = guardarConexion($reg['email']); $_SESSION["useremail"] = $reg['email']; $_SESSION["username"] = $reg['nomApellidos']; $_SESSION["rol"] = $reg['rol']; //Poner a cero el numero de intentos $q = "UPDATE Usuario SET intentos='0' where email='{$user}'"; $result = $link->query($q); usuarioEstaOnline(); header("location:layout.php"); $link->close(); die; } else { echo '<script type="text/javascript"> alert("El usuario esta bloqueado."); window.location="layout.php" </script>'; } } }