| 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_num'])) {
$errors .= ($errors=='') ? 'You must enter a credit card number.' : "\n".'You must enter a credit card number.';
} else {
if(substr($_POST['cc_num'],0,1)=='3') {
if(strlen($_POST['cc_num'])!=15) {
$errors .= ($errors=='') ? 'American Express cards should be 15 digits long. You have entered '.strlen($_POST['cc_num']).' digits.' : "\n".'American Express cards should be 15 digits long. You have entered '.strlen($_POST['cc_num']).' digits.';
}
} else {
if(strlen($_POST['cc_num'])!=16) {
$errors .= ($errors=='') ? 'Your credit card should be 16 digits long. You have entered '.strlen($_POST['cc_num']).' digits.' : "\n".'Your credit card should be 15 digits long. You have entered '.strlen($_POST['cc_num']).' digits.';
}
}
}
}
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.';
}
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.';
} else {
$_POST['phone_1'] = preg_replace('/[^0-9]/','',$_POST['phone_1']);
}
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_update 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.');
}
$responses = array();
$c_url = "https://secure.networkmerchants.com/api/transact.php";
if(!empty($_POST['customer_vault_id'])) {
$query = "customer_vault=update_customer&customer_vault_id=".$_POST['customer_vault_id'];
} else {
$query = "customer_vault=add_customer";
}
$query .= "&username=usagrantAPI";
$query .= "&password=MillerTime57&";
// Sales Information
$query .= "ccnumber=" . urlencode($_POST['cc_num']) . "&";
$query .= "ccexp=" . urlencode($_POST['cc_exp_month'] . substr($_POST['cc_exp_year'],-2)) . "&";
// Order Information
$query .= "ipaddress=" . urlencode($_SERVER['REMOTE_ADDR']) . "&";
$query .= "ponumber=" . urlencode($_POST['phone_1']) . "&";
// Billing Information
$query .= "firstname=" . urlencode($_POST['first']) . "&";
$query .= "lastname=" . urlencode($_POST['last']) . "&";
$query .= "company=" . urlencode('') . "&";
$query .= "address1=" . urlencode($_POST['street_address']) . "&";
$query .= "address2=" . urlencode('') . "&";
$query .= "city=" . urlencode($_POST['city']) . "&";
$query .= "state=" . urlencode($_POST['state']) . "&";
$query .= "zip=" . urlencode($_POST['zip']) . "&";
$query .= "country=" . urlencode('US') . "&";
$query .= "phone=" . urlencode($_POST['phone_1']) . "&";
$query .= "fax=" . urlencode('') . "&";
$query .= "email=" . urlencode($_POST['email']) . "&";
$query .= "website=" . urlencode('') . "&";
// Shipping Information
$query .= "shipping_firstname=" . urlencode($_POST['first']) . "&";
$query .= "shipping_lastname=" . urlencode($_POST['last']) . "&";
$query .= "shipping_company=" . urlencode('') . "&";
$query .= "shipping_address1=" . urlencode($_POST['street_address']) . "&";
$query .= "shipping_address2=" . urlencode('') . "&";
$query .= "shipping_city=" . urlencode($_POST['city']) . "&";
$query .= "shipping_state=" . urlencode($_POST['state']) . "&";
$query .= "shipping_zip=" . urlencode($_POST['zip']) . "&";
$query .= "shipping_country=" . urlencode('US') . "&";
$query .= "shipping_email=" . urlencode($_POST['email']);
$data = shell_exec('curl --tlsv1.2 --data "'.$query.'" '.$c_url);
$data = explode("&",$data);
$responses = array();
for($i=0;$i<count($data);$i++) {
$rdata = explode("=",$data[$i]);
$responses[$rdata[0]] = $rdata[1];
}
if($responses['response']=='3') {
//require_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mailgun.php');
//mailgun_send_message('jeremy@usbusinessfundingsolutions.com','NoReply@surfcrm.com','PCI Customer Vault Failed',$body,1,'PCI Customer Vault Failed','heinz57@gmail.com,golfjrk@gmail.com','','',0,array(),'',0);
if(strpos($responses['responsetext'],'REFID:')!==false) {
$arr = explode('REFID:',$responses['responsetext']);
$responses['responsetext'] = trim($arr[0]);
}
$cc_passed = strtoupper($_POST['cc_type']).', '.strlen($_POST['cc_num']);
$db->query("INSERT INTO lc2admin.cc_info_errors
(
request_type
,request_id
,error_message
,cc_passed
,ts
) VALUES (
'marketer'
,'".$db->clean($_POST['cid'])."'
,'".$db->clean($responses['responsetext'])."'
,'".$db->clean($cc_passed)."'
,NOW()
)");
echo 'There was a problem saving your card: '.$responses['responsetext'];
} else {
$db->query("UPDATE lc2admin.cc_info_request_update
SET is_updated=1
WHERE id='".$db->clean($_POST['cid'])."'");
require_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/phpCrypto.class.php');
$crypto = new phpCrypto();
$db->query("UPDATE lc2{$siteCode}_lc.lc_reseller
SET cc_num='".$db->clean($crypto->encrypt(substr($_POST['cc_num'],0,6).'******'.substr($_POST['cc_num'],-4)))."'
,bin_number='".$db->clean(substr($_POST['cc_num'],0,6))."'
,cc_last_four='".$db->clean(substr($_POST['cc_num'],-4))."'
,cc_first_four='".$db->clean(substr($_POST['cc_num'],0,4))."'
,cc_exp_month='".$db->clean($_POST['cc_exp_month'])."'
,cc_exp_year='".$db->clean($_POST['cc_exp_year'])."'
WHERE id='".$db->clean($_POST['rid'])."'");
}
}
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_1 as phone,r.email,r.customer_vault_id
FROM lc2admin.cc_info_request_update c
LEFT JOIN lc2{$siteCode}_lc.lc_reseller r ON r.id=c.client_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 Secure 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:16px;
background:white;
}
.header {
text-align:center;
}
.header img {
width:100%;
}
.main_area {
text-align:left;
padding:10px;
}
.big_line {
margin:20px 0px;
}
.big_text {
font-size:28px;
color:#1e3891;
padding-bottom:10px;
}
.pci_logo {
float:right;
}
input[type=text],input[type=tel],select {
padding:10px 20px;
width:90%;
margin:0px auto;
font-size:20px;
}
#submit_button {
background:#dfedd6;
color:black;
border:1px solid black;
border-radius:5px;
cursor:pointer;
text-align:center;
padding:20px 0px;
font-size:20px;
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}}');
$('.cvv_info_not_amex').hide();
$('.cvv_info_amex').show();
} else {
$('input[name=cc_num]').formatter().resetPattern('{{9999}}-{{9999}}-{{9999}}-{{9999}}');
$('input[name=cc_cvv]').formatter().resetPattern('{{999}}');
$('.cvv_info_not_amex').show();
$('.cvv_info_amex').hide();
}
}
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/update.php",
cache: false,
type: "POST",
data: str,
success: function(results) {
if(results!='') {
alert(results);
} else {
$(frm)[0].outerHTML = '<p>Thank you for submitting your payment information.</p>';
}
},
error: function(jqXHR, textStatus, errorThrown) {
}
});
}
</script>
</head>
<body>
<div class="container">
<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)) {
$site_info = $db->get_results("SELECT phone FROM lc2admin.site WHERE site_code='".$db->clean($siteCode)."'");
?>
<p>This code has expired. Please contact an enrollment specialist at <?= substr($site_info[0]->phone,0,3).'-'.substr($site_info[0]->phone,3,3).'-'.substr($site_info[0]->phone,6,4);?> to send you a new one.</p>
<?php } else {
function convert_offset_to_timezone($offset,$dst) {
$tz = timezone_name_from_abbr(null, $offset * 3600, $dst);
return timezone_abbr_from_name($tz);
}
function timezone_abbr_from_name($timezone_name){
$dateTime = new DateTime();
$dateTime->setTimeZone(new DateTimeZone($timezone_name));
return $dateTime->format('T');
}
$expires_time = date('g:i a',strtotime($res[0]->expires)).' MST';
if(!empty($res[0]->zip)) {
$ares = $db->get_results("SELECT city,state,zip,IF(-8 - CAST(REPLACE(TIMEDIFF(NOW(), UTC_TIMESTAMP()), ':00:00', '') AS SIGNED)=1,timezone+dst,timezone) as timezone, (-8 - CAST(REPLACE(TIMEDIFF(NOW(), UTC_TIMESTAMP()), ':00:00', '') AS SIGNED)=1) as isDst FROM geo.zip_codes WHERE zip='{$res[0]->zip}'");
if(!empty($ares)) {
$arow = $ares[0];
$time_offset = $arow->timezone + 7;
$expires = strtotime($res[0]->expires) + ($time_offset*3600);
if($arow->state=='HI') {
$expires_time = date('g:i a',$expires).' HST';
} else {
$expires_time = date('g:i a',$expires).' '.convert_offset_to_timezone($arow->timezone,$arow->isDst);
}
} else {
$ares = $db->get_results("SELECT state_short,IF(-8 - CAST(REPLACE(TIMEDIFF(NOW(), UTC_TIMESTAMP()), ':00:00', '') AS SIGNED)=1,timezone_offset,timezone_offset) as timezone, (-8 - CAST(REPLACE(TIMEDIFF(NOW(), UTC_TIMESTAMP()), ':00:00', '') AS SIGNED)=1) as isDst FROM geo.states WHERE state_short='{$res[0]->state}'");
if(!empty($ares)) {
$arow = $ares[0];
$time_offset = $arow->timezone + 7;
$expires = strtotime($res[0]->expires) + ($time_offset*3600);
$expires_time = date('g:i a',$expires).' '.convert_offset_to_timezone($arow->timezone,$arow->isDst);
} else {
$expires_time = date('g:i a',strtotime($res[0]->expires)).' MST';
}
}
} else {
$area_code = substr($res[0]->phone_1,0,3);
$ares = $db->get_results("SELECT state,IF(-8 - CAST(REPLACE(TIMEDIFF(NOW(), UTC_TIMESTAMP()), ':00:00', '') AS SIGNED)=1,timezone_offset,timezone_offset) as timezone, (-8 - CAST(REPLACE(TIMEDIFF(NOW(), UTC_TIMESTAMP()), ':00:00', '') AS SIGNED)=1) as isDst FROM geo.area_codes WHERE area_code='{$area_code}'");
if(!empty($ares)) {
$arow = $ares[0];
$time_offset = $arow->timezone + 7;
$expires = strtotime($res[0]->expires) + ($time_offset*3600);
if($arow->state=='Hawaii') {
$expires_time = date('g:i a',$expires).' HST';
} else {
$expires_time = date('g:i a',$expires).' '.convert_offset_to_timezone($arow->timezone,$arow->isDst);
}
} else {
$ares = $db->get_results("SELECT state_short,IF(-8 - CAST(REPLACE(TIMEDIFF(NOW(), UTC_TIMESTAMP()), ':00:00', '') AS SIGNED)=1,timezone_offset,timezone_offset) as timezone, (-8 - CAST(REPLACE(TIMEDIFF(NOW(), UTC_TIMESTAMP()), ':00:00', '') AS SIGNED)=1) as isDst FROM geo.states WHERE state_short='{$res[0]->state}'");
if(!empty($ares)) {
$arow = $ares[0];
$time_offset = $arow->timezone + 7;
$expires = strtotime($res[0]->expires) + ($time_offset*3600);
$expires_time = date('g:i a',$expires).' '.convert_offset_to_timezone($arow->timezone,$arow->isDst);
} else {
$expires_time = date('g:i a',strtotime($res[0]->expires)).' MST';
}
}
}
$is_dst = date('I')*1;
if($is_dst) {
$original_appointment_time = $expires;
$expires_time = str_replace('ST','DT',$expires_time);
if(!empty($arow)) {
if($arow->state=='AZ') {
$expires_time = $original_appointment_time;
}
}
}
?>
<div><i>Secure Payment Form Expires at <strong id="expire_timer"><?= $expires_time;?></strong></i></div>
<form onsubmit="save_cc_info(this); return false;">
<input type="hidden" name="cid" value="<?= $res[0]->id;?>" />
<input type="hidden" name="rid" value="<?= $res[0]->rid;?>" />
<input type="hidden" name="customer_vault_id" value="<?= $res[0]->customer_vault_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">Card Type</div>
<div class="credit_cards">
<label><input type="radio" name="cc_type" value="visa" onclick="change_cc_type();" required style="vertical-align:middle;width:20px;height:20px;" /> <img src="visa.png" style="vertical-align:middle;" /></label>
<label><input type="radio" name="cc_type" value="mast" onclick="change_cc_type();" required style="vertical-align:middle;width:20px;height:20px;" /> <img src="mast.png" style="vertical-align:middle;" /></label>
<label><input type="radio" name="cc_type" value="disc" onclick="change_cc_type();" required style="vertical-align:middle;width:20px;height:20px;" /> <img src="disc.png" style="vertical-align:middle;" /></label>
<label><input type="radio" name="cc_type" value="amex" onclick="change_cc_type();" required style="vertical-align:middle;width:20px;height:20px;" /> <img src="amex.png" style="vertical-align:middle;" /></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">
<div style="display:inline-block;vertical-align:middle;">
<div style="display:inline-block;width:70px;">Expires</div>
<select name="cc_exp_month" style="width:100px;padding:10px 0px;" required>
<option value="">MM</option>
<?php for($i=1;$i<=12;$i++) {?>
<option value="<?= str_pad($i,2,'0',STR_PAD_LEFT);?>"><?= str_pad($i,2,'0',STR_PAD_LEFT);?></option>
<?php } ?>
</select> /
<select name="cc_exp_year" style="width:150px;padding:10px 0px;" required>
<option value="">YYYY</option>
<?php $this_year = date('Y');
$end_year = $this_year*1 + 10;
for($i=$this_year;$i<=$end_year;$i++) { ?>
<option value="<?= $i;?>"><?= $i;?></option>
<?php } ?>
</select>
</div>
<div style="margin-top:10px;">
<div style="display:inline-block;vertical-align:middle;">
<div style="display:inline-block;width:70px;">CVV</div>
<input type="tel" name="cc_cvv" style="width:100px;" required />
</div>
</div>
<div class="cvv_info_not_amex" style="display:none;"><i style="font-size:14px;">* The CVV is a 3 digit number on the back of your card.</i></div>
<div class="cvv_info_amex" style="display:none;"><i style="font-size:14px;">* The CVV is a 4 digit number on the front of your card.</i></div>
</div>
<div class="big_line">
<center><input type="submit" value="Submit" id="submit_button" /></center>
</div>
</form>
<div class="big_line">
<center>
<img src="/vx/usa/pci_form/ssl_logo.png" style="vertical-align:middle;" />
<?php
/*
$cert = '1889703';
if($siteCode=='agf') {
$cert = '1889702';
} elseif($siteCode=='agg') {
$cert = '1889703';
} elseif($siteCode=='fa') {
$cert = '1889711';
} elseif($siteCode=='ggus') {
$cert = '1889708';
} elseif($siteCode=='nusaf') {
$cert = '1889704';
} elseif($siteCode=='nusag') {
$cert = '1889705';
} elseif($siteCode=='usafa') {
$cert = '1889707';
} elseif($siteCode=='usaga') {
$cert = '1889706';
} elseif($siteCode=='usagaorg') {
$cert = '1889709';
}
?>
<a href="//www.securitymetrics.com/site_certificate?id=<?= $cert;?>&tk=b09e62c4cae0d777a4ffbb2d08faa4b0"
target="_blank" rel="noopener noreferrer" style="vertical-align:middle;">
<img src="https://www.securitymetrics.com/static/apps/super/assets/img/PCI_DSS_Validated_blue.2.png"
alt="SecurityMetrics Credit Card Safe" />
</a>
*/ ?>
</center>
</div>
<?php } ?>
</div>
</div>
</body>
</html>