| Server IP : 159.223.102.202 / Your IP : 216.73.216.193 Web Server : nginx/1.26.0 System : Linux Gen1-cloudpanel2ubuntu2404-1vcpu-1gb-nyc1-01 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 User : albasshbotta ( 1021) PHP Version : 8.2.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /home/bottaingenieriaUep/htdocs/www.bottaingenieria.com.ar/licen/ |
Upload File : |
<?php
require_once "../clases/conexion.php";
require_once('../clases/Exception.php');
require_once('../clases/PHPMailer.php');
require_once('../clases/SMTP.php');
use PHPMailer\PHPMailer\PHPMailer;
$ipCliente = $_SERVER['REMOTE_ADDR'];
//Fecha unificada con nuestro pais
date_default_timezone_set('America/Buenos_Aires');
echo "test";
$enviado = false;
$motivo = "Recuperando licencia de servidor distinto a IP CLIENTE : $ipCliente, fecha: " . date("Y-m-d H:i:s") . " \n ";
$owner_email = "hernan@bottaingenieria.com.ar";
$subject = 'Alerta de recuperacion de licencias desde OTRA IP.' ;
$messageBody = "<body>";
$messageBody .= '<p>Nombre: Alerta de seguridad </p>' . "\n";
$messageBody .= "<p>$motivo</p>";
$messageBody .= "</body>";
//if($_POST["stripHTML"] == 'true'){
$messageBody = strip_tags($messageBody);
//}
try{
//crear objeto mail
$mail = new PHPMailer(); // defaults to using php "mail()"
// --- Configurar SMTP ---
$mail->IsSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->Username = 'bottaingenieria@gmail.com';
$mail->Password = 'qwvnyjidrmvlfhxj'; // Usar "App Password" de Google, no la password normal
//$mail->SMTPDebug = true; // Activar para debug (desactivar en produccion)
//$body = "<body><h1>Miren que lindo que salio el email</h1></body>";
//fijar destinatario/s
$mail->CharSet="utf-8";
$mail->AddAddress("hernanbotta@gmail.com" , "Wilson");
//fijar a quien responder
$mail->AddReplyTo("noresponder@bottaingenieria.com.ar", "NO RESPONDER");
//fijar quien lo mando! esto esta especial para pescar despistados
$mail->SetFrom("licencias@bottaingenieria.com.ar", "Administrador de Licencias");
//fijar Copia Carbon Oculta - esto no me anduvo
//$mail->AddBCC('hernan@bottaingenieria.com.ar', 'Contacto');
//Asunto
$mail->Subject = $subject;
//cuerpo alternativo si el cliente de email no soporta html
$mail->AltBody = "Para ver el mensaje, por favor utiliza un cliente con soporte HTML!";
$mail->MsgHTML($messageBody);
echo "TEST2 ";
if(!$mail->Send()){
$enviado = false;
echo "NO enviado error: ";
}else{
//conexion mysql
$con = new conexion();
$link = $con ->GetLink();
$vNombre="Alerta";
$vAsunto="Alerta de maxima seguridad";
$vAsunto.= "$ipCliente";
$vIp=$_SERVER['REMOTE_ADDR'];
$query = "INSERT INTO `contacto` (`nombre` ,`asunto` ,`telefono`,`email` ,`mensaje` ,`fecha_hora` ,`ip` )
VALUES ('error', '','', '', '$messageBody', NOW( ) , '$vIp')";
$result = mysqli_query( $link,$query);
mysqli_close($link);
}
}catch(Exception $e){
$enviado = false;
$motivo = "error: ". $e->getMessage();
}
die;
//
?>