Fix: Bad link
This commit is contained in:
parent
2e1b407f29
commit
26715e4997
@ -87,7 +87,7 @@ $SOURCE=GETPOST("source",'alpha');
|
|||||||
$ref=$REF=GETPOST('ref','alpha');
|
$ref=$REF=GETPOST('ref','alpha');
|
||||||
$TAG=GETPOST("tag",'alpha');
|
$TAG=GETPOST("tag",'alpha');
|
||||||
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
|
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
|
||||||
$SECUREKEY=GETPOST("securekey",'alpha'); // Secure key
|
$SECUREKEY=GETPOST("securekey"); // Secure key
|
||||||
|
|
||||||
if (! empty($SOURCE))
|
if (! empty($SOURCE))
|
||||||
{
|
{
|
||||||
@ -138,10 +138,35 @@ if (empty($PAYPAL_API_SIGNATURE))
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check security token
|
||||||
|
$valid=true;
|
||||||
|
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
|
||||||
|
{
|
||||||
|
if ($REF) $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $REF); // REF always defined if SOURCE is defined
|
||||||
|
else $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$token = $conf->global->PAYPAL_SECURITY_TOKEN;
|
||||||
|
}
|
||||||
|
if ($SECUREKEY != $token) $valid=false;
|
||||||
|
|
||||||
|
if (! $valid)
|
||||||
|
{
|
||||||
|
print '<div class="error">Bad value for key.</div>';
|
||||||
|
//print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST("action") == 'dopayment')
|
if (GETPOST("action") == 'dopayment')
|
||||||
{
|
{
|
||||||
$PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT');
|
$PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT');
|
||||||
@ -237,6 +262,7 @@ print '<input type="hidden" name="action" value="dopayment">'."\n";
|
|||||||
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'."\n";
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'."\n";
|
||||||
print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n";
|
print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n";
|
||||||
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
||||||
|
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<!-- Form to send a Paypal payment -->'."\n";
|
print '<!-- Form to send a Paypal payment -->'."\n";
|
||||||
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
||||||
@ -303,16 +329,8 @@ $found=false;
|
|||||||
$error=0;
|
$error=0;
|
||||||
$var=false;
|
$var=false;
|
||||||
|
|
||||||
// Check security token
|
|
||||||
$valid=true;
|
|
||||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) )
|
|
||||||
{
|
|
||||||
$token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $SOURCE . $ref, 2);
|
|
||||||
if ($SECUREKEY != $token) $valid=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Free payment
|
// Free payment
|
||||||
if (! GETPOST("source"))
|
if (! GETPOST("source") && $valid)
|
||||||
{
|
{
|
||||||
$found=true;
|
$found=true;
|
||||||
$tag=GETPOST("tag");
|
$tag=GETPOST("tag");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user