HEX
Server: Apache
System: Linux iad1-shared-e1-19 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User: austral3d (14892361)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /home/austral3d/fourdplan.com/webservices4.9dev/mail.php
<?php
include ("comun/conexion_mysqli.php");
$db = fdp_connect();

date_default_timezone_set('America/Santiago');	

$uploaddir = 'screenshots/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);

$language = $_POST['language'];
$id_assembly = $_POST['id_assembly'];
$progress = $_POST['progress'];
$comment = $_POST['message'];
$insert_notification = $_POST['notification'];

$assembly = [];
$sql_assembly = "
	SELECT a.nombre, p.nombre, e.nombre, p.id, e.id
	FROM Empresa e, Assembly a, Proyecto p
	WHERE a.id_proyecto = p.id
	AND p.id_empresa = e.id
	AND a.id = '" . $id_assembly . "'";

if(!($assembly_query = fdp_query_row($db, $sql_assembly, 0))) {
	die("Error: Assembly " . $id_assembly . " not found");
}

$assembly['name'] = $assembly_query[0];
$assembly['project'] = $assembly_query[1];
$assembly['owner'] = $assembly_query[2];
$assembly['id_project'] = $assembly_query[3];
$assembly['id_owner'] = $assembly_query[4];

$image_url = 'http://www.fourdplan.com/webservices3.0/screenshots/' . $_FILES['file']['name'];
$date2 = date('Y:m:d');

if ($language == "english")
{
	$subject = 'Fourdplan - Progress report';
	$text1 = 'PROGRESS REPORT';
	$text2 = 'PROJECT:';
	$text3 = 'DATE:';
	$date = date('m/d/Y');
	$text4 = 'Model:';
	$text5 = 'Progress:';
	$text6 = 'PHOTOGRAPHIC RECORD:';
}
else
{
	$subject = 'Fourdplan - Reporte de avance';
	$text1 = 'REPORTE DE AVANCE';
	$text2 = 'PROYECTO:';
	$text3 = 'FECHA:';
	$date = date('d/m/Y');
	$text4 = 'Modelo en revisión:';
	$text5 = 'Progreso:';
	$text6 = 'REGISTRO FOTOGRÁFICO:';
}

// $to  = 'nd0806@gmail.com, ' . $_POST['addresses'];

// $message = '
// <html>
// <head>
// </head>
// <body>  
// 	<div>
// 		<center>
// 			<img src="http://www.fourdplan.com/webservices3.0/banner2.jpg" height="107" width="765">
// 			<br style = "color: white;">.</br>
// 			<table style="width:100%;">
// 				<tr>
// 					<th style = "border: 1px solid black;">FOURDPLAN</th>
// 					<th style = "border: 1px solid black; font-size:22px;">' . $text1 . '</th> 
// 					<th style = "border: 1px solid black;">' . $assembly['owner'] . '</th>
// 				</tr>
// 			</table>
			
// 			<table style="width:100%;">
// 				<tr>
// 					<td style = "border: 1px solid black; font-weight: bold;">' . $text2 . '</td>
// 					<td style = "border: 1px solid black;">' . $assembly['project'] . '</td>
// 					<td style = "border: 1px solid black; font-weight: bold;">' . $text3 . '</td>
// 					<td style = "border: 1px solid black;">' . $date . '</td>
// 				</tr>
// 				<tr>
// 					<td style = "border: 1px solid black; font-weight: bold;">' . $text4 . '</td>
// 					<td colspan="3" style = "border: 1px solid black;">' . $assembly['name'] . '</td>
// 				</tr>
// 				<tr>
// 					<td style = "border: 1px solid black; font-weight: bold;">' . $text5 . '</td>
// 					<td colspan="3" style = "border: 1px solid black;">' . $progress . '</td>
// 				</tr>
// 				<tr>
// 					<td colspan="4" style = "border: 1px solid black;">
// 					<center><br>' . $comment . '
// 						<br style = "color: white;">.</br>
// 					</center>
// 					</td>			
// 				</tr>
// 			</table>
// 		</center>
			
// 			<br>
// 			<span style = "font-weight: bold;">' . $text6 . '</span>
// 			<table style="width:100%;">
// 				<tr>
// 					<td style = "border: 1px solid black;">
// 						<center>
// 							<img src="' . $image_url . '" height="395" width="700">  
// 						</center>
// 					</td>
					
// 				</tr>
// 			</table>
			
			 
		
// 	</div>
  
// </body>
// </html>';

// $headers  = 'MIME-Version: 1.0' . "\r\n";
// $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// $headers .= 'From: Austral3D <tecnologia@austral3d.com>' . "\r\n";

// $mail_sent = mail($to, $subject, $message, $headers);

// if ($mail_sent)
// 	echo('Mail enviado');
// else
// 	echo('Error al enviar el mail');

if ($insert_notification == "true")
	$sql_insert_noti = "
		INSERT INTO Notificacion(id_proyecto, id_assembly, id_empresa, progreso, mensaje, fecha, imagen_url)
		VALUES ('".$assembly["id_project"]."', '".$id_assembly."', '".$assembly["id_company"]."', '".$progress."', '".$comment."', '".$date2."', '".$image_url."')";
	fdp_query($db, $sql_insert_noti);
 ?>