cybermut_testmac
(PHP 4 >= 4.0.5, PECL cybermut:1.0-1.1)
cybermut_testmac — Assicura che non siano contenuti dati manipolati nel messaggio di conferma ricevuto
Descrizione
bool cybermut_testmac
( string $code_MAC
, string $version
, string $TPE
, string $cdate
, string $montant
, string $ref_commande
, string $texte_libre
, string $code-retour
)
cybermut_testmac() è usato per assicurare che non siano contenuti dati manipolati nel messaggio di conferma ricevuto. Prestate attenzione ai parametri code-retour e texte-libre , che non possono essere valutati tal quali, a causa del trattino. Dovete recuperarli usando:
<?php
$code_retour=$HTTP_GET_VARS["code-retour"];
$texte_libre=$HTTP_GET_VARS["texte-libre"];
?>
Example#1 Ultimo passaggio del pagamento (equiv cgi2.c)
<?php
// Make sure that Enable Track Vars is ON.
// Directory where are located the keys
putenv("CMKEYDIR=/var/creditmut/cles");
// Version number
$VERSION="1.2";
$texte_libre = $HTTP_GET_VARS["texte-libre"];
$code_retour = $HTTP_GET_VARS["code-retour"];
$mac_ok = cybermut_testmac($MAC,$VERSION,$TPE,$date,$montant,$reference,$texte_libre,$code_retour);
if ($mac_ok) {
//
// insert data processing here
//
//
$result=cybermut_creerreponsecm("OK");
} else {
$result=cybermut_creerreponsecm("Document Falsifie");
}
?>
Vedere anche cybermut_creerformulairecm() e cybermut_creerreponsecm().