如何使用PHP回发

How to postback with PHP

提问人:busooCombo 提问时间:4/29/2022 更新时间:4/29/2022 访问量:403

问:

我得到这个网址到我的 php 服务器:

https://example.com/index.php?status=1&trans_id=10081975462&user_id=WrUbd8WXgrcVrvP0AtaSgHmatMw2&amount_local=175.0000&amount_usd=0.50&offer_id=1&hash=59e5e01bb8d43a59dfa916de06aab9eb&ip_click=78.122.32.238

为了从查询URL中检索参数,我这样做了:

$status = $_GET['status'];
$trans_id = $_GET['trans_id'];
$user_id = $_GET['user_id'];
$amount_local = $_GET['amount_local'];
$amount_usd = $_GET['amount_usd'];
$offer_id = $_GET['offer_ID'];
$hash = $_GET['secure_hash'];
$ip_click = $_GET['ip_click'];

然后文档告诉我:

{secure_hash} 这里我们有一个哈希值,你可以验证请求,该哈希值是 MD5 哈希值:

示例:md5({trans_id}-yourappsecurehash)

{secure_hash} 是$hash = $_GET['secure_hash'];

yourappsecurehash这是我的私人哈希值,在我的仪表板中与我的应用程序明显关联

我不确定我是否正确理解了这一部分,但这是我的代码:

$app_secure_hash = "xxxxxxxxxxx";

if (md5($status.$trans_id.$user_id.$amount_local.$amount_usd.$offer_id.$hash.$ip_click) != $app_secure_hash) {
        
   echo "500";
       
} else {

   echo "200";
       
}

它总是返回echo "500";

你有解决方案吗?

下面是网站上薄弱文档的照片

https://i.stack.imgur.com/kAhrj.jpg

PHP 回调 回发

评论

0赞 Ken Lee 4/29/2022
你只需要md5的吗?(并且不要在 $status.$trans_id.$user_id.$amount_local.$amount_usd.$offer_id 上执行 md5..... ){trans_id}-yourappsecurehash

答:

0赞 B. Desai 4/29/2022 #1

从文档中,您只需要检查所有参数,而不是所有参数。此外,您可能必须更改条件。因此,请尝试以下代码trans_id

$app_secure_hash = "xxxxxxxxxxx";

if (md5($trans_id.'-'.$app_secure_hash) != $hash) {
        
   echo "500";
       
} else {

   echo "200";
       
}