|
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
*/
/**************************************************/
/*
Function: This class can:
-----------------------------
1)
Make HTML Forms for 2CO Products
2)
Process 2CO payments and return true/false from
paypal so you can do all processing. All backend are
not of your worries
*/
class twoCheckOut {
private $VARS;
private $button;
private $siteName;
/* Print Form */
function showForm()
{
$FORM = '<form action="https://www.2checkout.com/2co/buyer/purchase" method="post" target="_blank" style="display:inline;">'."\n";
foreach($this->VARS as $item => $sub){
$FORM .= '<input type="hidden" name="'.$sub[0].'" value="'.$sub[1].'">'."\n";
}
$FORM .= $this->button;
$FORM .= '</form><br><font size="1">2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for<br>goods and services provided by '.$this->siteName.'.</font>';
echo $FORM;
}
/* Add variable to form */
function addVar($varName,$value)
{
$this->VARS[${varName}][0] = $varName;
$this->VARS[${varName}][1] = $value;
}
/* Add button Image */
function addButton()
{
$this->button = '<input name="submit" type="submit" value="Buy from 2CO">';
$this->button .= "\n";
}
/* Set log file for invalid requests */
function setSiteName($siteName)
{
$this->siteName = $siteName;
}
/* Check payment */
function checkPayment($_POST)
{
list($rateID,$userID) = explode('_',$_POST['merchant_product_id']);
$getRate = mysql_fetch_assoc(mysql_query("SELECT `membership_id`,`rate_amount`
FROM `memb_memberships_rates` WHERE `rate_id`='$rateID'"));
if($getRate['rate_id'] == $rateID){
return true;
}
return false;
}
}
?>