Hello,
I have an older payment form on a client's website that we inherited. The form collects the basic customer data along with the amount they are going to pay. The form action is a post to 'authorize_sim_send.php'. This seems to be a legacy method, but it has been working fine for the client. We want to add a Captcha to the website form, but I can't seem to get it to work. I can insert the captcha and script and it will display just fine, but I'm at a loss as to the correct code to add to the above referenced file to get it to work. I've added the code below. I appreciate any guidance anyone can provide.
<?php
require_once('config.inc.php');
require_once('functions.inc.php');
if ( count($_POST) < 1 ) die(';)');
foreach ( $_POST as $k => $v ){
if ( is_array( $v ) ){
foreach ( $v as $k1 => $v1 ){
$$k[$k1] = $v1;
}
}
else{
$$k = $v;
}
}
// Receive the posted amount and format it as a dollar amount without the currency symbol
$amount = number_format(trim($chargetotal,"$"),2);
// Generate a random sequence number
$sequence = rand(1, 1000);
// Generate a timestamp
$timestamp = time();
// Generate an invoice
$invoice = date('YmdHis');
if ( @!session_start() ){
$mytimeout = 720 * 60; // minutes * 60
@session_set_cookie_params($mytimeout);
$sessdir = "/tmp";
@ini_set('session.save_path', $sessdir);
@session_cache_expire($mytimeout / 60);
@ini_set('session.gc_maxlifetime', $mytimeout);
}
// Getting Customer ID
$customer = @session_id();
// CURL timeout
$timeout = 30;
// The following lines generate the SIM fingerprint. PHP versions 5.1.2 and
// newer have the necessary hmac function built in. For older versions, it
// will try to use the mhash library.
if( phpversion() >= '5.1.2' )
$fingerprint = hash_hmac("md5", x_login . "^" . $sequence . "^" . $timestamp . "^" . $amount . "^", x_transaction_key);
else
$fingerprint = bin2hex(mhash(MHASH_MD5, x_login . "^" . $sequence . "^" . $timestamp . "^" . $amount . "^", x_transaction_key));
$parms = array();
//$parms['x_ship_to_first_name'] =
$parms['x_first_name'] = ( isset( $fname ) && strlen( trim( $fname ) ) > 0 )? Slug ($fname ) : '';
//$parms['x_ship_to_last_name'] =
$parms['x_last_name'] = ( isset( $fname ) && strlen( trim( $fname ) ) > 0 )? Slug ($lname ) : '';
$address = "";
if ( isset( $address1 ) && strlen( $address1 ) > 0 ){
if ( strlen( trim( $address ) ) > 0 ) $address .= ", ";
$address .= $address1;
}
if ( isset( $address2 ) && strlen( $address2 ) > 0 ){
if ( strlen( trim( $address ) ) > 0 ) $address .= ", ";
$address .= $address2;
}
//$parms['x_ship_to_address'] =
$parms['x_address'] = $address;
//$parms['x_ship_to_city'] =
$parms['x_city'] = ( isset( $city ) )? substr( Slug( $city ), 0, 40 ) : '';
//$parms['x_ship_to_state'] =
$parms['x_state'] = ( isset( $state ) )? substr( Slug( $state ), 0, 40 ) : '';
//$parms['x_ship_to_country'] =
$parms['x_country'] = 'US';
$phone = "";
if ( isset( $phone1 ) && strlen( $phone1 ) > 0 ){
$phone .= $phone1;
}
if ( isset( $phone2 ) && strlen( $phone2 ) > 0 ){
$phone .= $phone2;
}
if ( isset( $phone3 ) && strlen( $phone3 ) > 0 ){
$phone .= $phone3;
}
$parms['x_phone'] = Slug( $phone );
$parms['x_email'] = ( isset( $email ) )? $email : '';
//$parms['x_ship_to_zip'] =
$parms['x_zip'] = ( isset( $zip ) )? $zip : '';
$parms['x_fax'] = ( isset( $fax ) )? $fax : '';
$parms['x_company'] = ( isset( $company ) )? $company : '';
$description = "";
if ( isset( $acnumber ) && strlen( $acnumber ) > 0 ){
if ( strlen( trim( $description ) ) > 0 ) $description .= ", ";
$description .= "Account Number: ".$acnumber;
}
$mobile = "";
if ( isset( $mobile1 ) && strlen( $mobile1 ) > 0 ){
$mobile .= $mobile1;
}
if ( isset( $mobile2 ) && strlen( $mobile2 ) > 0 ){
$mobile .= $mobile2;
}
if ( isset( $mobile3 ) && strlen( $mobile3 ) > 0 ){
$mobile .= $mobile3;
}
if ( strlen( $mobile ) > 0 ){
if ( strlen( trim( $description ) ) > 0 ) $description .= ", ";
$description .= "Cell Phone: ".$mobile;
}
if ( isset( $idate ) && strlen( $idate ) > 0 ){
if ( strlen( trim( $description ) ) > 0 ) $description .= ", ";
$description .= "Invoice Date: ".$idate;
}
if ( isset( $iamount ) && strlen( $iamount ) > 0 ){
if ( strlen( trim( $description ) ) > 0 ) $description .= ", ";
$description .= "Invoice Amount: $".number_format(trim($iamount,"$"),2);
}
if ( strlen( trim( $description ) ) < 1 ) $description = "No description";
$parms['x_description'] = $description;
$parms['x_version'] = x_version;
$parms['x_login'] = x_login;
$parms['x_amount'] = $amount;
$parms['x_type'] = x_type;
$parms['x_method'] = x_method;
$parms['x_duplicate_window'] = x_duplicate_window;
$parms['x_cust_id'] = $customer;
$parms['x_test_request'] = ( stristr( gateway_mode, 'TEST' ) )? 'TRUE' : 'FALSE';
$parms['x_fp_sequence'] = $sequence;
$parms['x_fp_hash'] = $fingerprint;
$parms['x_fp_timestamp'] = $timestamp;
$parms['x_show_form'] = x_show_form;
$parms['x_invoice_num'] = $invoice;
$parms['x_relay_response'] = x_relay_response;
$parms['x_header_html_payment_form'] = ( @file_exists( x_header_html_payment_form ) )? file_get_contents( x_header_html_payment_form ) : '';
$parms['x_footer_html_payment_form'] = ( @file_exists( x_footer_html_payment_form ) )? file_get_contents( x_footer_html_payment_form ) : '';
$parms['x_receipt_link_method'] = x_receipt_link_method;
$parms['x_receipt_link_text'] = x_receipt_link_text;
$parms['x_receipt_link_url'] = x_receipt_link_url;
$parms['x_header_html_receipt'] = ( @file_exists( x_header_html_receipt ) )? file_get_contents( x_header_html_receipt ) : '';
$parms['x_footer_html_receipt'] = ( @file_exists( x_footer_html_receipt ) )? file_get_contents( x_footer_html_receipt ) : '';
$parms['x_email_customer'] = x_email_customer;
$parms['x_header_email_receipt'] = ( @file_exists( x_header_email_receipt ) )? file_get_contents( x_header_email_receipt ) : '';
$parms['x_footer_email_receipt'] = ( @file_exists( x_footer_email_receipt ) )? file_get_contents( x_footer_email_receipt ) : '';
$parms['x_logo_url'] = x_logo_url;
$parms['x_color_link'] = x_color_link;
$parms['x_color_text'] = x_color_text;
$parms['x_customer_ip'] = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$url = ( stristr( gateway_environment, 'TEST' ) )? "https://test.authorize.net/gateway/transact.dll" : "https://secure.authorize.net/gateway/transact.dll";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>abc.com - Payments</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="robots" content="index" />
<meta name="robots" content="follow" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body onload="document.forms[0].submit();">
<FORM NAME="f" METHOD=POST ACTION="<?=$url?>">
<?php
foreach ( $parms as $k => $v ){
echo "<INPUT TYPE=HIDDEN NAME=\"$k\" VALUE=\"$v\">";
}
?>
</FORM>
</body>
</html>
โ05-21-2026 11:19 AM