SuperRewards Pingback
#1

As many people still try to use PaymentWall but they nolonger support LastChaos you can simply use SuperRewards, they are the same as PaymentWall an offer the same service.

 

2

 

Here is a simple working pingback:

<?php

define('APP_SECRET', ''); // App Secret Key. Find it by going to the Apps page, select Edit on the App of your choice, then Integrate.
define('DB_USER', 'root'); // Your database user.
define('DB_PASSWORD', ''); // Your database password.
define('DB_HOST', '127.0.0.1'); // Your database host (usually 127.0.0.1).
define('DB_HOST_PORT', '3306'); // Your database host port (usually 3306).
define('DB_AUTH', ''); // Your database name.
define('DB_SITE', ''); // Your database name.
define('DB_PREFIX', 't_'); // OPTIONAL: A database table prefix, such as 'app1_'. This easily allows multiple apps to be served from the same database.

error_reporting(E_WARNING);

// *** No more configuration below this line. ***

header('Content-Type:text/plain');

$id = $_REQUEST['id']; // ID of this transaction.
$uid = $_REQUEST['uid']; // ID of the user which performed this transaction.
$oid = $_REQUEST['oid']; // ID of the offer or direct payment method.
$new = $_REQUEST['new']; // Number of in-game currency your user has earned by completing this offer.
$total = $_REQUEST['total']; // Total number of in-game currency your user has earned on this App.
$sig = $_REQUEST['sig']; // Security hash used to verify the authenticity of the postback.

/**
 * Sanity check.
 *
 * If you are using alphanumeric user ids, remove the is_numeric($uid) check. Alphanumeric
 * ids can only be enabled by Super Rewards Support
 *
 * If you are using alphanumeric user ids, please ensure that you use the appropriate URL-encoding
 * for non-text or unicode characters. For example: ~ should be encoded as %7E
 */

if(!(is_numeric($id) && is_numeric($uid) && is_numeric($oid) && is_numeric($new) && is_numeric($total)))
    exit('0'); // Fail.

$result = 1;

$sig_compare = md5($id.':'.$new.':'.$uid.':'.APP_SECRET);

// Only accept if the Security Hash matches what we have.
if($sig == $sig_compare)
{

    try
    {
        // Connect to Database.
        $dbh = new PDO("mysql:host=".DB_HOST.";dbname=".DB_AUTH.";port=".DB_HOST_PORT, DB_USER, '', array( PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING ));

        // Add Cash
        $query = $dbh->prepare("UPDATE bg_user SET cash = cash + :new WHERE user_code = :uid");
        $query->bindParam(':uid', $uid, PDO:TongueARAM_INT);
        $query->bindParam(':new', $cash, PDO:TongueARAM_INT);

        if(!$query->execute())
            $result = 0; // Problems executing SQL. Fail.

        $dbh = null;
    }
    catch (PDOException $e)
    {
        exit($e->getMessage());
    }
}
else
    $result = 0; // Security hash incorrect. Fail.

echo $result;
// This script will output a status code of 1 (Success) or 0 (Try sending again later).
?>



Messages In This Thread
[No subject] - by Sutz - 06-27-2014, 10:06 AM
[No subject] - by luoo - 07-04-2014, 07:55 PM
[No subject] - by Sutz - 07-04-2014, 07:57 PM
[No subject] - by ren0d1 - 07-04-2014, 08:24 PM
[No subject] - by Vogelj1988 - 11-28-2014, 03:14 AM
[No subject] - by bignoob77 - 01-04-2015, 08:20 AM
[No subject] - by KissLC - 04-09-2015, 07:23 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)