Superrewards api postback werkt niet

Gestart doorFunkyraar15 reacties48 weergaven

16 berichten · pagina 1 van 2

Funkyraar

Lid · Topicstarter

Berichten
438
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,
Ik ben bezig met mijn website alleen de superrewards postback werkt niet.

Ik kan als admin de api testen en de api zelf werkt gewoon maar ik krijg geen punten!

Wat doe ik verkeerd? Hier de code:

Codeblok (voorbeeld.php):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135



/*
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 PHPs 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://support.playerize.com/entries/22612522-Publishers-Signing-Up-and-Getting-Started#postback_test
5. Use the information in the database to award in-game currency to your users.

For more details, see our documentation at:
http://support.playerize.com/entries/22612522-Publishers-Signing-Up-and-Getting-Started
*/


define(APP_SECRET, Deze heb ik 100% Zeker goed ingevuld!); // App Secret Key. Find it by going to the Apps page, select Edit on the App of your choice, then Integrate.
define(DB_USER, Deze heb ik 100% Zeker goed ingevuld!); // Your database user.
define(DB_PASSWORD, Deze heb ik 100% Zeker goed ingevuld!); // 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_NAME, Deze heb ik 100% Zeker goed ingevuld!); // 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_PORT, DB_USER, DB_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(!(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_PORT, DB_USER, DB_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, $id, PDO::PARAM_INT);
$query->bindParam(:uid, $uid, PDO::PARAM_INT);
$query->bindParam(:oid, $oid, PDO::PARAM_INT);
$query->bindParam(:new, $new, PDO::PARAM_INT);
$query->bindParam(:time, $timestamp, PDO::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, $uid, PDO::PARAM_INT);
$query->bindParam(:total, $total, PDO::PARAM_INT);
$query->bindParam(:time, $timestamp, PDO::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).

?>
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Voeg een MySQLi error toe?
0
Funkyraar

Lid · Topicstarter

Berichten
438
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Voeg een MySQLi error toe?
Waar als ik vragen mag? Want hij geeft geen error.
0
Berichten
1.871
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Voeg een MySQLi error toe?
Hij gebruikt PDO voor de database connectie, dus MySQLi slaat al nergens op.

Tevens worden de eventuele fouten (van de database) dacht ik weergegeven bij regel 123?

Codeblok (voorbeeld.php):

123
124
125
126

catch (PDOException $e)
{
exit($e->getMessage());
}
0
Funkyraar

Lid · Topicstarter

Berichten
438
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Op een of andere manier veranderd hij UPoints niet. Daar zouden voor het testen 80 punten bij komen maar die komen er niet bij. Ook heb ik al geprobeerd $total te veranderen in 80 zodat hij gewoon direct 80 punten dee... maar die punten kwamen er ook niet bij.
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Je hebt ook nergens een update-query
0
Funkyraar

Lid · Topicstarter

Berichten
438
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Je hebt ook nergens een update-query
En waar zou die dan moeten? De code staat er je kan hem zo bewerken en mij laten zien wat er veranderd moet worden.

Vanaf nu: De oplossing krijgt 1 punt! Alleen de gene die het antwoord geeft. Als iemand een antwoord onduidelijk geeft en daarna iemand anders die het precies laat zien dan is de gene die het precies heeft laten zien de gene die 1 punt krijgt!
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Oh, je had wel een UPDATE query, regel 114.

Probeer es:

$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 WHERE uid=:uid");
@ regel 114
0
Funkyraar

Lid · Topicstarter

Berichten
438
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Oh, je had wel een UPDATE query, regel 114.

Probeer es:

$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 WHERE uid=:uid");
@ regel 114
Nee het werkt nog niet jammer genoeg...

Echt raar

toevoeging op 22 december 2013, 22:08:20:
Blumb
0
Funkyraar

Lid · Topicstarter

Berichten
438
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
bumbb
0
Berichten
3.425
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Funkyraar schreef:
Op een of andere manier veranderd hij UPoints niet. Daar zouden voor het testen 80 punten bij komen maar die komen er niet bij. Ook heb ik al geprobeerd $total te veranderen in 80 zodat hij gewoon direct 80 punten dee... maar die punten kwamen er ook niet bij.
Komt omdat het uCoins zijn..?
gratis-servers? was mijn site hea.. emo
toevoeging op 23 december 2013, 21:03:59:

Codeblok (voorbeeld.php):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135



/*
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 PHPs 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://support.playerize.com/entries/22612522-Publishers-Signing-Up-and-Getting-Started#postback_test
5. Use the information in the database to award in-game currency to your member_accounts.

For more details, see our documentation at:
http://support.playerize.com/entries/22612522-Publishers-Signing-Up-and-Getting-Started
*/


