0

Ok I need help setting up a postback script in PHP for an affiliate program.

Example:

http://example.com//postback.php?appId=2798&userId=12345&amount=10&hash=8b44493ab7b37a6e47ca2f8726b87563

How would I script something that would take the postback info and look up the user and give them the amount shown while checking the hash. I am very confused by all this and very new. I also need it to reply to the poastback with a 1 for success and 0 for failure.

Edited by iWalletMobile: n/a

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by iWalletMobile
0

Ok I need help setting up a postback script in PHP for an affiliate program.

Example:

http://example.com//postback.php?appId=2798&userId=12345&amount=10&hash=8b44493ab7b37a6e47ca2f8726b87563

How would I script something that would take the postback info and look up the user and give them the amount shown while checking the hash. I am very confused by all this and very new. I also need it to reply to the poastback with a 1 for success and 0 for failure.

So I wrote something up really fast but not sure if it would work...anyone care to check?

<?

//check md5
$SECRET = '***************************';
$sig = md5([USER_ID]+":"+[APP_ID]+":"+[SECRET_KEY]),

if($_REQUEST['sig'] == $sig) {
    $userdata = GetUserInfo($_REQUEST['USER_ID']);
    $conn = ConnectDB();
    $res = mysql_query('UPDATE users SET iwallet_points + '.$_REQUEST['AMOUNT'].' WHERE id = '.$_REQUEST['USER_ID'].''. $connection);
    if($res){
        print "1";
        }else{
        print "0";
    }
    }else{
        print "0";
    }

Edited by iWalletMobile: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.