📄 paypal.php
字号:
<?include "../../includes/inc.php";include "../ipn.class.php";include "inc/pp.inc.php";/*** iniate the class*/$checker = new PP_Validater($db);$ipn = new ipn_class('PP');$ipn->TestMode=$checker->TestMode;$ipn->EmailTo=$user->setting[adminemail];$ipn->BindDB($db);$Var=$ipn->RecieveData();$result=$ipn->CheckDataIntegrity();/*** Begin to check...*/if($result==false) $ipn->SetError('Hack attempted!');$checker->LoadServer($ipn);if($ipn->PayeeAccount!=$checker->GetPayeeAcount()&&$checker->BusinissAccount!=$ipn->PayeeAccount){ $ipn->SetError('Error PayeeAccount:'.$ipn->PayeeAccount.':'.$checker->GetPayeeAcount());}/*** checking the common payment*/if($ipn->Amount!=$checker->GetAmount()&&$ipn->GetVar('txn_type')=='web_accept'){ $ipn->SetError('Error Amount:'.$checker->GetAmount());}/*** checking the subscription is valid*/if($ipn->GetVar('txn_type')=='subscr_signup'||$ipn->GetVar('txn_type')=='subscr_modify'){ /** * checking the TrialPeriod */ if($ipn->TrialPeriod) { if($ipn->TrialAmount!=$checker->GetTrialAmount()) { $ipn->SetError('Error TrialAmount:'.$ipn->TrialAmount.':'.$checker->GetTrialAmount()); } if($ipn->TrialPeriod!=$checker->GetTrialPeriod()) { $ipn->SetError('Error TrialPeriod:'.$ipn->TrialPeriod.':'.$checker->GetTrialPeriod()); } if($ipn->TrialUnit!=$checker->GetTrialUnit()) { $ipn->SetError('Error TrialUnit:'.$ipn->TrialUnit.':'.$checker->GetTrialUnit()); } } /** * regular checking */ if($ipn->SubsAmount!=$checker->GetSubsAmount()) { $ipn->SetError('Error SubsAmount:'.$ipn->SubsAmount.':'.$checker->GetSubsAmount()); } if($ipn->SubsPeriod!=$checker->GetSubsPeriod()) { $ipn->SetError('Error SubsPeriod:'.$ipn->SubsPeriod.':'.$checker->GetSubsPeriod()); } if($ipn->SubsUnit!=$checker->GetSubsUnit()) { $ipn->SetError('Error SubsUnit:'.$ipn->SubsUnit.':'.$checker->GetSubsUnit()); }}/*** checking the subscription payment is matched against user's data,not the group*//*if($ipn->SubsID!=$checker->GetSubsID()&&$ipn->GetVar('txn_type')=='subscr_payment'){ $ipn->SetError('Error SubsID:'.$ipn->SubsID.':'.$checker->GetSubsID());}*/if($ipn->Currency!=$checker->GetCurrency($ipn)){ $ipn->SetError('Error Currency:'.$ipn->Currency.':'.$checker->GetCurrency($ipn));} echo $result; print_r($ipn);if($ipn->GetVar('payment_status')&&$ipn->GetVar('payment_status')!='Completed'){ $ipn->SetError('Error Status:'.$ipn->GetVar('payment_status')); $ipn->EmailErrors(); exit; //stop here}/*** check the TXNID is unique*/$TXNID=$ipn->GetTXNID();if(!$ipn->IsUniqueTXNID()){ $ipn->SetError('Repeat Transaction ID:'.$TXNID); $ipn->EmailErrors(); die;//stop to process}$ipn->EmailErrors();if($ipn->Errors) exit;$ipn->RecordIPN();//============================// Switch by transaction type//============================switch ($ipn->GetVar('txn_type')) { //---------------------------------------------------------------------------------------------------------------- // In cart transactions, the individual item's details are held in variables like 'item_name1', 'item_name2' etc. // So we have to create the variable names dynamically and then put the data into the standard variables. //---------------------------------------------------------------------------------------------------------------- case 'cart': for ($a=1; $a<=$num_cart_items; $a++) { //------------------------------ // Create the PP variable names //------------------------------ $gp_num="item_number$a"; $gp_name="item_name$a"; $gp_tax="tax$a"; $gp_qty="quantity$a"; } $checker->ProcessCart($ipn); break; //----------------------------------------------------------------------------- // WebAccept. If TC!'s internal shopping cart is used, it's sales come in here //----------------------------------------------------------------------------- case 'web_accept': $checker->ProcessWebAccept($ipn); break; //------------------------------- // Subscription Signup / Payment //--------------------------------------------------------------------------------------------- // In the case of a free trial, no payment would be received until the trial is up. // To ensure users get access to the product anyway, process 'signup's the same as 'payment's //--------------------------------------------------------------------------------------------- case 'subscr_signup': case 'subscr_cancel': case 'subscr_payment': case 'subscr_modify': case 'subscr_eot': $checker->ProcessSubscription($ipn); break;} // End switchprint_r($ipn);print_r($checker);?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -