<?php
define('IDCOMPTE', '394953');
define('URLCSS1', 'http://sd-20614.dedibox.fr/~jabella/ubisoft/cssperso/base1.css');
define('URLCSS2', 'http://sd-20614.dedibox.fr/~jabella/ubisoft/cssperso/base2.css');
define('APISECRETKEY', '6fa9c299b26df2e359318f2359f4b64c');
define('IDSITE', '285913');
define('IDDOCUMENT', '1227475');
	 
function process_hmac($apiKey, $url)
	{
	    $params['ids']          = IDSITE;
	    $params['idd']          = IDDOCUMENT;
	    $params['ucs']          = base64_encode($url);
	    $params['idc']          = IDCOMPTE;
	 
	    ksort($params);
	 
	return sha1(http_build_query($params).$apiKey);    
	}

$hmac1 = process_hmac(APISECRETKEY, URLCSS1);
$hmac2 = process_hmac(APISECRETKEY, URLCSS2);
//echo "<br> UCS: " . base64_encode(URLCSS1);
//echo "<br> HMAC: " . $hmac;

//https://payment.allopass.com/acte/sms/purchase.apu?ids=285913&idd=1190193&ucs=aHR0cDovL3NkLTIwNjE0LmRlZGlib3guZnIvfmphYmVsbGEvYW5rYW1hL2Nzc3BlcnNvL2Jhc2UuY3Nz&hmac=a3524e36faaf74c4cc86a9e38e196b654c2509ee
$url1 = "http://payment.allopass.com/acte/sms/purchase.apu?ids=285913&idd=1227475&ucs=" . base64_encode(URLCSS1) . "&hmac=" . $hmac1;
echo "<br><a href='".$url1."' target='_blank'>Test 1</a>";
$url2 = "http://payment.allopass.com/acte/sms/purchase.apu?ids=285913&idd=1227475&ucs=" . base64_encode(URLCSS2) . "&hmac=" . $hmac2;
echo "<br><a href='".$url2."' target='_blank'>Test 2</a>";
?>