| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/vx/usa/functions/ |
Upload File : |
<?php
include_once($_SERVER['DOCUMENT_ROOT']."/vx/lib/xinc.php");
if(!empty($_POST['site_code']) && !empty($_POST['client_id'])) {
$cancelSite = $db->clean($_POST['site_code']);
$cancelResellerID = $db->clean($_POST['client_id']);
$siteDatabase = "lc2{$cancelSite}_lc";
$leadData = $db->query("
SELECT
*
FROM {$siteDatabase}.lc_leads
WHERE
customerID = '$cancelResellerID'
");
$resellerData = $db->query("
SELECT
*
FROM {$siteDatabase}.lc_reseller
WHERE
id = '$cancelResellerID'
");
if(empty($resellerData[0]['active'])) {
if($resellerData[0]['date_cancelled']!='0000-00-00 00:00:00') {
?>
<p>Your account is already canceled. It was canceled on <?= date('M d, Y',strtotime($resellerData[0]['date_cancelled']));?>.</p>
<?php
} else {
?>
<p>Your account is already canceled.</p>
<?php
}
die();
}
$siteData = $db->query("
SELECT
*
FROM lc2admin.site
WHERE
site_code = '$cancelSite'
");
$db->query("INSERT INTO lc2admin.client_reduced_fee_cancels
(
site_code
,client_id
,source
,ts
) VALUES (
'".$db->clean($cancelSite)."'
,'".$db->clean($cancelResellerID)."'
,'".$db->clean($cancelSite)."'
,NOW()
)");
$refundEmailData = explode('@',$siteData[0]['refund_email']);
$refundDomain = $refundEmailData[1];
$sitePhone = $siteData[0]['phone'];
$lead = $leadData[0]['id'];
$lead = ($lead * 1);
$to = '"'.$resellerData[0]['first'].' '.$resellerData[0]['last'].'" <'.$resellerData[0]['email'].'>';
$headers = "To:{$to}\r\n".'From:"Support" <'.$siteData[0]['refund_email'].'>'."\r\n".'ReplyTo:"Support" <'.$siteData[0]['refund_email'].'>'."\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n";
$subject = $siteData[0]['site_name']." Cancellation Confirmation ".date('m/d/Y H:i:s');
$body = "<div style=\"width:500px;font-family:Helvetica;\">";
$body .= "<div>";
$body .= "<img src=\"https://".$siteData[0]['site_domain']."/vx_/images/LogoA.png\" />";
$body .= "</div>";
$body .= "<div style=\"padding-left:60px;\">";
$body .= "<p>";
$body .= $resellerData[0]['first'].",";
$body .= "</p>";
$body .= "<p>";
$body .= "We are sad to see you go! As you requested, ";
$body .= "we have canceled your account to {$siteData[0]['site_name']} ";
$body .= "effective, ".date('m/d/Y').".";
$body .= "</p>";
$body .= "<p>";
$body .= ((!empty($_POST['delay_deactivation'])) ? 'As a courtesy, you will continue to have access to our site until midnight of '.date('m/d/Y',strtotime($cancel_date)).'.'."\n" : '');
$body .= "</p>";
$body .= "<p>";
$body .= "If you have any questions in the future, please don't hesitate ";
$body .= "to call (".substr($sitePhone,0,3).")".substr($sitePhone,3,3)."-".substr($sitePhone,6);
$body .= "</p>";
$body .= "<p>";
$body .= "Sincerely,";
$body .= "</p>";
$body .= "<p>";
$body .= $siteData[0]['site_name'];
$body .= "</p>";
$body .= "</div>";
$body .= "</div>";
//mail($to, $subject, $body, $headers,'-f '.$refundDomain);
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mailgun.php');
mailgun_send_message($to,$siteData[0]['refund_email'],$subject,$body,1,'Cancel Memembership Confirmation','','',$cancelSite,$cancelResellerID);
$db->query("INSERT INTO {$siteDatabase}.lc_cancellation_info
(
client_id
,cnl_agent
,cnl_date_cancelled
,cnl_cancel_type
,cancel_reason
) VALUES
(
'".$cancelResellerID."'
,'$cancelSite'
,NOW()
,'$cancelSite'
,'{$reason}'
)");
$db->query("
UPDATE {$siteDatabase}.lc_reseller
SET
active = 0,
date_cancelled = NOW()
WHERE
id = '$cancelResellerID'
");
// if delayed cancel
// cancel_queue.cancel
// insert into
// lc_cancelation_info
$db->query("
UPDATE {$siteDatabase}.lc_clients_subscriptions
SET
cancel_date = CURDATE(),
cancel_datetime = NOW(),
active = 0
WHERE
reseller_id = '$cancelResellerID'
AND
(
subscription_id = 2
OR
subscription_id = 3
)
");
if(!$db->valid())
{
$errors[] = "Could Not Enter Note";
$errors[] = $db->error();
}
$db->query("
UPDATE allocator.leads
SET
marketer = 'Update Script',
disposition = 'Cancelled',
dispositiondate = NOW()
WHERE
leaddb = '$cancelSite'
AND
leadid = '$cancelResellerID'
AND
leadtype = 'sales'
");
if(!$db->valid())
{
$errors[] = "Could Not Enter Note";
$errors[] = $db->error();
}
$db->query("
INSERT INTO allocator.leadlog
(
leadsourceid,
marketer,
disposition,
disposition_date,
dispositiondate,
disposition_datetime
)
(
SELECT
id,
'Update Script',
'Cancelled',
CURDATE(),
NOW(),
NOW()
FROM allocator.leads
WHERE
leaddb = '$cancelSite'
AND
leadid = '$cancelResellerID'
AND
leadtype = 'sales'
)
");
if(!$db->valid())
{
$errors[] = "Could Not Enter Note";
$errors[] = $db->error();
}
$db->query("
INSERT INTO surfcrm.notes
(
timeclock_id,
site_code,
client_type,
client_id,
date,
type,
note,
username,
first_name,
last_name,
active
)
VALUES
(
'0',
'$cancelSite',
'clients',
'$cancelResellerID',
NOW(),
'System Note',
'Client was cancelled by themselves on $cancelSite : $reason',
'Client',
'usfund',
'CRM',
'1'
)
");
if(!$db->valid())
{
$errors[] = "Could Not Enter Note";
$errors[] = $db->error();
}
$db->query("
INSERT INTO surfcrm.notes
(
timeclock_id,
site_code,
client_type,
client_id,
date,
type,
note,
username,
first_name,
last_name,
active
)
VALUES
(
'0',
'$cancelSite',
'clients',
'$cancelResellerID',
NOW(),
'System Note',
'Email: ".$db->clean($body)."',
'Client',
'usfund',
'CRM',
'1'
)
");
$db->query("
INSERT IGNORE INTO lc2admin.cancellation_emails
(
site_code,
client_id,
email_subject,
email_body,
ts
)
VALUES
(
'$cancelSite',
'$lead',
'".clean($subject)."',
'".clean($body)."',
NOW()
)
");
if(!$db->valid())
{
$errors[] = "Could Not Cancel Membership";
$errors[] = $db->error();
}
}
?>
<p>We are sad to see you go! As you requested, your account has been canceled effective <?= date('M d, Y');?>.</p>
<?php