<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once "../config.php";
$result = Array("success"=>0,"hash"=>"");
$data = $_REQUEST["params"];
$hmac = $data[irenHmac::$authParam];
$path = $_REQUEST["path"];
$res = irenHmac::verifyHMac($hmac,$path,$data);
if ($res!==False) {
    $result["success"] = 1;
}
else{
    $string = irenHmac::prepareHMacString($path,$data);
    $hash = irenHmac::createHash($string);
    $result["hash"] = $hash;
}
header('Content-Type: application/json; charset=utf-8');
print json_encode($result);
?>
