Hallo allemaal,
Ik gebruik de iDeal api van TargetPay voor mijn klanten zodat deze credits aan kunnen schaffen. Nu zit ik met het probleem dat de credits niet worden bijgeschreven, terwijl er wel komt te staan dat deze bijgeschreven zijn...
Dit is de pagina:
Ik hoop dat iemand de fout ziet want nu moet alles handmatig gebeuren, wat nogal veel werk is!PHP Code:
<?php
session_start();
require_once ( 'TargetPayIdeal.class.php');
include("config.php");
ob_start();
if (isset ($_SESSION['credits'])){
$iRtlo = 60171;
if (isset ($_SESSION['credits'])){
if ($_SESSION['credits'] == 1100){
$sCreds = 10;
}
if ($_SESSION['credits'] == 2750){
$sCreds = 25;
}
if ($_SESSION['credits'] == 5500){
$sCreds = 50;
}
if ($_SESSION['credits'] == 11000){
$sCreds = 100;
}
?>
<?php
# Set ideal amount in cents so 500 cent will be 5 euro
$iAmount = $_SESSION['credits'];
# Set return url from your website
$iReturnurl = "http://www.***.nl/ideal.php";
# Set report url to recieve the status of transactions not retreived by the returnurl
$iReporturl = "http://www.***.nl/ideal.php";
$iIssuer = $_GET[ "bank" ];
/**
* This function will validate the payment after returning from the bank
*/
# ?action=validate&trxid= 'trxid'
if ( isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) ) {
# Init the class
$oIdeal = new TargetPayIdeal ( $iRtlo );
// $oIdeal->setDomain ( 'www.mijndomein.nl' );
if ( $oIdeal->validatePayment ( $_GET['trxid'] ) == true ) {
echo 'De betaling is geslaagd, je credits zijn aan je account toegevoegd.<br /><br />Klik <a href="controlepaneel.php">hier</a> om terug te keren naar ***.nl.';
# Credits toevoegen
$aQuery = mysql_query("
SELECT
mail_credits
FROM
gebruikers
WHERE
gebruikersnaam = ".$_SESSION['gebruikersnaam']."
");
while($aFetch = mysql_fetch_assoc($aQuery)){
$aMailCredits = $aFetch['mail_credits'];
}
mysql_query("
UPDATE
gebruikers
SET
mail_credits = ".$aMailCredits."' + '".$sCreds."
WHERE
gebruikersnaam = ".$_SESSION['gebruikersnaam']."
");
}
else {
echo 'De betaling was (nog) niet geslaagd';
}
}
elseif($iIssuer == "")
{
/*
* Choose your bank
*/
?>
Je hebt ervoor gekozen om <?php echo $sCreds; ?> credits te kopen!<br /><br />
<form method=get name=idealform>
Kies je bank<br>
<select name="bank"><script src="http://www.targetpay.com/ideal/issuers-nl.js"></script></select>
<INPUT TYPE=submit VALUE="Continue..."></form>
<?
}
else
{
/*
* Initiate payment
*/
ini_set ( 'display_errors' , '1');
# To initiate a payment, initiate the class
$oIdeal = new TargetPayIdeal ( $iRtlo );
# Set ideal amount in cents so 500 cent will be 5 euro
$oIdeal->setIdealAmount ( $iAmount );
# Set ideal issuer
$oIdeal->setIdealissuer ( $iIssuer );
# Set ideal description
$oIdeal->setIdealDescription ( 'Credits');
# Set return url, wich should return on succes
$oIdeal->setIdealReturnUrl ( $iReturnurl );
# Set report url
$oIdeal->setIdealReportUrl ( $iReporturl );
# Now we can initiate the payment
$aReturn = $oIdeal->startPayment();
# This is the transaction id
$intTrxId = $aReturn[0];
# this will be the bank url that will rederect to the bank.
$strBankURL = $aReturn[1];
# For check we can echo it here. (uncomment if you want to see. )
//echo 'Transaction ID: '. $intTrxId . '<br/>Bank URL: '. $strBankURL;
/**
* This haader function will redirect the browser to the bank
*/
header( "Location: ". $strBankURL );
}
}
}
?>
Alvast hartstikke bedankt, degene die het oplost kan er ook nog eens €5,- mee verdienen!
Gr.
Jos
- [PHP] Query wordt niet uitgevoerd?
-
05-02-2011, 10:00 #1
- Berichten
- 943
- Lid sinds
- 15 Jaar
[PHP] Query wordt niet uitgevoerd?
-
-
05-02-2011, 10:02 #2
- Berichten
- 61
- Lid sinds
- 17 Jaar
Re: [PHP] Query wordt niet uitgevoerd?
mysql_query("
UPDATE
gebruikers
SET
mail_credits = mail_credits + ".$sCreds."
WHERE
gebruikersnaam = ".$_SESSION['gebruikersnaam']."
");
// tevens is je scriptje ook niet zo erg netjes.
-
05-02-2011, 10:05 #3
- Berichten
- 943
- Lid sinds
- 15 Jaar
Re: [PHP] Query wordt niet uitgevoerd?
Ik zal even kijken of het werkt, dit is niet mijn script overigens want dit komt van de TargetPay site af.
EDIT:
Credits worden nog steeds niet bijgeschreven
-
05-02-2011, 11:16 #4
- Berichten
- 548
- Lid sinds
- 16 Jaar
Re: [PHP] Query wordt niet uitgevoerd?
Slechte code, niet beveiligd tegen SQL injecties
PHP Code:<?php
session_start();
require_once ( 'TargetPayIdeal.class.php');
include("config.php");
ob_start();
if (isset ($_SESSION['credits'])){
$iRtlo = 60171;
if (isset ($_SESSION['credits'])){
if ($_SESSION['credits'] == 1100){
$sCreds = 10;
}
if ($_SESSION['credits'] == 2750){
$sCreds = 25;
}
if ($_SESSION['credits'] == 5500){
$sCreds = 50;
}
if ($_SESSION['credits'] == 11000){
$sCreds = 100;
}
?>
<?php
# Set ideal amount in cents so 500 cent will be 5 euro
$iAmount = $_SESSION['credits'];
# Set return url from your website
$iReturnurl = "http://www.***.nl/ideal.php";
# Set report url to recieve the status of transactions not retreived by the returnurl
$iReporturl = "http://www.***.nl/ideal.php";
$iIssuer = $_GET[ "bank" ];
/**
* This function will validate the payment after returning from the bank
*/
# ?action=validate&trxid= 'trxid'
if ( isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) ) {
# Init the class
$oIdeal = new TargetPayIdeal ( $iRtlo );
// $oIdeal->setDomain ( 'www.mijndomein.nl' );
if ( $oIdeal->validatePayment ( $_GET['trxid'] ) == true ) {
echo 'De betaling is geslaagd, je credits zijn aan je account toegevoegd.<br /><br />Klik <a href="controlepaneel.php">hier</a> om terug te keren naar ***.nl.';
# Credits toevoegen
$aQuery = mysql_query("
SELECT
mail_credits
FROM
gebruikers
WHERE
gebruikersnaam = ".$_SESSION['gebruikersnaam']."
");
while($aFetch = mysql_fetch_assoc($aQuery)){
$aMailCredits = $aFetch['mail_credits'];
}
mysql_query("
UPDATE
gebruikers
SET
mail_credits = mail_credits + $sCreds
WHERE
gebruikersnaam = ".$_SESSION['gebruikersnaam']."
");
}
else {
echo 'De betaling was (nog) niet geslaagd';
}
}
elseif($iIssuer == "")
{
/*
* Choose your bank
*/
?>
Je hebt ervoor gekozen om <?php echo $sCreds; ?> credits te kopen!<br /><br />
<form method=get name=idealform>
Kies je bank<br>
<select name="bank"><script src="http://www.targetpay.com/ideal/issuers-nl.js"></script></select>
<INPUT TYPE=submit VALUE="Continue..."></form>
<?
}
else
{
/*
* Initiate payment
*/
ini_set ( 'display_errors' , '1');
# To initiate a payment, initiate the class
$oIdeal = new TargetPayIdeal ( $iRtlo );
# Set ideal amount in cents so 500 cent will be 5 euro
$oIdeal->setIdealAmount ( $iAmount );
# Set ideal issuer
$oIdeal->setIdealissuer ( $iIssuer );
# Set ideal description
$oIdeal->setIdealDescription ( 'Credits');
# Set return url, wich should return on succes
$oIdeal->setIdealReturnUrl ( $iReturnurl );
# Set report url
$oIdeal->setIdealReportUrl ( $iReporturl );
# Now we can initiate the payment
$aReturn = $oIdeal->startPayment();
# This is the transaction id
$intTrxId = $aReturn[0];
# this will be the bank url that will rederect to the bank.
$strBankURL = $aReturn[1];
# For check we can echo it here. (uncomment if you want to see. )
//echo 'Transaction ID: '. $intTrxId . '<br/>Bank URL: '. $strBankURL;
/**
* This haader function will redirect the browser to the bank
*/
header( "Location: ". $strBankURL );
}
}
}
?>
-
05-02-2011, 11:17 #5
- Berichten
- 82
- Lid sinds
- 17 Jaar
Re: [PHP] Query wordt niet uitgevoerd?
PHP Code:<?php
session_start();
require_once ( 'TargetPayIdeal.class.php');
include("config.php");
ob_start();
if (isset ($_SESSION['credits']))
{
$iRtlo = 60171;
if ($_SESSION['credits'] == 1100)
{
$sCreds = 10;
}
if ($_SESSION['credits'] == 2750)
{
$sCreds = 25;
}
if ($_SESSION['credits'] == 5500)
{
$sCreds = 50;
}
if ($_SESSION['credits'] == 11000)
{
$sCreds = 100;
}
# Set ideal amount in cents so 500 cent will be 5 euro
$iAmount = $_SESSION['credits'];
# Set return url from your website
$iReturnurl = "http://www.***.nl/ideal.php";
# Set report url to recieve the status of transactions not retreived by the returnurl
$iReporturl = "http://www.***.nl/ideal.php";
$iIssuer = $_GET[ "bank" ];
/**
* This function will validate the payment after returning from the bank
*/
# ?action=validate&trxid= 'trxid'
if ( isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) )
{
# Init the class
$oIdeal = new TargetPayIdeal ( $iRtlo );
// $oIdeal->setDomain ( 'www.mijndomein.nl' );
if ( $oIdeal->validatePayment ( $_GET['trxid'] ) == true )
{
echo 'De betaling is geslaagd, je credits zijn aan je account toegevoegd.<br /><br />Klik <a href="controlepaneel.php">hier</a> om terug te keren naar ***.nl.';
# Credits toevoegen
mysql_query("
UPDATE
gebruikers
SET
mail_credits = mail_credits + ".$sCreds."
WHERE
gebruikersnaam = '".$_SESSION['gebruikersnaam']."'
");
}
else
{
echo 'De betaling was (nog) niet geslaagd';
}
}
elseif($iIssuer == "")
{
/*
* Choose your bank
*/
?>
Je hebt ervoor gekozen om <?php echo $sCreds; ?> credits te kopen!<br /><br />
<form method=get name=idealform>
Kies je bank<br>
<select name="bank"><script src="http://www.targetpay.com/ideal/issuers-nl.js"></script></select>
<INPUT TYPE=submit VALUE="Continue..."></form>
<?
}
else
{
/*
* Initiate payment
*/
ini_set ( 'display_errors' , '1');
# To initiate a payment, initiate the class
$oIdeal = new TargetPayIdeal ( $iRtlo );
# Set ideal amount in cents so 500 cent will be 5 euro
$oIdeal->setIdealAmount ( $iAmount );
# Set ideal issuer
$oIdeal->setIdealissuer ( $iIssuer );
# Set ideal description
$oIdeal->setIdealDescription ( 'Credits');
# Set return url, wich should return on succes
$oIdeal->setIdealReturnUrl ( $iReturnurl );
# Set report url
$oIdeal->setIdealReportUrl ( $iReporturl );
# Now we can initiate the payment
$aReturn = $oIdeal->startPayment();
# This is the transaction id
$intTrxId = $aReturn[0];
# this will be the bank url that will rederect to the bank.
$strBankURL = $aReturn[1];
# For check we can echo it here. (uncomment if you want to see. )
//echo 'Transaction ID: '. $intTrxId . '<br/>Bank URL: '. $strBankURL;
/**
* This haader function will redirect the browser to the bank
*/
header( "Location: ". $strBankURL );
}
}
?>
edit: let ook op de query. Je hebt geen quotes om de gebruikersnaam gedaan. Als je or die(mysql_error()); had gebruikt, had je dit ook al kunnen zien.
-
05-02-2011, 11:19 #6
- Berichten
- 943
- Lid sinds
- 15 Jaar
Re: [PHP] Query wordt niet uitgevoerd?
Ik zal even kijken of dit werkt.
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic