|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/abtechsci/mmc15/Membership/payments/2checkout/ |
Upload File : |
<?php
/**************************************************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/**************************************************/
/*
This file will teach you show to use our class
to process payments from 2checkout
*/
/* Get Paypal Class */
require_once('2co.class.php');
$doCheck = new twoCheckOut;
/*
Do actual checking
isPaid will be true if payment is good, otherwise
it will be false
*/
$isPaid = $doCheck->checkPayment($_POST);
if($isPaid == true){
foreach($_POST as $is => $what){ ${$is} = $what;}
/* A Payment has Been made, we now need to connect to database and update system */
//Call Database & Connect
require_once('../../headers/database.php');
connect();
//Call functions
require_once('../../headers/functions.php');
/* item_number is Paypal item number, supplied by Paypal - contains rate id and user id*/
list($rateID,$userID) = explode('_',$merchant_product_id);
$getRate = mysql_fetch_assoc(mysql_query("SELECT `membership_id`,`rate_amount`
FROM `memb_memberships_rates` WHERE `rate_id`='$rateID'"));
/* mc_gross is Paypal payment amount, supplied by Paypal */
if($getRate['rate_amount'] != $mc_gross){
//Disconnect Database
disconnect_data();
} else {
$add_payment = mysql_query("INSERT INTO `memb_payments` (`membership_id`,`user_id`,`rate_id`,`rate_amount`,
`payment_date`,`system_id`)
VALUES ('$getRate[membership_id]','$userID','$rateID','$mc_gross',NOW(),'2')");
}
//Disconnect Database
disconnect_data();
}
?>