Pogledajte određenu poruku
Staro 13. 11. 2005.   #6
bluesman
Goran Pilipović
Sir Write-a-Lot
 
Avatar bluesman
 
Datum učlanjenja: 18.05.2005
Lokacija: Beograd
Poruke: 5.450
Hvala: 288
1.247 "Hvala" u 446 poruka
bluesman je osoba koju treba slušatibluesman je osoba koju treba slušatibluesman je osoba koju treba slušatibluesman je osoba koju treba slušatibluesman je osoba koju treba slušatibluesman je osoba koju treba slušatibluesman je osoba koju treba slušatibluesman je osoba koju treba slušatibluesman je osoba koju treba slušati
Pošaljite ICQ poruku za bluesman
Default

Nekada nije islo preko https, vidim da sada ide tako...

Probaj ovaj kod, sad sam to nasao na disku ...

PHP kôd:

error_reporting
(E_ALL & ~E_NOTICE);

define('NO_REGISTER_GLOBALS'1);
define('SESSION_BYPASS'1);

$phrasegroups = array();
$specialtemplates = array();

chdir('./../');
require_once(
'./includes/init.php');
require_once(
'./includes/functions.php');
require_once(
'./includes/adminfunctions.php');
require_once(
'./includes/functions_subscriptions.php');

if (empty(
$_POST))
{
    exit;
}

$query[] = 'cmd=_notify-validate';
foreach (
$_POST as $key => $val)
{
    
$query[] = $key '=' urlencode ($val);
}
$query implode('&'$query);

$used_curl false;

if (
function_exists('curl_init') AND $ch curl_init())
{
    
curl_setopt($chCURLOPT_URL'http://www.paypal.com/cgi-bin/webscr');
    
curl_setopt($chCURLOPT_TIMEOUT15);
    
curl_setopt($chCURLOPT_POSTtrue);
    
curl_setopt($chCURLOPT_POSTFIELDSIZE0);
    
curl_setopt($chCURLOPT_POSTFIELDS$query);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue); 

    
$result curl_exec($ch);
    
curl_close($ch);
    if (
$result !== false)
    {
        
$used_curl true;
    }
}
if (!
$used_curl)
{

    
$header "POST /cgi-bin/webscr HTTP/1.0\r\n";
    
$header .= "Host: www.paypal.com\r\n";
    
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    
$header .= "Content-Length: " strlen($query) . "\r\n\r\n";
    
$fp fsockopen('www.paypal.com'80$errno$errstr30);
    
socket_set_timeout($fp30);
    
fwrite($fp$header $query);
    while (!
feof($fp))
    {
        
$result fgets($fp1024);
        if (
strcmp($result'VERIFIED') == 0)
        {
            break;
        }
    }
    
fclose($fp);
}

if ((
$result == 'VERIFIED' OR strcmp($result'VERIFIED') == 0) AND !empty($_POST['item_number']) AND strtolower($_POST['business']) == strtolower($vboptions['ppemail']))
{

    
$item_number explode('_'$_POST['item_number']);
    
$subscriptionid intval($item_number[0]);

    if (empty(
$item_number[1]))
    { 
// non vBulletin subscription
        
exit;
    }

    
$userid $DB_site->query_first("SELECT userid FROM " TABLE_PREFIX "user WHERE userid = " intval($item_number[1]));

    
// lets check the values
    
if ($subscriptionid AND $userid['userid'])
    {
        
//its a paypal payment and we have some valid ids
        
$sub $DB_site->query_first("SELECT * FROM " TABLE_PREFIX "subscription WHERE subscriptionid = $subscriptionid");
        
$cost unserialize($sub['cost']);
        if (
$_POST['tax'] > 0)
        {
            
$_POST['mc_gross'] += $_POST['tax'];
        }

        
// Check if its a payment or if its a reversal
        
if ($_POST['txn_type'] == 'web_accept' AND $_POST['payment_status'] == 'Completed')
        {
            if (
$_POST['mc_gross'] == $cost[strtolower($_POST['mc_currency'])])
            {
                
build_user_subscription($subscriptionid$userid['userid']);
            }
        }
        else if (
$_POST['payment_status'] == 'Reversed' OR $_POST['payment_status'] == 'Refunded')
        {
            
delete_user_subscription($subscriptionid$userid['userid']);
        }
    }

    
// Paypal likes to get told its message has been received
    
if (SAPI_NAME == 'cgi' OR SAPI_NAME == 'cgi-fcgi')
    {
        
header('Status: 200 OK');
    }
    else
    {
        
header('HTTP/1.1 200 OK');
    }

__________________
Goran Pilipović a.k.a. Ugly Fingers Bradley f.k.a. bluesman
I don't always know what I'm talking about but I know I'm right!

Poslednja izmena od bluesman : 13. 11. 2005. u 01:38.
bluesman je offline   Odgovorite uz citat