<?php
/*
* This script was writed by Setec Astronomy - hide@address.com
*
* This class allows to generate the MD5 Checksum used to pass orders
* with dynamic prices to the ShareIT.com gateway.
*
* This script is distributed under the GPL License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* http://www.gnu.org/licenses/gpl.txt
*
*/
define ('SHAREIT_TYPE_OF_PRICE_NETT', 'N');
define ('SHAREIT_TYPE_OF_PRICE_GROSS', 'G');
class shareitdynprice {
var $productId = '';
var $prices = array ();
var $typeofprice = SHAREIT_TYPE_OF_PRICE_NETT;
var $password = '';
function getMD5Checksums () {
$prices = implode (',', $this->prices) . ',' .$this->typeofprice;
$string = $this->productId . '#' . $prices . '#' . $this->password;
return md5 ($string);
}
function addPrice ($price) {
$this->prices[] = $price;
}
}
/* // sample code
$shareitdynprice = new shareitdynprice ();
$shareitdynprice->productId = 'your product id';
$shareitdynprice->typeofprice = SHAREIT_TYPE_OF_PRICE_NETT;
$shareitdynprice->password = 'your password';
$shareitdynprice->addPrice ('one product price'); // i.e. 10EUR or 12USD etc.
print ($shareitdynprice->getMD5Checksums ());
*/
?>