// Read the post from PayPal
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
    $value = urlencode($value);
    $req .= "&{$key}={$value}";
}
# Send this request back to PayPal for verification.
$header = "";
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
// Process validation from PayPal
if (!$fp) {
    // HTTP ERROR
    echo "HTTP error.";
} else {
    // NO HTTP ERROR
    fputs($fp, $header . $req);
    while (!feof($fp)) {
        $res = fgets($fp, 1024);
        if (strcmp($res, "VERIFIED") == 0) {
            echo "Verified.";
            // Mark these items as bought.
            payment_set_complete(getvalescaped("custom", ""));
            hook("payment_complete");
        } else {
            echo "Not verified";
        }
    }
}
Пример #2
0
<?php
include "../include/db.php";
include "../include/authenticate.php"; 
include "../include/general.php";
include "../include/resource_functions.php";
include "../include/search_functions.php";
include "../include/collections_functions.php";

if (getval("purchaseonaccount","")!="" && $userrequestmode==3)
	{
	# Invoice mode.
	# Mark as payment complete.
	payment_set_complete($usercollection);
	
	# Set new user collection to empty the basket (without destroying the old basket which contains the 'paid' flag to enable the download).
	$oldcollection=$usercollection;
	$name=get_mycollection_name($userref);
	$newcollection=create_collection ($userref,$name,0,1); // make not deletable
	set_user_collection($userref,$newcollection);
	
	# Redirect to basket (old) collection for download.
	redirect($baseurl_short."pages/purchase_download.php?collection=" . $oldcollection);
	}


include "../include/header.php";


if (getval("submit","")=="")
	{
	# ------------------- Show the size selection screen -----------------------
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
    $value = urlencode($value);
    $req .= "&{$key}={$value}";
}
# Send this request back to PayPal for verification.
$header = "";
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
// Process validation from PayPal
if (!$fp) {
    // HTTP ERROR
    echo "HTTP error.";
} else {
    // NO HTTP ERROR
    fputs($fp, $header . $req);
    while (!feof($fp)) {
        $res = fgets($fp, 1024);
        if (strcmp($res, "VERIFIED") == 0) {
            echo "Verified.";
            // Mark these items as bought.
            $emailconfirmation = getvalescaped("emailconfirmation", "");
            payment_set_complete(getvalescaped("custom", ""), $emailconfirmation);
            hook("payment_complete");
        } else {
            echo "Not verified";
        }
    }
}