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.

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";
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.