Hi, I am trying to make a postback script for super rewards and I can not seem to get it to work.

this is how they tell me to do it.

[Php]
<?
$SECRET= YOUR_SECRET_APP_KEY;

//calculate md5 hash to use for verification
$sig = md5($REQUEST['id'] . ':' . $REQUEST['new'] . ':' . $_REQUEST['uid'] . ':' . $SECRET);

//Do not accept the postback unless your md5 string matches the 'sig' parameter
if ($_REQUEST['sig'] == $sig){

//-step1: query database to check if $REQUEST['id'] value is in database
//-step2: if $
REQUEST['id'] is not in database then update your database to record the 'id' and add the 'new' value to your user's points
//-step2a: if $_REQUEST['id'] is in database then do not update database

/*****************************************
The following are the parameters we provide on in the default postback url:

$REQUEST['id'] This id is unique per transaction. For you to keep records of all our postbacks.
$
REQUEST['total'] This is the total amount of points the user has ever earned through our system.
$REQUEST['new'] This is the amount of points to award your user for this one transaction.
$
REQUEST['uid'] This is the user id to award your points to, this is the same uid parameter in your iframe.
$REQUEST['oid'] This is the id for the offer which they filled out.
$
REQUEST['sig'] This is the security hash used to verify the authenticity of the postback.
*****************************************/

echo "1";
}
else{
echo "0";
}

?>
[/code]

and this is what I got. lt_users is the table. lt_users_balance is where I want the points to go and lt_users_tranid is where i want the unique transaction id to go.


<?php

include_once("utils.php"); 

$SECRET = xxxxxxxxxxxx; 
$sig = md5($_REQUEST['id'] . ':' . $_REQUEST['new'] . ':' . $_REQUEST['uid'] . ':' . $SECRET);
$tranid = $_REQUEST['id'];
$total = $_REQUEST['total'];
$new = $_REQUEST['new'];
$uid = $_REQUEST['uid'];
$oid = $_REQUEST['oid'];


if ($_REQUEST['sig'] == $sig){ 

$query = mysql_query("SELECT * FROM lt_users WHERE lt_users_tranid='$tranid')"); 

if (mysql_num_rows($query) != 0) 
{ 
mysql_query("INSERT INTO lt_users (lt_users_tranid, lt_users_balance) VALUE ('$tranid','$new"); 
} 
else
{
mysql_query("update lt_users set lt_users_balance=lt_users_balance+'$new' where lt_users_id='$uid"); 
} 
   echo "1";
}
else{
       echo "0";
}

?>

    I see atleast 1 mysql error on this line

    $query = mysql_query("SELECT * FROM lt_users WHERE lt_users_tranid='$tranid')");
    

    Where there is a ")" closing paren.

    To say that it doesn't work is a little vague. Whats the problem

      Write a Reply...