<?php
error_reporting(E_ERROR | E_PARSE);
if(isset($_POST)){
require_once 'vendor/autoload.php';
$email = $_POST['email'];
$name = 'Uxbridge Writers';
$asubject = $_POST['Subject_Name'];
$date = $_POST['Due_Date'];
$time = $_POST['Due_Time'];
$pages = $_POST['Pages'];
// $words = $_POST['cost'];
$workLevel = $_POST['Work_Level'];
$reference = $_POST['Reference_Style_Id'];
$desc = $_POST['Details'];
$countryCode = $_POST['countryCode'];
$phone = $_POST['Phone'];
//$file = $_FILES['files']['tmp_name'];
// $file_name = $_FILES['files']['name'];
$int = (int)$pages;
$total = $int * 10;
$admMessage = '
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
.container{
border-left: 2px solid #EB1923;
border-right: 2px solid #EB1923;
}
.logo{
text-align: center
}
table {
width:100%;
}
.content{
padding: 10px 20px;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
text-align: left;
}
table th {
background-color: black;
color: white;
}
</style>
</head>
<body>
<div class="container">
<div class="logo">
<img src="https://uxbridgewriters.com/img/ux-logo.png"/>
</div>
<div class="content">
<table>
<thead>
<tr>
<th>Email</th>
<th>Subject</th>
<th>Deadline</th>
<th>Words</th>
<th>Work Level</th>
<th>Reference</th>
<th>Details</th>
<th>Phone</th>
</tr>
</thead>
<tbody>
<tr>
<td>'.$email.'</td>
<td>'.$asubject.'</td>
<td>'.$date.' | '.$time.'</td>
<td>'.$pages.'</td>
<td>'.$workLevel.'</td>
<td>'.$reference.'</td>
<td>'.$desc.'</td>
<td>'.$countryCode.' | '.$phone.'</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>
';
$userMsg = '
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
.container{
margin: auto;
padding: 0;
font-family: arial, sans-serif;
}
.flex{
text-align: center;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
td:first-child{
font-weight: 600;
}
tr:nth-child(even) {
background-color: #dddddd;
}
.button{
margin-top: 30px;
}
.button .submit {
background-color: #008000;
color: #fff;
text-decoration: none;
padding: 14px 15px;
cursor:pointer;
}
.credits{
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="flex">
<img src="https://uxbridgewriters.com/img/ux-logo.png">
</div>
<div class="para">
<strong>Dear Student</strong>
<p>I am Prof. Goodwin Kemp. I will be working on your assignment. Kindly make the payment so that I can start the work.</p>
<table>
<tr>
<td>Subject</td>
<td>'.$asubject.'</td>
</tr>
<tr>
<td>Pages / Words</td>
<td>'.$pages.' Pages</td>
</tr>
<tr>
<td>Deadline</td>
<td>'.$date.' | '.$time.'</td>
</tr>
<tr>
<td>Work Level</td>
<td>'.$workLevel.'</td>
</tr>
<tr>
<td>Refrence</td>
<td>'.$reference.'</td>
</tr>
<tr>
<td>Phone</td>
<td>'.$countryCode.' | '.$phone.'</td>
</tr>
<tr>
<td>Details</td>
<td>'.$desc.'</td>
</tr>
</table>
</div>
<div class="button flex">
<form action="https://uxbridgewriters.com/serve/payments.php" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="lc" value="UK" />
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest" />
<input type="hidden" name="first_name" value="John" />
<input type="hidden" name="last_name" value="Wick" />
<input type="hidden" name="payer_email" value="'.$email.'" />
<input type="hidden" name="item_number" value="123456" / >
<input type="hidden" name="item_name" value="'.$asubject.'" / >
<input type="hidden" name="item_amount" value="'.$total.'" / >
<input class="submit" type="submit" value="PAY USD '.$total.' TO START"/>
</form>
</div>
<div class="credits">
<i>All The Best</i><br/>
<i>Thanks & Regards</i><br/>
<i>Team UxbridgeWriters.com</i>
</div>
</div>
</body>
</html>
';
$too = "sales@uxbridgewriters.com";
// Create the Transport
$transport = (new Swift_SmtpTransport('mail.uxbridgewriters.com', 2525))
->setUsername('sales@uxbridgewriters.com')
->setPassword('Bridge@ux$321');
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
$message2 = (new Swift_Message());
$message2->setSubject('Order From Uxbridge Writers');
$message2->setFrom([$email => 'Uxbridge Writers']);
$message2->setTo($too);
$message2->setBody($admMessage, 'text/html');
/* if(!empty($file)){
foreach($file_name as $key){
$uploaddir = 'uploads/';
$uploadfile = $uploaddir . basename($_FILES['files']['name'][$key]);
if( move_uploaded_file($_FILES['files']['tmp_name'][$key], $uploadfile) ) {
$message2->attach(Swift_Attachment::fromPath($uploadfile));
}
}
}
/* if (!empty($_FILES["files"])) {
//Each element in $_FILES becomes a multidimensional array
foreach ($_FILES["files"]["tmp_name"] as $key => $value) {
if (!$_FILES["files"]["error"][$key]) {
$message2->attach(Swift_Attachment::fromPath(($value), $_FILES["files"]["name"][$key], $_FILES["files"]["type"][$key]));
}
}
}
*/
if (!empty($_FILES["files"])) {
for ($i=0; $i < count($_FILES['files']); $i++) {
$target_path = "uploads/".basename($_FILES['files']['name'][$i]);
if( move_uploaded_file($_FILES['files']['tmp_name'][$i], $target_path) ) {
$message2->attach(Swift_Attachment::fromPath($target_path));
//if we don't want to keep the image
//unlink($target_path);
}
}
}
// Create a message
$message = (new Swift_Message());
$message->setSubject('Pay Your Budget Price Now');
$message->setFrom(['sales@uxbridgewriters.com' => 'Uxbridge Writers']);
$message->setTo($email);
$message->setBody($userMsg, 'text/html');
if($mailer->send($message) && $mailer->send($message2))
{
echo 'sucessfully sent';
}
else
{
echo 'faild';
}
}
?>