website/tesses.cf/mail_send.php

33 lines
1.2 KiB
PHP
Raw Normal View History

2022-07-23 13:29:59 +00:00
<?php
if(isset($_POST["name"]) && isset($_POST["message"]))
{
$name_of_person= $_POST["name"];
$message_data= $_POST["message"];
$my_file = 'private/email_data.html';
$handle = fopen($my_file, 'r');
$data = fread($handle,filesize($my_file));
$data=str_replace('{Name}',htmlspecialchars($name_of_person),$data);
$data=str_replace('{MessageData}',htmlspecialchars($message_data),$data);
$date = new DateTime(null, new DateTimeZone('America/Chicago'));
$current_date = $date->getTimestamp();
$url='private/anonymous/'.$current_date.'.html';
$hdl=fopen('/var/www/html/'.$url,'w');
fwrite($hdl,$data,strlen($data));
fclose($hdl);
$email_variant=str_replace('<div align="center"><a class="waves-effect waves-light btn-small" href="javascript:downloadHtml();"><i class="material-icons right">download</i>Download</a></div>','<a href="https://tesses.cf/'.$url.'">View</a>',$data);
$to_email = 'tesses50@tesses.cf';
$subject = 'Anonymous Email';
$headers ='Content-Type: text/html';
mail($to_email,$subject,$email_variant,$headers);
header('Content-Type: text/html');
echo $data;
fclose($handle);
}else{
echo "Error name or message not set";
}
?>