define(APP_SECRET, 95f77be74527411144e87fbb44810bc1); // App Secret Key. Find it by going to the Apps page, select Edit on the App of your choice, then Integrate.
define(DB_USER, riick_BwsrtgVqz2); // Your database user.
define(DB_PASSWORD, f8WCWQHz); // Your database password.
define(DB_HOST, localhost); // Your database host (usually 127.0.0.1).
define(DB_HOST_PORT, 3306); // Your database host port (usually 3306).
define(DB_NAME, riick_BwsrtgVqz2); // 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."member_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."member_accounts` (
`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_PORT, DB_USER, DB_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(!(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_PORT, DB_USER, DB_PASSWORD, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING ));

// Add new transaction
$query = $dbh->prepare("INSERT INTO ".DB_PREFIX."member_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, $id, PDO::PARAM_INT);
$query->bindParam(:uid, $uid, PDO::PARAM_INT);
$query->bindParam(:oid, $oid, PDO::PARAM_INT);
$query->bindParam(:new, $new, PDO::PARAM_INT);
$query->bindParam(:time, $timestamp, PDO::PARAM_STR);
if(!$query->execute())
$result = 0; // Problems executing SQL. Fail.

// Add/Update user.

mysql_query("UPDATE member_accounts SET uCoins = uCoins + $total WHERE uId = " . mysql_real_escape_string($_SESSION[uId]) . "");
$query = $dbh->prepare("INSERT INTO ".DB_PREFIX."member_accounts(uid, total, time) VALUES (:uid,:total,:time) ON DUPLICATE KEY UPDATE uid=:uid,total=:total,time=:time");
$query->bindParam(:uid, $uid, PDO::PARAM_INT);
$query->bindParam(:total, $total, PDO::PARAM_INT);
$query->bindParam(:time, $timestamp, PDO::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).

?>

Alsjeblieft
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Nu insert die niet meer he ^
0
Berichten
3.425
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Nu insert die niet meer he ^
Leren lezen

Codeblok (voorbeeld.php):

1
2
3
4
5
6

// Add/Update user.
mysql_query("UPDATE member_accounts SET uCoins = uCoins + $total WHERE uId = " . mysql_real_escape_string($_SESSION[uId]) . "");
$query = $dbh->prepare("INSERT INTO ".DB_PREFIX."member_accounts(uid, total, time) VALUES (:uid,:total,:time) ON DUPLICATE KEY UPDATE uid=:uid,total=:total,time=:time");
$query->bindParam(:uid, $uid, PDO::PARAM_INT);
$query->bindParam(:total, $total, PDO::PARAM_INT);
$query->bindParam(:time, $timestamp, PDO::PARAM_STR);
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Riick schreef:
Eerdere citaten tonen
Dylanh schreef:
Nu insert die niet meer he ^
Leren lezen

Codeblok (voorbeeld.php):
1
2
3
4
5
6

// Add/Update user.
mysql_query("UPDATE member_accounts SET uCoins = uCoins + $total WHERE uId = " . mysql_real_escape_string($_SESSION[uId]) . "");
$query = $dbh->prepare("INSERT INTO ".DB_PREFIX."member_accounts(uid, total, time) VALUES (:uid,:total,:time) ON DUPLICATE KEY UPDATE uid=:uid,total=:total,time=:time");
$query->bindParam(:uid, $uid, PDO::PARAM_INT);
$query->bindParam(:total, $total, PDO::PARAM_INT);
$query->bindParam(:time, $timestamp, PDO::PARAM_STR);

Leer zelf lezen:
1. mysql??!?!?
2. mysql & PDO ?!?!?!?
3/ mysq;?!?!?!?
0
Berichten
3.425
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Eerdere citaten tonen
Riick schreef:
Eerdere citaten tonen
Dylanh schreef:
Nu insert die niet meer he ^
Leren lezen

Codeblok (voorbeeld.php):
1
2
3
4
5
6

// Add/Update user.
mysql_query("UPDATE member_accounts SET uCoins = uCoins + $total WHERE uId = " . mysql_real_escape_string($_SESSION[uId]) . "");
$query = $dbh->prepare("INSERT INTO ".DB_PREFIX."member_accounts(uid, total, time) VALUES (:uid,:total,:time) ON DUPLICATE KEY UPDATE uid=:uid,total=:total,time=:time");
$query->bindParam(:uid, $uid, PDO::PARAM_INT);
$query->bindParam(:total, $total, PDO::PARAM_INT);
$query->bindParam(:time, $timestamp, PDO::PARAM_STR);
Leer zelf lezen:
1. mysql??!?!?
2. mysql & PDO ?!?!?!?
3/ mysq;?!?!?!?

Wauw typfoutjes, maar zo werkte het altijd al toen ik die site nog had.
En er zit geen bug in dus gtfo.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren