Hallo,
Ik heb een vraagje, namelijk weet iemand wat er mis gaat in mijn postback.php?
Het is de bedoeling dat hij succesvol de punten bijschrijft bij een lid.
Bij de secret code staat normaal mijn secret code in plaats van alle xs.
Mijn paymentwall stuurt de onderstaande request.
Het enige wat er dus niet gebeurd is dat de credits worden bijgeschreven in de row uCoins onder de tabel naam member_accounts.
pingback.php
Request:
Response:
Ik heb een vraagje, namelijk weet iemand wat er mis gaat in mijn postback.php?
Het is de bedoeling dat hij succesvol de punten bijschrijft bij een lid.
Bij de secret code staat normaal mijn secret code in plaats van alle xs.
Mijn paymentwall stuurt de onderstaande request.
Het enige wat er dus niet gebeurd is dat de credits worden bijgeschreven in de row uCoins onder de tabel naam member_accounts.
pingback.php
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]SECRET[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]xxxxxxxxxxxxxxxxxxxxx[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// YOUR SECRET KEY[/COLOR]
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]CREDIT_TYPE_CHARGEBACK[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$ipsWhitelist[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR]
[COLOR= #DD0000]174.36.92.186[/COLOR][COLOR= #007700],[/COLOR]
[COLOR= #DD0000]174.36.96.66[/COLOR][COLOR= #007700],[/COLOR]
[COLOR= #DD0000]174.36.92.187[/COLOR][COLOR= #007700],[/COLOR]
[COLOR= #DD0000]174.36.92.192[/COLOR][COLOR= #007700],[/COLOR]
[COLOR= #DD0000]174.37.14.28[/COLOR]
[COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$userId[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uid[/COLOR][COLOR= #007700]]) ?[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uid[/COLOR][COLOR= #007700]] :[/COLOR] null[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$credits[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]currency[/COLOR][COLOR= #007700]]) ?[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]currency[/COLOR][COLOR= #007700]] :[/COLOR] null[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$type[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]type[/COLOR][COLOR= #007700]]) ?[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]type[/COLOR][COLOR= #007700]] :[/COLOR] null[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$refId[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ref[/COLOR][COLOR= #007700]]) ?[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ref[/COLOR][COLOR= #007700]] :[/COLOR] null[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$signature[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sig[/COLOR][COLOR= #007700]]) ?[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sig[/COLOR][COLOR= #007700]] :[/COLOR] null[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] false[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$userId[/COLOR][COLOR= #007700]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$credits[/COLOR][COLOR= #007700]) &&[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$type[/COLOR][COLOR= #007700]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$refId[/COLOR][COLOR= #007700]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$signature[/COLOR][COLOR= #007700])) {[/COLOR]
[COLOR= #0000BB]$signatureParams[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR]
[COLOR= #DD0000]uid[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$userId[/COLOR][COLOR= #007700],[/COLOR]
[COLOR= #DD0000]currency[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$credits[/COLOR][COLOR= #007700],[/COLOR]
[COLOR= #DD0000]type[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$type[/COLOR][COLOR= #007700],[/COLOR]
[COLOR= #DD0000]ref[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$refId[/COLOR]
[COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$signatureCalculated[/COLOR] [COLOR= #007700]=[/COLOR] calculatePingbackSignature[COLOR= #007700]([/COLOR][COLOR= #0000BB]$signatureParams[/COLOR][COLOR= #007700],[/COLOR] SECRET[COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// check if IP is in whitelist and if signature matches[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$ipsWhitelist[/COLOR][COLOR= #007700]) && ([/COLOR][COLOR= #0000BB]$signature[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]$signatureCalculated[/COLOR][COLOR= #007700])) {[/COLOR]
[COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] true[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$type[/COLOR] [COLOR= #007700]==[/COLOR] CREDIT_TYPE_CHARGEBACK[COLOR= #007700]) {[/COLOR]
[COLOR= #FF8000]// Deduct credits from user
// This is optional, but we recommend this type of crediting to be implemented as well
// Note that currency amount sent for chargeback is negative, e.g. -5, so be caferul about the sign
// Don"™t deduct negative number, otherwise user will get credits instead of losing them[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE member_accounts SET uCoins = uCoins + $credits WHERE id = $userId"[/COLOR][COLOR= #007700]);
}
}
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]OK[/COLOR][COLOR= #007700];
}
function[/COLOR] calculatePingbackSignature[COLOR= #007700]([/COLOR][COLOR= #0000BB]$params[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$secret[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$str[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$params[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$k[/COLOR][COLOR= #007700]=>[/COLOR][COLOR= #0000BB]$v[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$str[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"$k=$v"[/COLOR][COLOR= #007700];
}[/COLOR]
[COLOR= #0000BB]$str[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #0000BB]$secret[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$str[/COLOR][COLOR= #007700]);
}[/COLOR] Request:
GET http://www.gamerscash.nl:80/pingback.php?uid=1¤cy=100&type=0&ref=100010101010&sig=bf0562ed591948f9d98fa7267f52f9df HTTP/1.1
Host: www.gamerscash.nl
Connection: close
Accept-encoding: gzip, deflate
User-Agent: Paymentwall API Response:
HTTP/1.0 200 OK
Date: Fri, 01 Mar 2013 13:47:47 GMT
Server: Apache/2
X-powered-by: PHP/5.4.11
Set-cookie: PHPSESSID=734563fd4d08d6ae61e5fab6921ecc07; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Vary: User-Agent
Content-length: 2
Content-type: text/html
Connection: close
OK
Dan kan je al veel meer vinden.
Zou je er iets bij kunnen maken, zodat je ziet of er een error is mbv mysql_error(); ?