Reputation: 31
The resultant hashcode was requested by a payments processor. I already had most of the information they requested posting correctly, now they require this hashcode. I don't understand the format of the POST request, nor which variable the snippet of code is creating. If I run it in a form, what is the value of the hashcode?
For example <input type="hidden" name="hash" value="<?php ($WhatGoesHere); ?>" />
<?php
$storename = "TEST_STORE";
$sharedSecret = "777777777777777700000000000000005555555555555555";
date_default_timezone_set("America/Chicago");
$timezone = "CDT";
$dateTime = date("Y:m:d-H:i:s");
function getDateTime() {
global $dateTime;
return $dateTime;
}
function getTimezone() {
global $timezone;
return $timezone;
}
function getStorename() {
global $storename;
return $storename;
}
function createHash($chargetotal) {
global $storename, $sharedSecret;
$str = $storename . getDateTime() . $chargetotal . $sharedSecret;
for ($i = 0; $i < strlen($str); $i++){
$hex_str.=dechex(ord($str[$i]));
}
return hash('sha256', $hex_str);
}
?>
Thank you in advance.
Upvotes: 0
Views: 96
Reputation: 2061
I see 4 different options:
SESSION
POST
I recommend not to use global
Upvotes: 1