Error md5 offertoro [closed]

-4

Well I'm creating a site, where users earn points by completing offers, and by completing the system it gives points.

However I have the following code:

<?php
$oid = $_GET["oid"];
$amount = $_GET["amount"];
$id = $_GET["userid"];
$payout = $_GET["payout"];
$sig = $_GET["sig"];
$key = "Minha key";
$secret = md5($oid  + "-" + $id + "-" + $key);
$postback = 1;

if($secret == $sig){

    echo $postback;

}



?>

In other words, if the sig is equal to the secret, the user is credited with points, however I am testing directly from the offeror's website and this is not working, that is to say that sig is different from secret , that means there's something wrong with the secret.

I was wondering if function md5 is respecting the parameters, or if something is wrong.

Key = 756ddad67f428a1db92ee0a2870005a4

Here is where I got this:

link

Just pull down they find.

Thank you.

    
asked by anonymous 21.03.2016 / 00:14

1 answer

2

You can not do many tests with what was posted in the question, but one thing is certain: in PHP, + is not used to concatenate strings .

This line has problems:

$secret = md5( $oid  + "-" + $id + "-" + $key );

The correct one:

$secret = md5( $oid . "-" . $id . "-" . $key );

Another problem, _ was missing on this line:

$id = $_GET["user_id"];

Remember that spaces and upper-case also make a difference to md5

    
21.03.2016 / 01:08