<?php
//DB Data
include '../../ASEngine/AS.php';
if(!$login->isLoggedIn())
    header("Location: ../../login.php");
$user = new ASUser(ASSession::get("user_id"));
$userInfo = $user->getInfo();

//basic include files
require_once("../../../db.php");

//Variables Post
$subject_admin = $_POST['subject_admin'];
$msnadmin = $_POST['msnadmin'];

$subject_client = $_POST['subject_client'];
$msnclient = $_POST['msnclient'];

$subjectpaypalmail = $_POST['subjectpaypalmail'];
$adminpaypalmsn = $_POST['adminpaypalmsn'];

$subjectmailclientpaypal = $_POST['subjectmailclientpaypal'];//
$clientpaypalmsn = $_POST['clientpaypalmsn'];//

$subjectmailcancel = $_POST['subjectmailcancel'];
$admincancelmsn = $_POST['admincancelmsn'];

$subject_cancel_client = $_POST['subject_cancel_client'];
$client_cancelmsn = $_POST['client_cancelmsn'];

//Update Email Admin
if($msnadmin && $subject_admin)
{
	$updt_qry = mysqli_query($conn, "UPDATE email_template SET email_subject = '$subject_admin', email_message = '$msnadmin' WHERE id = 1");
}

//Update Email Client
if($msnclient && $subject_client)
{
	$updt_qry = mysqli_query($conn, "UPDATE email_template SET email_subject = '$subject_client', email_message = '$msnclient' WHERE id = 2");
}

//Update Paypal Email Admin
if($adminpaypalmsn && $subjectpaypalmail)
{
	$updt_qry = mysqli_query($conn, "UPDATE email_template SET email_subject = '$subjectpaypalmail', email_message = '$adminpaypalmsn' WHERE id = 4");
}

//Update Paypal Email Client
if($clientpaypalmsn && $subjectmailclientpaypal)
{
	$updt_qry = mysqli_query($conn, "UPDATE email_template SET email_subject = '$subjectmailclientpaypal', email_message = '$clientpaypalmsn' WHERE id = 3");
}

//Update Cancel Email Client
if($client_cancelmsn && $subject_cancel_client)
{
	$updt_qry = mysqli_query($conn, "UPDATE email_template SET email_subject = '$subject_cancel_client', email_message = '$client_cancelmsn' WHERE id = 5");
}

//Update Cancel Email Admin
if($admincancelmsn && $subjectmailcancel)
{
	$updt_qry = mysqli_query($conn, "UPDATE email_template SET email_subject = '$subjectmailcancel', email_message = '$admincancelmsn' WHERE id = 6");
}

mysqli_close($conn);

header("Location: ../../mailerconfig.php?emailtemplatemsn=update2");
?>