Location: PHPKode > scripts > PHP Hosting Directory > phphost_directoryv2/include/payments/authorize.php
<?


###############################################################################################################
function hmac ($key, $data)
{
  return (bin2hex (mhash(MHASH_MD5, $data, $key)));
}

function CalculateFP ($loginid, $txnkey, $amount, $sequence, $tstamp, $currency = "")
{
  return (hmac ($txnkey, $loginid . "^" . $sequence . "^" . $tstamp . "^" . $amount . "^" . $currency));
}
###############################################################################################################

$username = $_COOKIE['logged'];
mysql_query("INSERT INTO `hsl_order` VALUES ('', '$username', '".$vars['price_id']."', 'Processing', 'Not finished by user', 'authorize', NOW())");
$order_id = mysql_insert_id();

$amount       = mysql_result(mysql_query("SELECT `price` FROM `hsl_price` WHERE `price_id`='".$vars['price_id']."'"), 0, 0);
$description  = "Upgrade account";

srand(time());

$fp_sequence  = rand(1, 1000);
$fp_timestamp = time();
$fp_hash      = CalculateFP ($config['AuthorizeLogin'], $config['AuthorizeTransactionKey'], $amount, $fp_sequence, $fp_timestamp);

$t->assign('x_fp_hash', $fp_hash);
$t->assign('x_fp_sequence', $fp_sequence);
$t->assign('x_fp_timestamp', $fp_timestamp);

$t->assign('x_amount', $amount);
$t->assign('x_description', $description);

$t->assign('order_id', $order_id);

$t->assign('authorize', $authorize);

?>
Return current item: PHP Hosting Directory