<?php
// calling php config file
require("includes/configs.php");
?>
<!--
###########################################################
# #
# D O C U M E N T A T I O N #
# #
# This code sample has been successfully tested on #
# third-party web servers and performed according to #
# documented Advanced Integration Method (AIM) #
# standards. #
# #
# Last updated September 2004. #
# #
# For complete and freely available documentation, #
# please visit the Authorize.Net web site at: #
# #
# http://www.authorizenet.com/support/guides.php #
# #
###########################################################
###########################################################
# #
# D I S C L A I M E R #
# #
# WARNING: ANY USE BY YOU OF THE SAMPLE CODE PROVIDED #
# IS AT YOUR OWN RISK. #
# #
# Authorize.Net provides this code "as is" without #
# warranty of any kind, either express or implied, #
# including but not limited to the implied warranties #
# of merchantability and/or fitness for a particular #
# purpose. #
# #
# #
###########################################################
###########################################################
# #
# P R E R E Q U I S I T E S #
# #
# Basically, all the required code to generate 1) a #
# unique fingerprint, using the HMAC-MD5 algorithm, #
# and 2) a compatible timestamp is included in the #
# sample code provided in this file and the additional #
# files that should have accompanied this file: #
# - simdata.php #
# - simlib.php #
# #
# However, you need to verify that the required PHP #
# MHASH extension is available; otherwise, you will #
# not be able to generate the required fingerprint. #
# #
# The required MHASH extension comes with PHP and #
# requires no additional cost. #
# #
# Most web hosting providers install this extension #
# along with PHP; however, in some circumstances, you #
# may have to enable it yourself or ask your web host #
# to enable it for you. #
# #
# PLEASE UNDERSTAND that it is impossible for us to #
# anticipate any and all possible web server #
# configurations. #
# #
# If you cannot get the sample code to work due to an #
# unknown server configuration or missing PHP extension, #
# and if you cannot figure out how to test for the #
# availability of the required extension, consider #
# hiring a professional web developer or server #
# administrator. #
# #
# Authorize.Net is unable to assist you with web #
# server troubleshooting. #
# #
# #
###########################################################
###########################################################
# #
# C O N T A C T I N F O R M A T I O N #
# #
# For specific questions, #
# please contact Authorize.Net's Integration Services: #
# #
# integration at authorize dot net #
# #
# Please remember that we cannot support individual #
# e-commerce developers with programming problems and #
# other issues that could be easily solved by referring #
# to the available reference materials. #
# #
###########################################################
###########################################################
# #
# S I M I N A N U T S H E L L #
# #
###########################################################
# #
# 1. You gather some basic transaction data on your web #
# site. #
# #
# 2. Using a standard HTML form, you submit the required #
# information to Authorize.Net, by posting the form data #
# to a specific URL on Authorize.Net’s secure server. #
# #
# 3. On Authorize.Net’s secure server, you collect all #
# the financial information on the SIM Payment Form. #
# #
# 4. When the transaction has been completed, you may #
# either re-direct the user to another web page on your #
# web site or complete the transaction on #
# Authorize.Net’s secure server. #
# #
# #
###########################################################
###########################################################
# #
# H A R D C O D E D V A L U E S #
# #
# The purpose of this sample code is to demonstrate how #
# a basic SIM transaction works. #
# #
# For this purpose, we have hard-coded a number of #
# values, to expedite your testing and integration #
# efforts. #
# #
# Please, pay special attention to values, such as #
# your log-in ID, transaction key, amount, description, #
# etc. that may need to be changed throughout this #
# code sample and/or its associated include files. #
# #
# #
###########################################################
-->
<?
if($_REQUEST['x_Amount']==""){
echo "<script>window.location='index.htm'</script>";
}
$x_Description = $HTTP_GET_VARS['x_Description'];
$x_Amount = $HTTP_GET_VARS['x_Amount'];
$x_Description = $_REQUEST['x_Description'];
$x_Amount = $_REQUEST['x_Amount'];
// *** IF YOU WANT TO PASS CURRENCY CODE do the following: ***
// Assign the transaction currency (from your shopping cart) to $currencycode variable
$currencycode="USD";
if ($x_Description == "")
$x_Description = $HTTP_POST_VARS['x_Description'];
if ($x_Amount == "")
$x_Amount = $HTTP_POST_VARS['x_Amount'];
?>
<!-- Description: <?=$x_Description?> <BR />
Total Amount : <?=$x_Amount?> -->
<!-- <FORM action="https://test.authorize.net/gateway/transact.dll" method="POST">
--><!-- Uncomment the line ABOVE for test accounts or BELOW for live merchant accounts -->
<!--<FORM action="https://developer.authorize.net/param_dump.asp" method="POST">-->
<?
// authdata.php contains the loginid and x_tran_key.
// You may use a more secure alternate method to store these (like a DB / registry).
//include ("authorizedotnet/simdata.php");
//include ("authorizedotnet/simlib.php");
$DEBUGGING = 1; # Display additional information to track down problems
$TESTING = 1; # Set the testing flag so that transactions are not live
$ERROR_RETRIES = 2; # Number of transactions to post if soft errors occur
$auth_net_login_id = "2q";
$auth_net_tran_key = "biraj";
$auth_net_url = "https://secure.authorize.net/gateway/transact.dll";
# Uncomment the line ABOVE for test accounts or BELOW for live merchant accounts
# $auth_net_url = "https://secure.authorize.net/gateway/transact.dll";
$firstname = $_POST["txt_firstnatfme"];
$lastname = $_POST["txt_lastname"];
$streetaddress1 = $_POST["txt_address"];
$city = $_POST["txt_city"];
$state = $_POST["txt_state"];
$zip = $_POST["txt_zip"];
$country = $_POST["cmb_country"];
$email = $_POST["txt_email"];
$homephone = $_POST["txt_phone"];
$creditcard_no = $_POST["txt_creditcardno"];
$expiredate = $_POST["cmb_month"].$_POST["cmb_year"];
$invoice_no = date("siHdmY");
$authnet_values = array
(
"x_login" => $auth_net_login_id,
"x_version" => "3.1",
"x_delim_char" => "|",
"x_delim_data" => "TRUE",
"x_url" => "FALSE",
"x_type" => "AUTH_CAPTURE",
"x_method" => "CC",
"x_tran_key" => $auth_net_tran_key,
"x_relay_response" => "FALSE",
"x_card_num" => $creditcard_no,
"x_exp_date" => $expiredate,
"x_description" => $x_Description,
"x_amount" => $x_Amount,
"x_first_name" => $firstname,
"x_last_name" => $lastname,
"x_address" => $streetaddress1,
"x_city" => $city,
"x_state" => $state,
"x_zip" => $zip,
"x_phone" => $homephone,
);
$fields = "";
foreach( $authnet_values as $key => $value ) $fields .= "$key=" . urlencode( $value ) . "&";
$amount = $x_Amount;
// Trim $ sign if it exists
if (substr($amount, 0,1) == "$") {
$amount = substr($amount,1);
}
// I would validate the Order here before generating a fingerprint
// Seed random number for security and better randomness.
srand(time());
$sequence = rand(1, 1000);
// Insert the form elements required for SIM by calling InsertFP
//$ret = InsertFP ($loginid, $x_tran_key, $amount, $sequence);
//*** IF YOU ARE PASSING CURRENCY CODE uncomment and use the following instead of the InsertFP invocation above ***
//$ret = InsertFP ($loginid, $x_tran_key, $amount, $sequence, $currencycode);
// Insert rest of the form elements similiar to the legacy weblink integration
echo ("<input type=\"hidden\" name=\"x_description\" value=\"" . $x_Description . "\">\n" );
echo ("<input type=\"hidden\" name=\"x_login\" value=\"" . $loginid . "\">\n");
echo ("<input type=\"hidden\" name=\"x_amount\" value=\"" . $amount . "\">\n");
// *** IF YOU ARE PASSING CURRENCY CODE uncomment the line below *****
echo ("<input type=\"hidden\" name=\"x_currency_code\" value=\"" . $currencycode . "\">\n");
$_SESSION["description"]=$x_Description;
$_SESSION["length"]=$length;
$_SESSION["unit"]=$unit;
$_SESSION["startdate"]=$startDate;
$_SESSION["amount"]=$amount;
$_SESSION["cardnumber"]=$cardNumber;
$_SESSION["expirationDate"]=$expirationDate;
$_SESSION["name"]=$firstName;
$_SESSION["address"]=$address;
$_SESSION["city"]=$city;
$_SESSION["state"]=$state;
$_SESSION["zip"]=$zip;
$_SESSION["country"]=$country;
?>
<INPUT type="hidden" name="x_customer_ip" value="<?=$_SERVER[REMOTE_ADDR]?>">
<INPUT type="hidden" name="x_first_name" value="<?=$_POST['txt_firstname'];?>">
<INPUT type="hidden" name="x_last_name" value="<?=$_POST['txt_lasttname'];?>">
<INPUT type="hidden" name="x_address" value="<?=$streetaddress1;?>">
<INPUT type="hidden" name="x_city" value="<?=$city;?>">
<INPUT type="hidden" name="x_state" value="<?=$state;?>">
<INPUT type="hidden" name="x_zip" value="<?=$zip;?>">
<INPUT type="hidden" name="x_country" value="<?=$country;?>">
<INPUT type="hidden" name="x_phone" value="<?=$homephone;?>">
<INPUT type="hidden" name="x_fax" value="<?=$fax;?>">
<INPUT type="hidden" name="x_email" value="<?=$email;?>">
<INPUT type="hidden" name="x_delim_data" value="TRUE">
<INPUT type="hidden" name="x_method" value=""> <!--default will be Credit Card(CC)-->
<INPUT type="hidden" name="x_type" value="">
<INPUT type="hidden" name="x_card_num" value="<?=$creditcard_no;?>">
<INPUT type="hidden" name="x_exp_date" value="<?=$expiredate;?>">
<input type='hidden' name='x_invoice_num' value='<?=$invoice_no?>'>
<!-- <INPUT type="hidden" name="x_show_form" value="PAYMENT_FORM"> -->
<INPUT type="hidden" name="x_test_request" value="FALSE">
<INPUT type="hidden" name="x_relay_url" value="http://www.humpanch.com/authorizedotnet_thankyou.html">
<?php
$ch = curl_init("https://secure.authorize.net/gateway/transact.dll");
### Uncomment the line ABOVE for test accounts or BELOW for live merchant accounts
### $ch = curl_init("https://secure.authorize.net/gateway/transact.dll");
curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " )); // use HTTP POST to send form data
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. ###
$resp = curl_exec($ch); //execute post and get results
curl_close ($ch);
?>
<?
//echo "<b>02: Get post results:</b><br>";
//echo $resp;
//echo "<br>";
?>
<!-- <INPUT type="submit" value="Accept Order"> -->
<?php
//$resp_trim=rtrim($resp,"|");
//$resp_trim=str_split($resp, 1);
$resp_trim=explode("|",$resp);
//echo $resp_trim[0];
if($resp_trim[0]!="1"){
$smarty->assign("HIDVAL", "1");
$smarty->assign("MESSAGE","Thank you for signing up. Your Transaction was successful. An email has been sent to <strong>".$_POST['txt_email']."</strong>.");
$_SESSION["firstname"]=$firstname;
$_SESSION["lastname"]=$lastname;
$_SESSION["DESCRIP"]=$x_Description;
echo $_SESSION["DESCRIP"];
$_SESSION["EMAIL"]=$email;
$_SESSION["PHONE"]=$_POST['txt_phone'];
//echo $_SESSION["PHONE"];
$smarty->assign("EMAIL", $_POST['email']);
/*........... SEND MAIL TO CUSTOMERS .......................*/
/* MAIL SENT PHP */
echo $_SESSION["phone"];
if($_SESSION["blk"]!=""){
$blackberry=" ".$_SESSION["blk"]." Blackberry, ";
}
if($_SESSION["sharept"]!=""){
if($_SESSION["sharept"]=="59.95"){
$sharepoint="Additional Package Amount for Sharepoint Platinum 10GB";
}else if($_SESSION["sharept"]=="24.95"){
$sharepoint="Additional Package Amount for Sharepoint Gold 3GB";
}else{
$sharepoint="Additional Package Amount for Sharepoint Silver 500MB";
}
}
if($_SESSION["blackberrySyn"]!=""){
$blackBerrySyn="Blackberry Syncronisation Price";
}
if($_SESSION["blackberrysetupfee"]!=""){
$blkbrysetupfee="Blackberry Setup Fee";
}
if($_SESSION["totalamount"]!=""){
$totalamount="Total Amount";
}
if($_SESSION["mailbox"]==1){
$dmailbox="Mailbox";
}else{
$dmailbox="Mailboxes";
}
if($_SESSION["blk"]>1){
$noblk= "(".$_SESSION["blk"]." Numbers)";
}
$message1 ="<html><head><style type='text/css'>
<!--
.tableOdd {
font-family: 'Lucida Sans';
font-size: 12px;
font-style: normal;
font-weight: bold;
background-color: #DFE9F7;
padding-left:20px;
}
.tableOddC {
font-family: 'Lucida Sans';
font-size: 12px;
font-style: normal;
font-weight: normal;
text-align:right;
background-color: #DFE9F7;
padding-right:20px;
}
.tableEven {
font-family: 'Lucida Sans';
font-size: 12px;
font-style: normal;
font-weight: bold;
background-color: #FFFFFF;
padding-left:20px;
}
.tableEvenC {
font-family: 'Lucida Sans';
font-size: 12px;
font-style: normal;
font-weight: normal;
text-align:right;
background-color: #FFFFFF;
padding-right:20px;
}
.tableTotal {
font-family: 'Lucida Sans';
font-size: 12px;
font-style: normal;
font-weight: bolder;
background-color: #EEEEEE;
padding-left:20px;
}
.tableTotalC {
font-family: 'Lucida Sans';
font-size: 12px;
font-style: normal;
font-weight: bolder;
text-align:right;
background-color: #EEEEEE;
padding-right:20px;
}
-->
</style>";
$message1 .="</head><body bgcolor='#EEEEEE'><br/><br/><center><table border='0' width='60%' bgcolor='#FFFFFF' cellspacing='0'><tr><td style='padding-left:20px; padding-right:20px; padding-top:40px;'><p><table border='0'><tr><td width='70%'><center><img src='http://www.humpanch.com/images/email-logo-mf.gif' width='257' height='77'/></td><td width='15%'> </td><td style='float:left;' width='15%'><span><a href='http://humpanch.com/chats/request.php?l=admin&x=1&deptid=29&pagex=http%3A//www.humpanch.com/' target='_blank'><img src='http://www.humpanch.com/images/livechat-m.gif' border='0' width='120' height='44'></a></span></td></tr></table></p></center><span style='font-weight:normal; font-size:12px; font-family: Lucida Sans';>Hello ".$_SESSION["firstname"]." ".$_SESSION["lastname"]."</span>,<p style='font-weight:normal; font-size:12px; font-family: Lucida Sans';>Thank you for signing up with humpanch. Please do not ignore this e-mail as it contains vital details that will help you in using our <span>services</span>.</p><p style='font-weight:normal; font-size:12px; font-family: Lucida Sans';>If you have not configured your Account Administration Panel yet, then please configure it now by clicking <a href='http://www.humpanch.com/payment-cpanel.html'>here</a>.</p><p style='font-weight:normal; font-size:12px; font-family: Lucida Sans';>Account Administration Panel needs to be configured initially so that you can start using the services you have purchased. Once you have completed the set-up, you can login into your Account Administration Panel at any time to configure the services you have purchased. You also have the option in your Account Administration Panel of purchasing additional services at any time.</p><p style='font-weight:normal; font-size:12px; font-family: Lucida Sans';>You have purchased following services from us.</p>
<table border='0' width='100%'><tr><td>
<table width='100%' border='0' cellspacing='0' cellpadding='2'>";
if($_SESSION["DESCRIP"]=="SharePointSilver"){
$message1 .= "<tr>
<td class='tableOdd' width='60%'>Sharepoint Silver Plan</td>
<td class='tableOddC'>$ 8.95</td>
</tr>";
}else if($_SESSION["DESCRIP"]=="SharePointGold"){
$message1 .= "<tr>
<td class='tableOdd' width='60%'>Sharepoint Gold Plan</td>
<td class='tableOddC'>$ 24.95</td>
</tr>";
}else if($_SESSION["DESCRIP"]=="SharePointPlatinum"){
$message1 .= "<tr>
<td class='tableOdd' width='60%'>Sharepoint Platinum Plan</td>
<td class='tableOddC'>$ 59.95</td>
</tr>";
}else{
$message1 .= "<tr>
<td class='tableOdd' width='60%'>".$_SESSION["description"]." ".$_SESSION["mailbox"]." ".$dmailbox."</td>
<td class='tableOddC'>".$_SESSION["mailboxprice"]."</td>
</tr>";
if($_SESSION["blk"]!=""){
$message1 .="<tr>
<td class='tableEven' width='60%'>".$blackBerrySyn." ".$noblk."</td>
<td class='tableEvenC' width='40%'>".$_SESSION["blackberrySyn"]."</td>
</tr><tr>
<td class='tableOdd' width='60%'>".$blkbrysetupfee." ".$noblk."</td>
<td class='tableOddC' width='40%'>".$_SESSION["blackberrysetupfee"]."</td>
</tr>";
}
if($_SESSION["sharept"]!=""){
$message1 .="<tr>
<td class='tableEven' width='60%'>".$sharepoint."</td>
<td class='tableEvenC' width='40%'>".$_SESSION["sharept"]."</td>
</tr>";
}
$message1 .="<tr>
<td class='tableTotal' width='60%'>".$totalamount."</td>
<td class='tableTotalC' width='40%'>$".$_SESSION["amount"]."</td>
</tr>";
}
$message1 .="</table></td></tr></table></center>";
$message1 .="<p style='font-weight:normal; font-size:12px;font-family: Lucida Sans;'>If you have any questions or need help, please do not hesitate to contact us at <a href='mailto:support@humpanch.com'>support@humpanch.com</a>. You can also visit http://www.humpanch.com or click on the Live Chat icon above to reach us.</p>";
$message1 .="<p style='font-weight:normal; font-size:12px; font-family: Lucida Sans; padding-bottom:40px;'>Regards,<br/>humpanch Team</p></td></tr></table>";
$message1 .="</body></html>";
$message2 ="<strong>Email :</strong>".$_POST['txt_email']."<br/><strong>Phone :</strong>".$_SESSION["PHONE"];
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: For humpanch Sales Team<billing@humpanch.com>' . "\r\n" .
'Reply-To: billing@humpanch.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$smarty->assign("EMAIL", $_POST['email']);
$smarty->assign("MESSAGE2","You will be automatically redirected to setup your Administration Panel after ");
if($_SESSION["firstname"]!=""){
mail('sales@humpanch.com', 'FOR SALES TEAM:humpanch Account Administration Set-up Details
', $message2.$message1, $headers);
mail($_POST['txt_email'], 'humpanch Account Administration Set-up Details
', $message1, $headers);
}
/*--------------Track IP -------------------------*/
$logparameter_date = date("F jS, Y H:i:s");
$logparameter_d = "AIM";
$remote_address = $_SERVER['REMOTE_ADDR'];
$logparameter = $logparameter_date . "Invoice No.".$invoice_no." Method: " . $logparameter_d . " IP: ". $remote_address . " Card Number: ".$creditcard_no." Expire Date: ".$expiredate." Description: ".$x_Description." Amount: ".$x_Amount." First Name ".$firstname." Last Name: ".$lastname." Street Address".$streetaddress1." City:".$city." State: ".$state." Zip :".$zip." Home Phone".$homephone."\n";
error_log($logparameter, 3, "crcard-iptrack.log");
}else{
$smarty->assign("HIDVAL", "0");
$smarty->assign("MESSAGE","<strong><span style='color:#FF0000;'>The Credit Card information entered is invalid. You will be redirected to the home page.</span></strong>");
$smarty->assign("MESSAGE2","You will be redirected to home page after ");
}
/* end */
$smarty->assign("some","");
$smarty->assign("htmltitle","humpanch - Reseller");
// determind which inner body to be displayed
$smarty->assign("innerbody","sim.tpl");
$smarty->display("main.tpl");
session_destroy();
?>