query('SELECT DISTINCT version_number FROM release_history ORDER BY version_number DESC LIMIT 30');
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$releaseHistory = array();
while ($row = $stmt->fetch())
{
$releaseHistory[] = $row['version_number'];
}
// handle success
$emailSent = false;
if(isset($_GET['s']))
{
$emailSent = true;
}
$emailAdd = '';
$queryType = '';
$yourName = '';
$comments = '';
$website = '';
$version = '';
$purchase_code = '';
if (isset($_REQUEST['query_type']))
{
$queryType = $_REQUEST['query_type'];
}
if (isset($_REQUEST['yourName']))
{
$yourName = $_REQUEST['yourName'];
}
if (isset($_REQUEST['comments']))
{
$comments = $_REQUEST['comments'];
}
if (isset($_SESSION['email']))
{
$emailAdd = $_SESSION['email'];
$queryType = 'Technical Support';
}
if (isset($_REQUEST['version']))
{
$version = $_REQUEST['version'];
}
if (isset($_REQUEST['envato_item_id']))
{
$queryType = 'CodeCanyon Support';
$script = 'uCloud';
}
// if the form is submitted
$error = '';
if (isset($_POST['submitted']))
{
// captcha variables
$url = 'https://www.google.com/recaptcha/api/siteverify';
$privatekey = RECAPTCHA_SECRET_KEY;
$response = file_get_contents($url."?secret=".$privatekey."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER[REMOTE_ADDR]);
$data = json_decode($response);
if(isset($data->success) AND $data->success==true)
{
// pickup variables
$yourName = trim($_POST['yourName']);
$emailAdd = trim(strtolower($_POST['emailAdd']));
$queryType = trim($_POST['query_type']);
$comments = trim($_POST['comments']);
$website = isset($_POST['website'])?strtolower(trim($_POST['website'])):'';
$script = isset($_POST['script'])?trim($_POST['script']):'';
$version = isset($_POST['version'])?trim($_POST['version']):'';
$purchase_code = isset($_POST['purchase_code'])?strtolower(trim($_POST['purchase_code'])):'';
if (function_exists('stripslashes'))
{
$comments = stripslashes($comments);
}
// check to make sure that the name field is not empty
if (strlen($yourName) == 0)
{
$error = 'You forgot to enter your first name.';
}
// check to make sure sure that a valid email address is submitted
elseif (strlen($emailAdd) == 0)
{
$error = 'You forgot to enter your email address.';
}
else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $emailAdd))
{
$error = 'You entered an invalid email address.';
}
elseif(strlen($queryType) == 0)
{
$error = "Please select the type of query from the drop-down list.";
}
// check to make sure comments were entered
elseif (strlen($comments) == 0)
{
$error = 'You forgot to enter your query.';
}
// if there is no error, check for a valid email address
if (strlen($error) == 0)
{
if($_REQUEST['query_type'] == 'Technical Support')
{
// lookup account details based on email
$stmt = $db->prepare('SELECT id FROM tblusers WHERE emailadd = :emailadd LIMIT 1');
$stmt->bindParam(':emailadd', $emailAdd, PDO::PARAM_STR);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$row = $stmt->fetch();
if (!$row)
{
$error = "Could not find email, please ensure you submit support requests from your account registered email address.";
}
}
elseif($_REQUEST['query_type'] == 'CodeCanyon Support')
{
if(strlen($purchase_code) == 0)
{
$error = "Please enter your purchase code.";
}
elseif(strlen($website) == 0)
{
$error = "Please enter your installation url.";
}
}
}
// if there is no error, send the email
if (strlen($error) == 0)
{
$emailTo = 'sales@mfscripts.com';
if(($queryType == 'Technical Support') || ($queryType == 'CodeCanyon Support'))
{
$emailTo = 'support@mfscripts.com';
}
$subject = ucfirst(strtolower($queryType)).' mfscripts.com contact from ' . $yourName;
$body = "Name: $yourName
";
$body .= "Email: $emailAdd
";
if(strlen($queryType))
{
$body .= "Type: " . $queryType . "
";
}
$body .= "Script: " . $script . "
";
if(strlen($website))
{
$body .= "Website: " . $website . "
";
}
if(strlen($version))
{
$body .= "Version: " . $version . "
";
}
if(strlen($purchase_code))
{
$body .= "Purchase Code: " . $purchase_code . "
";
}
$body .= "Comments:
".nl2br($comments)."
";
$body .= "*******************************************************
";
$body .= "IP: " . getUserIpAddress()."
";
// lookup account details based on email
$stmt = $db->prepare('SELECT id FROM tblusers WHERE emailadd = :emailadd LIMIT 1');
$stmt->bindParam(':emailadd', $_REQUEST['email'], PDO::PARAM_STR);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$row = $stmt->fetch();
if ($row)
{
$userId = (int)$row['id'];
// load orders and their state
$stmt = $db->query('SELECT tblorderitems.support_end, tblsalesitems.type, tblsalesitems.itemgroup, tblorders.id AS order_id, tblsalesitems.filepath, tblorderitems.id AS order_item_id, tblorders.totalvalue AS order_total, tblorders.paymenttracker, orderdate, tblorderitems.description, tblorderitems.price, tblorders.status, tblsalesitems.script_id FROM tblorders LEFT JOIN tblorderitems ON tblorders.id = tblorderitems.orderid LEFT JOIN tblsalesitems ON tblorderitems.salesitemid = tblsalesitems.id WHERE tblorders.userid=' . (int)$userId . ' ORDER BY tblorders.orderdate DESC');
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$faq = array();
$body .= "ORDER HISTORY:
";
while ($row2 = $stmt->fetch())
{
$body .= "#".$row2['order_id'].", ".$row2['orderdate'].", ".$row2['status'].", ".$row2['description']."
";
}
}
// send email
sendEmail($subject, $body, $emailTo, $emailAdd, $yourName);
// redirect to clear post
redirect(SITE_URL.'/contact.html?s=1');
}
}
else
{
$error = "You entered the captcha incorrectly!";
}
}
// include header section
include_once('_header.inc.php');
?>
We are a real business with full time staff and offices in the south of the UK:
MFScripts.com c/o Mellow Fish Ltd
Wessex House
Eastleigh
Hampshire
SO50 9FD
United Kingdom
Co. Number: 06362139