Anyone helps me in this code plz

08/19/2017 01:52 mahmoodrabie26#1
Hello !

I have Silkroad private server and my website donation on superrewards
but I can't make Postback I already contact with superrewards team but said
you need coder so I now ask here for helping
this is my postback code what's wrong with it ?
plz anyone help me
PHP Code:
<?php
/*
    SuperRewards.com App Postback Handling Script for Publishers.
    You will need a web server running PHP and a MySQL database (or MySQL-like database). 
    This script uses PHP's PDO which can be configured to use different database types.
    Installation Instructions:
    1. Fill in the configuration options below.
    2. Place the script on your web server and make sure it is accessible from the Internet. 
        Ex: http://www.example.com/app/postback.php
    3. Automatically setup the database tables for use with this script by passing the setup option in the URL. 
        Ex: http://www.example.com/app/postback.php?setup=1 
    4. Test your integration by sending a Test Postback. 
        See: http://docs.superrewards.com/v1.0/docs/notification-postbacks
    5. Use the information in the database to award in-game currency to your users.
    For more details, see our documentation at: 
    http://docs.superrewards.com/v1.0/docs/getting-started
*/
define('APP_SECRET''b75b2fc7f377c18b95ccd5a65b44c9dc'); // App Secret Key. Find it by going to the Apps page, select Edit on the App of your choice, then Integrate.
define('DB_USER''7omos'); // Your database user.
define('DB_PASSWORD''haMzA$#TesT@RRR%'); // Your database password.
define('DB_HOST''I deleted i'); // Your database host (usually 127.0.0.1).
define('DB_HOST_PORT''39000'); // Your database host port (usually 3306).
define('DB_NAME''WIN-S1R7RLB24F1'); // Your database name.
define('DB_PREFIX'''); // 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');
// If &setup is passed in, setup tables needed to use this script.
if(isset($_REQUEST['setup']))
{
    
$query 
    
"CREATE TABLE IF NOT EXISTS `".DB_PREFIX."transactions` (
    `id` INT NOT NULL,
    `uid` BIGINT,
    `oid` INT,
    `new` INT,
    `time` DATETIME,
    PRIMARY KEY (`id`)) 
    CHARACTER SET utf8 COLLATE utf8_general_ci;
    CREATE TABLE IF NOT EXISTS `"
.DB_PREFIX."users` (
    `uid` BIGINT NOT NULL,
    `total` INT,
    `time` DATETIME,
    PRIMARY KEY (`uid`)) 
    CHARACTER SET utf8 COLLATE utf8_general_ci;"
;
    try 
    {
        
// Connect to Database.
        
$dbh = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME.";port=".DB_HOST_PORTDB_USERDB_PASSWORD, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING ));
        
$query $dbh->prepare($query);
        if(!
$query->execute())
            echo 
"Could not create tables in database: ".DB_NAME." @ ".DB_HOST.'. Check your configuration above.';
        else
            echo 
"Tables setup successfully!";
        
$dbh null;
    }
    catch (
PDOException $e
    {
        exit(
$e->getMessage());
    }
    exit();
}
$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)
{
    
$timestamp date("Y-m-d H:i:s"time());
    try 
    {
        
// Connect to Database.
        
$dbh = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME.";port=".DB_HOST_PORTDB_USERDB_PASSWORD, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING ));
        
// Add new transaction
        
$query $dbh->prepare("INSERT INTO ".DB_PREFIX."transactions(id, uid, oid, new, time) VALUES (:id,:uid,:oid,:new,:time) ON DUPLICATE KEY UPDATE id=:id,uid=:uid,oid=:oid,new=:new,time=:time");
        
$query->bindParam(':id'$idPDO::PARAM_INT);
        
$query->bindParam(':uid'$uidPDO::PARAM_INT);
        
$query->bindParam(':oid'$oidPDO::PARAM_INT);
        
$query->bindParam(':new'$newPDO::PARAM_INT);
        
$query->bindParam(':time'$timestampPDO::PARAM_STR);
        if(!
$query->execute())
            
$result 0// Problems executing SQL. Fail.
        // Add/Update user.
        
$query $dbh->prepare("INSERT INTO ".DB_PREFIX."users(uid, total, time) VALUES (:uid,:total,:time) ON DUPLICATE KEY UPDATE uid=:uid,total=:total,time=:time");
        
$query->bindParam(':uid'$uidPDO::PARAM_INT);
        
$query->bindParam(':total'$totalPDO::PARAM_INT);
        
$query->bindParam(':time'$timestampPDO::PARAM_STR);
        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).
?>
when I enter on my website "http://www."mywebsite".com/postback.php?setup=1" this message appear " Mysql has gone away "

plz help me

anyone help me plz
08/20/2017 07:06 mahmoodrabie26#2
help me plz
08/20/2017 07:14 EdwardTeach+-#3
enable the mysql extension it might be the issue.
i want to see the full code because its like that if the php can't connect to ur mysql database then show message > 'Mysql has gone away'
08/20/2017 07:15 thefear511#4
bump , good luck ^^
08/20/2017 14:10 mahmoodrabie26#5
Quote:
Originally Posted by EdwardTeach+- View Post
enable the mysql extension it might be the issue.
i want to see the full code because its like that if the php can't connect to ur mysql database then show message > 'Mysql has gone away'
can you help me with teamviewer ?

or this my config.php
PHP Code:
<?php
include("sql.php");
include(
"recaptchalib.php");
error_reporting(0);
$publickey  "b75b2fc7f377c18b95ccd5a65b44c9dc";
$privatekey "b75b2fc7f377c18b95ccd5a65b44c9dc";
#########################################################################
###########################Edit this#####################################
######################################################################### 
$host                   "WIN-S1R7RLB24F1";
$user                   "7omos";
$password               "haMzA$#TesT@RRR%";
$database1              "SRO_VT_ACCOUNT";
$database2              "SRO_VT_SHARD";
$database3              "SRO_VT_SHARDLOG";
#########################################################################
###########################Don't touch this##############################
#########################################################################                     
$connectioninfo['Host'] = "$host";
$connectioninfo['User'] = "$user";
$connectioninfo['Pass'] = "$password";
$sql                    = new SQL($connectioninfotrue);
$sql->selectDB($database1);
?>
and the postback code was from superrewards website !