Пример #1
0
function errorQuery($query)
{
    $array_error = sqlsrv_errors();
    if (count($array_error) != 0 && (ini_get('display_errors') == "On" || ini_get('display_errors') == 1)) {
        echo '<div class="error" align="center">';
    }
    foreach ($array_error as $error) {
        // Registra los errores en un archivo log
        registra_log(str_replace('/' . CARPETA_RAIZ . '?', '', $_SERVER['REQUEST_URI']), 'SQLSTATE: ' . $error['SQLSTATE'] . ', code: ' . $error['code'] . ', message: ' . str_replace('[Microsoft][SQL Server Native Client 10.0][SQL Server]', '', $error['message']) . ', Query: ' . $query);
        // Si esta deshabilitado mostrar errores de php, tampoco debemos mostrar los errores
        if (ini_get('display_errors') == "On" || ini_get('display_errors') == 1) {
            echo '<strong><u>SQLSTATE</u>: </strong> ' . $error['SQLSTATE'] . ', <strong><u>CODE</u>: </strong> ' . $error['code'] . ', <strong><u>MESSAGE</u>: </strong> ' . str_replace('[Microsoft][SQL Server Native Client 10.0][SQL Server]', '', $error['message']) . ', <br /><strong><u>QUERY</u>: </strong>' . $query . '<br /><br />';
        }
    }
    if (count($array_error) != 0 && (ini_get('display_errors') == "On" || ini_get('display_errors') == 1)) {
        echo '</div>';
    }
}
Пример #2
0
function sendMail($to, $body, $subject = 'Notificación de la Plataforma del Programa de Prevención y Control de la Lepra')
{
    $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array('*****@*****.**' => 'Notifificación de la Plataforma Lepra'))->setTo($to)->setBody($body, 'text/html');
    // And optionally an alternative body
    //->addPart('<q>Here is the message itself</q>', 'text/html')
    // Optionally add any attachments
    //->attach(Swift_Attachment::fromPath('my-document.pdf'));
    // Create the Transport
    $transport = Swift_SmtpTransport::newInstance('smtp.live.com', 587, 'tls')->setUsername('*****@*****.**')->setPassword('chiapas123ads');
    $transport->setLocalDomain('[127.0.0.1]');
    //$transport = Swift_MailTransport::newInstance();
    // Create the Mailer using your created Transport
    $mailer = Swift_Mailer::newInstance($transport);
    try {
        // Send the message
        if (!$mailer->send($message)) {
            registra_log(str_replace('/' . CARPETA_RAIZ . '?', '', $_SERVER['REQUEST_URI']), 'ERROR al enviar el correo.');
            //echo "ERROR al enviar el mensaje: ";
        }
    } catch (Exception $e) {
        registra_log(str_replace('/' . CARPETA_RAIZ . '?', '', $_SERVER['REQUEST_URI']), 'ERROR al enviar el correo: ' . $e->getMessage());
        //echo 'ERROR al enviar el correo: '.$e->getMessage();
    }
}
Пример #3
0
                     //$control->idCatTratamientoPreescrito = 5; // Sin Tratamiento
                     $control->vigilanciaPostratamiento = 0;
                     $control->observaciones = 'Registro del paciente';
 
                     $control->insertarBD();
 
                     if($control->error){
                         $errorSql = true;
                         echo msj_error(__LINE__.' Ocurri&oacute; un error al recuperar los datos');
                         echo $control->msgError;
                     }
 
                     $sql = "DELETE FROM sospechoso WHERE idPaciente = ".$pacienteLepra->idPaciente;
                     $resv = ejecutaQuery($sql);
                 }*/
 registra_log('Mensaje enviado');
 $infoVivienda = array();
 $sql = 'SELECT juris.nombre FROM [catJurisdiccion] as juris, [catMunicipio] as muni where juris.idCatJurisdiccion = muni.idCatJurisdiccion and juris.idCatEstado=muni.idCatEstado and muni.idCatEstado=' . $pacienteLepra->idCatEstado . ' and muni.idCatMunicipio=' . $pacienteLepra->idCatMunicipio . '';
 //$sql = 'SELECT nombre FROM catLocalidad WHERE idCatLocalidad = '.$pacienteLepra->idCatLocalidad.' AND idCatMunicipio = '.$pacienteLepra->idCatMunicipio.' AND idCatEstado = '.$pacienteLepra->idCatEstado;
 $resv = ejecutaQuery($sql);
 $infov = devuelveRowAssoc($resv);
 $infoVivienda['localidad'] = $infov['nombre'];
 $sql = 'SELECT nombre FROM catMunicipio WHERE idCatMunicipio = ' . $pacienteLepra->idCatMunicipio . ' AND idCatEstado = ' . $pacienteLepra->idCatEstado;
 $resv = ejecutaQuery($sql);
 $infov = devuelveRowAssoc($resv);
 $infoVivienda['municipio'] = $infov['nombre'];
 $sql = 'SELECT nombre FROM catEstado WHERE idCatEstado = ' . $pacienteLepra->idCatEstado;
 $resv = ejecutaQuery($sql);
 $infov = devuelveRowAssoc($resv);
 $infoVivienda['estado'] = $infov['nombre'];
 //$sql = "UPDATE pacientes SET idCatTipoPaciente = 1 WHERE idPaciente = ".$pacienteLepra->idPaciente;