使用 PHP Lootably 进行回发

问题描述 投票:0回答:0

我想将 Lootably 积分墙集成到我的网站,但我遇到了回发问题。 我的回发有什么问题?我认为这是因为哈希验证。 代码:

抢劫要求: 默认情况下,调用时不会将任何参数附加到您的回发 URL。相反,您可以使用以下任何一种 参数宏根据需要将数据子数据放入您的回发 URL:

  • {userID}
    - 在集成 URL 中传递给我们的用户 ID
  • {transactionID}
    - 我们数据库中此转换的 transactionID
  • {ip}
    - 用户的IP
  • {offerName}
    - 用户完成的报价名称
  • {offerID}
    - 用户完成的报价 ID
  • {numericOfferID}
    - 用户完成的报价 ID,但已删除所有非数字字符
  • {revenue}
    - 您从这次转换中获得的收入(以美元为单位)
  • {currencyReward}
    - 用户应获得的货币数量作为奖励。这可以在“货币”选项卡上配置
  • {status}
    - 交易状态:“1”为转化,“0”为退款
  • {sid2}
    - 作为“sid2”查询参数传递到积分墙/api 条目 URL 的值。不受支持的商品将返回一个空字符串作为此参数的值。
  • {sid3}
    - 作为“sid3”查询参数传递到积分墙/api 条目 URL 的值。不受支持的商品将返回一个空字符串作为此参数的值。
  • {sid4}
    - 作为“sid4”查询参数传递到积分墙/api 条目 URL 的值。不受支持的商品将返回一个空字符串作为此参数的值。
  • {sid5}
    - 作为“sid5”查询参数传递到积分墙/api 条目 URL 的值。不受支持的商品将返回一个空字符串作为此参数的值。
  • {hash}
    - 此回发的 SHA256 哈希(见下文)

回发可以通过 SHA256 哈希进行验证,使用这种格式生成:

JavaScript

sha256(userID + ip + revenue + currencyReward + "nSUoyFIGBN1CDcO0F4np5Dld21fpQERqHgKlKu7rXiWb0j2KSWNvP2b9Wf3o7eGcGGovSmmdCTdiPf3v1g")

PHP

hash("sha256", userID . ip . revenue . currencyReward . "nSUoyFIGBN1CDcO0F4np5Dld21fpQERqHgKlKu7rXiWb0j2KSWNvP2b9Wf3o7eGcGGovSmmdCTdiPf3v1g")

我试过这段代码

$userID = $_REQUEST['userID'];
$transactionID = $_REQUEST['transactionID']; 
$ip = $_REQUEST['ip']; 
$offerName = $_REQUEST['offerName']; 
$offerID = $_REQUEST['offerID']; 
$numericOfferID = $_REQUEST['numericOfferID']; 
$revenue = $_REQUEST['revenue'];
$currencyReward = $_REQUEST['currencyReward'];
$status = $_REQUEST['status'];
$sid2 = $_REQUEST['sid2'];
$sid3 = $_REQUEST['sid3'];
$sid4 = $_REQUEST['sid4'];
$sid5 = $_REQUEST['sid5'];
$hash = $_REQUEST['hash'];

$secret_key = hash("sha256", $userID . $ip . $revenue . $currencyReward . "nSUoyFIGBN1CDcO0F4np5Dld21fpQERqHgKlKu7rXiWb0j2KSWNvP2b9Wf3o7eGcGGovSmmdCTdiPf3v1g");


if($secret_key != $hash){
    
    die('signature_problem');
    echo 0;
    
} else{
    $update = $db->query('UPDATE `members` SET points=points+'.$currencyReward.' WHERE id = '.$userID);
    echo 1;
}
php postback
© www.soinside.com 2019 - 2024. All rights reserved.