

<?php
error_reporting(0);
if (isset($_POST['transactionID'])) {
require $_SERVER['DOCUMENT_ROOT']."/personal-access/functions/connect.php";

$transactionID = $_POST['transactionID'];
$ActCode = $_POST['ActCode'];

$myStr = $_SERVER['SERVER_NAME'];
$subStr =  substr($myStr,0,1);

// ==== CHECK IF TRANSACTION ALREADY COMPLETED 
$transactionsC = mysqli_query($connect, "SELECT * FROM tracktrans WHERE TransID = '$transactionID' AND Level = 4");
$fetchTransDataC = mysqli_num_rows($transactionsC);


if($fetchTransDataC > 0) {
    // TRANSACTION ALREADY ACTIVATED 
echo "already";
}else {

// TRANSACTION NOT ACTIVATED 
$transactions = mysqli_query($connect, "SELECT * FROM tracktrans WHERE TransID = '$transactionID' AND Code = '' ORDER BY ID DESC");
$fetchTransData = mysqli_num_rows($transactions);

$fetchUserID = mysqli_fetch_assoc($transactions);


$transactionsM = mysqli_query($connect, "SELECT * FROM transactions WHERE ID = '$transactionID'");

$fetchUserIDM = mysqli_fetch_assoc($transactionsM);
$Account = $fetchUserIDM['UserID'];



if($fetchTransData > 0) {
    // GET TRANS LEVEL 
    $Level = $fetchUserID['Level'];
    $NewLevel = $Level + 0;
    
$update = mysqli_query($connect, "UPDATE tracktrans SET Code = '$ActCode', Level = '$NewLevel' WHERE TransID = '$transactionID'");
if ($update) {

if($subStr == "c") {

// ======== SEND MAIL =====================================================================================
$checkQuery = mysqli_query($connect, "SELECT * FROM customers WHERE ID = '$Account'");
$fetchQuery = mysqli_fetch_assoc($checkQuery);

$CustomerEmail = $fetchQuery['Email'];
$Phone = $fetchQuery['Phone'];
$Fullname = $fetchQuery['AccFullname'];


require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'mail.capita14tfinancialgroup.com';  // Specify main and backup SMTP servers
$mail->Port = 465; 
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'info@capitalcreditpay.com';                 // SMTP username
$mail->Password = 'MasterAccess789W';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted

$mail->setFrom('info@capitalcreditpay.com', 'AK FINANCIALS Pay');
$mail->addAddress($CustomerEmail, $Fullname);     // Add a recipient

//Content
$mail->isHTML(true);  
 $mail->Subject = 'AK FINANCIALS Pay TRANSACTION NOTIFICATION SYSTEM';
$mail->Body = <<<EOL
<!DOCTYPE html>
<html>
<body style="background-color: #FFF; padding: 20px; font-family: font-size: 14px; line-height: 1.43; font-family: &quot;Helvetica Neue&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif;">
<div style="max-width: 600px; margin: 0px auto; background-color: #fff; box-shadow: 0px 20px 50px rgba(0,0,0,0.05);">
<table style="width: 100%;">
<tr>
<td style="background-color: #fff;"><img alt="" src="https://trustcorpfinancialgroup.com/personal-access/images/sterL.png" style="width: 200px; padding: 20px"></td>
<td style="padding-left: 50px; text-align: right; padding-right: 20px;"><a href="https://trustcorpfinancialgroup.com/personal-access/" style="color: #261D1D; text-decoration: underline; font-size: 14px; letter-spacing: 1px;">Sign In</a></td>
</tr>
</table>

<div style="padding: 20px 0px;">
<!-- <h2 style="margin-top: 0px;">Thanks for your order, John!</h2> -->
<div style="color: #636363; font-size: 14px;">  

<!-- ========== BODY ================= -->

<div id="bodyContainer" style="max-width: 800px; height: auto; overflow: hidden; border: none; margin: 10px auto;">     
<div class="logoHeader" style="width: 50%; height: auto; margin: 10px auto; overflow: hidden; border: none;">
<img src="https://trustcorpfinancialgroup.com/personal-access/images/sterL.png" alt="AK FINANCIALS Pay logo" style="width: 100%; height: auto;">
</div>
<br>
<br>
<p class="pretext" style="color: #333; font-size: 16px; font-family: "Lato", sans-serif; margin: 50px 10px 50px 10px; font-weight: 100;">
Hello <strong style="font-weight: 600;"> $Fullname</strong>, Please login to your account and use the code below to continue your fund transfer:
<br>
<br>
<h1 style="text-align: center;"><strong> $ActCode </strong> </h1>
<br>

</p>


</div>

<!-- ========== BODY ================= -->

</div>

<div style="color: #636363; font-size: 14px; padding-top: 20px; padding-bottom: 20px; border-top: 1px solid rgba(0,0,0,0.09); border-bottom: 1px solid rgba(0,0,0,0.09); margin-bottom: 50px;">
Your Account information is private, please do not disclose your login credentials or card details to anyone, evade clicking od suspicious links in email or text messages, if you are in doubt kindly contact us <a href="mailto:info@capitalcreditpay.com" style="text-decoration: none; color: #aa0b3c;">info@capitalcreditpay.com</a>
</div>
<h4 style="margin-bottom: 10px;">Need Help?</h4>
<div style="color: #A5A5A5; font-size: 12px;">
<p>
If you have any questions you can simply reply to this email or find our contact information below. Also contact us at <a href="mailto:info@capitalcreditpay.com" style="text-decoration: none; color: #aa0b3c;">info@capitalcreditpay.com</a>
</p>
</div>
</div>

</div>
</body>
</html>
EOL;
if ($mail->send()) {
echo "success";

}else {
echo "error";
}




}else {
    echo "success";
 }





}else {
echo "error";
}

}else {
echo "already";
}
}


}
else {
header("Location: /personal-access/");
die();
}







































?>