<?php
include_once ("securityAuthParam.php");
// This exemple query string is a encode64 param
define("PRIVATEKEY", "Marcelo Costa");
define("HASHMODE","ripemd160");// opcional default are ripemd160
define("AUTHMODE", "AUTHARRAY");// opcional default are AUTHARRAY
$Objeto = new securityAuthParam();
// Check ecode auth string in request
if(array_key_exists('param', $_REQUEST))
{
echo "DECODE REQUEST<br>\r\n";
try {
$CHECK=$Objeto->decodeAuthParam($_REQUEST['param']);
if($CHECK==true)
{
echo "query string ok<br/>\r\n";
var_export($CHECK);
echo "\r\n<br/><br/>";
}
} catch (Exception $e) {
echo "invalid param auth";
}
}
echo "New array for encode encode<br/><br/>\r\n";
$rand = rand();
$queryArray = array (
"id" => 321,
"date" => date('d/m/y'),
"randon" => $rand
);
var_export($queryArray);
$param=$Objeto->encodeAuthParam($queryArray);
$paramlegth="param=".$param;
echo "<br/><br/>Encode => ".$param."<br/>\r\n";
echo "<br/>param length =" . strlen($paramlegth) . " chars,<a href=\"?param=".$param ."\">clique here for decode</a><br/><br/>\r\n";
?>
|