oskarkxyz 0 Newbie Poster

Hello.

I am user of CPAgrip and they gave us postback so I wanted to use it. Everytime when my server gets postback I want my user who is reponsible for it get points. Let's start.

Variables sent in postback: http://scr.hu/1htz/yo1co

Example from affilate network:

    <?php
    if($_POST['password'] != 'secretpassword'){
        echo "Access Denied.";
        exit;


}
mysql_query("UPDATE users SET total=total+".$_POST['payout']." WHERE tracking_id=".$_POST['tracking_id'],$db);
?>

What I made so far

<?php



$link = mysql_connect('host', 'login', 'pass'); //connecting to mySQL
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';


if($_POST['password'] != 'secretpassword'){ //if password is same from postback settings then it go ahead.
    echo "Access Denied.";
    exit;
}

mysql_query("UPDATE sql_oskarkxyz_lol.wp_usermeta SET meta_value=meta_value+".$_POST['payout']." WHERE (user_id, meta_key) AND (".$_POST['tracking_id'].", mycred_default )", $db);
?>

So I wanted to update tabel "wp_usermeta" from sql_oskarkxyz_lol database. Every time when I get postback I want my user to get more points. I got double clause because if I would leave only ID then I would messed up everything because theres a lot fields with same ID. Mycred_default is this second clause to make sure that it won't mess up.

So even when I am trying it... it doesn't work. We got simulator and seems everything is fine. It's connect to mySQL but nothing more, I am getting blank response. I heard it's because no echo after connecting but MySQL doesn't update at all. Could someone help me here?

Regreds,
Oskar

Be a part of the DaniWeb community

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