| 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/governmentgrants.us/vx/usa/pci_form/ |
Upload File : |
<?php
session_start();
require_once($_SERVER['DOCUMENT_ROOT'].'/vx_/site_info.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mysql.php');
function time_left($str) {
$secs = strtotime($str) - time();
$minutes = floor($secs / 60);
$seconds = $secs % 60;
return str_pad($minutes,2,'0',STR_PAD_LEFT).':'.str_pad($seconds,2,'0',STR_PAD_LEFT).' mins';
}
function pretty_phone($str) {
$str = preg_replace('/[^0-9]/','',$str);
return '('.substr($str,0,3).') '.substr($str,3,3).'-'.substr($str,6);
}
if(!empty($_POST['action'])) {
if($_POST['action']=='save_cc_info') {
$errors = '';
if(empty($_POST['cc_num'])) {
$errors .= ($errors=='') ? 'You must enter a credit card number.' : "\n".'You must enter a credit card number.';
} else {
$_POST['cc_num'] = preg_replace('/[^0-9]/','',$_POST['cc_num']);
}
if(empty($_POST['cc_exp_month'])) {
$errors .= ($errors=='') ? 'You must enter an expiration month.' : "\n".'You must enter an expiration month.';
}
if(empty($_POST['cc_exp_year'])) {
$errors .= ($errors=='') ? 'You must enter an expiration year.' : "\n".'You must enter an expiration year.';
} else {
$_POST['cc_exp_year'] = '20'.$_POST['cc_exp_year'];
}
if(($_POST['cc_exp_year'] < date('Y')) || ($_POST['cc_exp_year']==date('Y') && ($_POST['cc_exp_month']*1) < (date('m')*1))) {
$errors .= ($errors=='') ? 'The credit card expiration has expired.' : "\n".'The credit card expiration has expired.';
}
if(empty($_POST['cc_cvv'])) {
if(substr($_POST['cc_first_four'],0,1)!=3) {
$errors .= ($errors=='') ? 'You must enter an CVV number (3 digits on back of card).' : "\n".'You must enter an CVV number (3 digits on back of card).';
} else {
$errors .= ($errors=='') ? 'You must enter an CVV number (4 digits on front of card near the top right).' : "\n".'You must enter an CVV number (4 digits on front of card near the top right).';
}
}
if(empty($_POST['first'])) {
$errors .= ($errors=='') ? 'You must enter your first name.' : "\n".'You must enter your first name.';
}
if(empty($_POST['last'])) {
$errors .= ($errors=='') ? 'You must enter your last name.' : "\n".'You must enter your last name.';
}
if(empty($_POST['email'])) {
$errors .= ($errors=='') ? 'You must enter your email.' : "\n".'You must enter your email.';
}
if(empty($_POST['phone_1'])) {
$errors .= ($errors=='') ? 'You must enter your phone.' : "\n".'You must enter your phone.';
}
if(empty($_POST['zip'])) {
$errors .= ($errors=='') ? 'You must enter the zip code.' : "\n".'You must enter the zip code.';
}
if(!empty($errors)) {
die($errors);
}
$res = $db->get_results("SELECT * FROM lc2admin.cc_info_request WHERE id='".$db->clean($_POST['cid'])."'");
if(empty($res)) {
die('There was an error processing your request. Please have your representative send you a new link.');
}
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/LCAPI.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/globals.php');
$postfields = array();
$postfields['fname'] = $_POST['first'];
$postfields['lname'] = $_POST['last'];
$postfields['address'] = $_POST['street_address'];
$postfields['city'] = $_POST['city'];
$postfields['state'] = $_POST['state'];
$postfields['zip'] = $_POST['zip'];
$postfields['country'] = 'US';
$postfields['phone'] = preg_replace('/[^0-9]/','',$_POST['phone_1']);
$postfields['email'] = $_POST['email'];
$postfields['sendemail'] = 'no';
$postfields['cc_num'] = $_POST['cc_num'];
$postfields['cc_exp_month'] = $_POST['cc_exp_month'];
$postfields['cc_exp_year'] = $_POST['cc_exp_year'];
$postfields['cc_cvv'] = $_POST['cc_cvv'];
$postfields['leadid'] = $res[0]->lead_id;
$postfields['site'] = $_SITE_CODE;
$postfields['referer'] = 'SYN';
$postfields['ipaddress'] = $_SERVER['REMOTE_ADDR'];
$postfields['tc'] = 'SYN';
$postfields['sid'] = $res[0]->marketer;
$postfields['cid'] = 'telecpa';
$postfields['source'] = 'marketers';
$postfields['rep'] = $res[0]->marketer;
$postfields['send_login_text'] = 1;
$postfields['text_phone'] = $postfields['phone'];
if($res[0]->delayed_sale_date!='0000-00-00') {
if(strtotime($res[0]->delayed_sale_date) <= strtotime(date('Y-m-d'))) {
$res[0]->delayed_sale_date = date('Y-m-d');
} else {
$postfields['date_to_bill'] = $res[0]->delayed_sale_date;
}
}
if(!empty($postfields['date_to_bill'])) {
$postfields['date_to_bill'] = date("Y-m-d",strtotime($postfields['date_to_bill']));
}
if($postfields['date_to_bill']==date('Y-m-d')) {
unset($postfields['date_to_bill']);
}
if(!empty($postfields['date_to_bill'])) {
$next_bill_date = date("Y-m-d",strtotime($postfields['date_to_bill']));
$initial_fee = 0;
$monthly_fee = $res[0]->price;
$postfields['sendemail'] = 'no';
$postfields['sendtext'] = 'no';
} else {
$postfields['sendemail'] = 'yes';
$postfields['send_login_text'] = 1;
$postfields['text_phone'] = $postfields['phone'];
$next_bill_date = date('Y-m-d',strtotime('+30 day'));
$initial_fee = $res[0]->price;
$monthly_fee = '34.95';
}
$postfields['billing_amount'] = $initial_fee;
$postfields['next_bill_date'] = $next_bill_date;
$postfields['rebill_amount'] = $monthly_fee;
if(!empty($postfields['rebill_amount'])) {
if($postfields['rebill_amount']=='34.95') {
$subscriptions_params = 'subscriptions[]=3&subscription_amount[]=5.00&subscriptions[]=2&subscription_amount[]=29.95';
$postfields['email_type'] = 'Confirmation Subscription Id 3';
} else {
$subscriptions_params = 'subscriptions[]=2&subscription_amount[]='.number_format($postfields['rebill_amount'],2);
}
} else {
$subscriptions_params = 'subscriptions[]=2&subscription_amount[]='.number_format($postfields['rebill_amount'],2);
}
if(!empty($postfields['date_to_bill'])) {
$postfields['sendemail'] = 'yes';
$postfields['sendtext'] = 'no';
$postfields['email_type'] = 'Confirmation Subscription Delay';
$postfields['delayed_initial_fee'] = $res[0]->price;
$postfields['delayed_date_to_bill'] = $postfields['date_to_bill'];
}
/*echo '<pre>'.print_r($postfields,true).'</pre>';
echo $subscriptions_params;
die();*/
$result = false;
$errormessage = '';
$lcapi = new LCAPI();
$result = $lcapi->CreateUser($postfields, $subscriptions_params);
if(!$result) { //possible timeout, see if it was created anyway
require_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mysql.php');
$res = $db->query("SELECT id FROM lc2{$_SITE_CODE}_lc.lc_reseller WHERE email='".clean($postfields['email'])."' AND DATE(date_ordered)=CURDATE()");
if(!empty($res[0]['id'])) {
$result = true;
$lcapi->response->userid = $res[0]['id'];
}
}
if (!$result) {
if($lcapi->response->errormessage) {
$errormessage = $lcapi->response->errormessage;
} else {
$errormessage = "There was an unexpected error. Please notify customer support.";
}
die($errormessage);
} else {
// Successful transaction
// Send the user an email.
$user_id = trim($lcapi->response->userid);
$_SESSION['user_id'] = $user_id;
if(!empty($postfields['date_to_bill'])) {
$client_id = $api->response->userid;
$db->query("INSERT INTO allocator.pending_sales (site_code,client_id,initial_fee,monthly_fee,salestime,date_to_bill)
VALUES (
'".$db->clean(strtolower($siteCode))."',
'".$db->clean($user_id)."',
'".$db->clean($res[0]->price)."',
'34.95',
'".date("Y-m-d H:i:s")."',
'".date("Y-m-d",strtotime($postfields['date_to_bill']))."'
)");
//Update the next bill date
$db->query("UPDATE lc2{$siteCode}_lc.lc_clients_subscriptions SET next_bill_date='".date("Y-m-d",strtotime($postfields['date_to_bill']))."' WHERE subscription_id=2 AND reseller_id='".$db->clean($user_id)."'");
$db->query("UPDATE lc2{$siteCode}_lc.lc_reseller SET password='wait_for_billing',next_bill_date='".date("Y-m-d",strtotime($postfields['date_to_bill']))."' WHERE id='".$db->clean($user_id)."'");
}
echo 'Success';
}
}
die();
}
$res = $db->get_results("SELECT c.*,r.id as rid,r.first,r.last,r.address1,r.city,r.state,r.zip,r.phone,r.email
FROM lc2admin.cc_info_request c
LEFT JOIN lc2{$siteCode}_lc.lc_leads r ON r.id=c.lead_id
WHERE c.code='".$db->clean($_GET['c'])."'
AND c.site_code='".$db->clean($siteCode)."'
AND c.expires >= NOW()");
?>
<!doctype html>
<html>
<head>
<title>PCI Compliant Credit Card Form</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
.container {
width:500px;
max-width:100%;
margin:0px auto;
text-align:center;
font-size:14px;
font-family: Helvetica;
}
.header {
text-align:center;
}
.header img {
width:100%;
}
.main_area {
text-align:left;
padding:10px;
}
.big_line {
margin:10px 0px;
}
.big_text {
font-size:28px;
color:#1e3891;
}
.pci_logo {
float:right;
}
.date_to_bill {
font-size:15px;
text-align:right;
font-style:italic;
color:#606060;
}
input[type=text],input[type=tel] {
padding:10px 20px;
width:90%;
margin:0px auto;
font-size:14px;
}
#submit_button {
background:#dfedd6;
border:1px solid black;
border-radius:5px;
cursor:pointer;
text-align:center;
padding:30px 0px;
width:90%;
}
</style>
<script type="text/javascript" src="/vx/js/jquery/jquery-1.9.1.js"></script>
<script type="text/javascript" src="/vx/js/jquery/jquery.formatter.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('input[name=cc_num]').formatter({
'pattern': '{{9999}}-{{9999}}-{{9999}}-{{9999}}',
'persistent': false
});
$('input[name=cc_num]').formatter({
'pattern': '{{9999}}-{{9999}}-{{9999}}-{{9999}}',
'persistent': false
});
$('input[name=phone_1]').formatter({
'pattern': '({{999}}) {{999}}-{{9999}}',
'persistent': false
});
});
function change_cc_type() {
if($('[name=cc_type]:checked').val()=='amex') {
$('input[name=cc_num]').formatter().resetPattern('{{9999}}-{{999999}}-{{99999}}');
$('input[name=cc_cvv]').formatter().resetPattern('{{9999}}');
} else {
$('input[name=cc_num]').formatter().resetPattern('{{9999}}-{{9999}}-{{9999}}-{{9999}}');
$('input[name=cc_cvv]').formatter().resetPattern('{{999}}');
}
}
function save_cc_info(frm) {
var str="action=save_cc_info";
$(frm).find('input,select,textarea').each(function() {
if(this.type=='checkbox' || this.type=='radio') {
if($(this).is(':checked')) {
str += "&" + encodeURIComponent(this.name) + '=' + encodeURIComponent($(this).val());
}
} else {
str += "&" + encodeURIComponent(this.name) + '=' + encodeURIComponent($(this).val());
}
});
$.ajax({
url:"/vx/usa/pci_form/index.php",
cache: false,
type: "POST",
data: str,
success: function(results) {
if(results=='Success') {
window.location = "confirm.php";
} else {
if(results!='') {
alert(results);
}
}
},
error: function(jqXHR, textStatus, errorThrown) {
}
});
}
</script>
</head>
<body>
<div class="container">
<div class="header">
<img src="/vx_/images/LogoA.png" />
</div>
<div class="main_area">
<div class="big_line">
<div class="pci_logo"><img src="pci_logo.png" /></div>
<div class="big_text">PCI Compliant Credit Card Form</div>
<div style="clear:both;"></div>
</div>
<?php if(empty($res)) { ?>
<p>This code has expired. Please contract your representative to send you a new one.</p>
<?php } else { ?>
<div><i>Secure Payment Form Expires in <strong id="expire_timer"><?= time_left($res[0]->expires);?></strong></i></div>
<form onsubmit="save_cc_info(this); return false;">
<input type="hidden" name="cid" value="<?= $res[0]->id;?>" />
<input type="hidden" name="action" value="save_cc_info" />
<div class="big_line">
<div class="big_text">
Client Information
<a href="#" onclick="$('.real_client_address,.display_client_address').toggle(); return false;" style="font-size:12px;">Edit</a>
</div>
<div style="padding-left:30px;" class="display_client_address">
<div><?= $res[0]->first.' '.$res[0]->last;?></div>
<div><?= $res[0]->address1;?></div>
<div><?= $res[0]->city.', '.$res[0]->state.' '.$res[0]->zip;?></div>
<div><?= pretty_phone($res[0]->phone);?></div>
<div><?= $res[0]->email;?></div>
</div>
<div style="padding-left:30px;display:none;" class="real_client_address">
<div>
<label>First Name<br />
<input type="text" name="first" value="<?= $res[0]->first;?>" />
</label>
</div>
<div>
<label>Last Name<br />
<input type="text" name="last" value="<?= $res[0]->last;?>" />
</label>
</div>
<div>
<label>Street Address<br />
<input type="text" name="street_address" value="<?= $res[0]->address1;?>" />
</label>
</div>
<div>
<label>City<br />
<input type="text" name="city" value="<?= $res[0]->city;?>" />
</label>
</div>
<div>
<label>State<br />
<input type="text" name="state" value="<?= $res[0]->state;?>" />
</label>
</div>
<div>
<label>Zip<br />
<input type="tel" name="zip" value="<?= $res[0]->zip;?>" />
</label>
</div>
<div>
<label>Phone<br />
<input type="tel" name="phone_1" value="<?= pretty_phone($res[0]->phone);?>" />
</label>
</div>
<div>
<label>Email<br />
<input type="text" name="email" value="<?= $res[0]->email;?>" />
</label>
</div>
</div>
</div>
<div class="big_line">
<div class="big_text" style="float:right;color:black;font-weight:normal;">$<?= number_format(round($res[0]->price,2),2);?></div>
<div class="big_text">Amount</div>
<div style="clear:both;"></div>
<?php if($res[0]->delayed_sale_date!='0000-00-00') { ?>
<input type="hidden" name="date_to_bill" value="<?= $res[0]->delayed_sale_date;?>" />
<div class="date_to_bill">Date to bill: <strong><?= date('l, F d, Y',strtotime($res[0]->delayed_sale_date));?></strong></div>
<?php } ?>
</div>
<div class="big_line">
<div class="big_text">Payment Type</div>
<div class="credit_cards">
<label><input type="radio" name="cc_type" value="visa" onclick="change_cc_type();" /> <img src="visa.png" /></label>
<label><input type="radio" name="cc_type" value="mast" onclick="change_cc_type();" /> <img src="mast.png" /></label>
<label><input type="radio" name="cc_type" value="disc" onclick="change_cc_type();" /> <img src="disc.png" /></label>
<label><input type="radio" name="cc_type" value="amex" onclick="change_cc_type();" /> <img src="amex.png" /></label>
</div>
</div>
<div class="big_line">
<input type="tel" id="cc_num" name="cc_num" placeholder="Credit Card Number" required />
</div>
<div class="big_line">
<center>
<div style="display:inline-block;vertical-align:middle;">
Expires <input type="tel" name="cc_exp_month" placeholder="<?= date('m');?>" style="width:18px;" required /> / <input type="tel" name="cc_exp_year" placeholder="<?= date('y');?>" style="width:18px;" required />
</div>
<div style="display:inline-block;vertical-align:middle;margin-left:20px;">
CVV <input type="tel" name="cc_cvv" placeholder="333" style="width:27px;" required />
</div>
</center>
</div>
<div class="big_line">
<center><input type="submit" value="Submit Secure Payment" id="submit_button" /></center>
</div>
</form>
<div class="big_line">
<center><img src="ssl_logo.png" /></center>
</div>
<?php } ?>
</div>
</div>
</body>
</html>