Paypal ipn

    
  1. Atsijungęs

    GAG

    Pranešimai: 0

    Sveiki gal kas turit patirties su php , bandau sukurti paypalipn bet negaunu atsakymo is paypal,
    Dėmesio! Jūs neturite leidimo, kad peržiūrėtumėte šį tekstą.


    <?php 
    
     
    
     
    
    	error_reporting(E_STRICT); 
    
     
    
    //reading raw data	 
    
    $raw_post_data = file_get_contents('php://input'); 
    
    $raw_post_array = explode('&', $raw_post_data); 
    
    $myPost = array(); 
    
    foreach ($raw_post_array as $keyval) { 
    
    $keyval = explode ('=', $keyval); 
    
    if (count($keyval) == 2) 
    
    $myPost[$keyval[0]] = urldecode($keyval[1]); 
    
     
    
     
    
    //read ipn message 
    
     
    
     
    
    	$req = "cmd=_notify-validate"; 
    
    	foreach ($myPOST as $key => $value) 
    
    	if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { 
    
     
    
    	$value = urlencode(stripslashes($value)); 
    
     
    
    	$req .= "&$key=$value";} 
    
     
    
    //send data back 
    
     
    
    $ch = curl_init('https://ipnpb.paypal.com/cgi-bin/webscr'); 
    
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 
    
    curl_setopt($ch, CURLOPT_post, 1); 
    
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
    
    curl_setopt($ch, CURLOPT_postFIELDS, $req); 
    
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); 
    
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
    
    curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); 
    
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); 
    
     
    
    if ( !($res = curl_exec($ch)) ) 
    
    { curl_close($ch); 
    
    exit; 
    
    } 
    
    curl_close($ch); 
    
    // validation 
    
     
    
     
    
    		if (strcmp ($res, "VERIFIED") == 0){ 
    
    if($mypost['payment_status'] == "Completed" && $mypost['mc_currency'] == "EUR"){ 
    
    $order = $_post['item_number']; 
    
    $amount = $_post['mc_gross']; 
    
     
    
    require_once("../core.php"); 
    
     
    
    if(!!!$settings['enablePaypalPayment']) 
    
    exit("Paypal payment option is disabled."); 
    
     
    
    if(!$validate->blank(@$order)) 
    
    exit("Missing some details."); 
    
    elseif(!$validate->numeric($order)) 
    
    exit("Some of the fields contain fobidden symbols."); 
    
     
    
    $paymentData = $mysqlClientLoginServer->select("SELECT * FROM `acp_payments` WHERE `id` = ? AND `status` = 0 ORDER BY `id` DESC LIMIT 1;",array($order)); 
    
     
    
    if(!$paymentData) 
    
    exit("There's no outstanding order with such ID."); 
    
     
    
    if($paymentData['amount'] != $amount) 
    
    exit("The money sent does not match the order amount."); 
    
     
    
    $player['account'] = $paymentData['account']; 
    
     
    
    $mysqlClientLoginServer->execute("UPDATE `acp_payments` SET `status` = 2 WHERE `id` = ?;",array($order)); 
    
    $credits->increase($paymentData['reward']); 
    
    $log->add("Purchased ".sprintf('%0.2f',$paymentData['reward'])."&#162; for ".sprintf('%0.2f',$paymentData['amount'])." EUR through PayPal, thank you."); 
    
    } 
    
    elseif($mypost['payment_status'] == "Reversed"){ 
    
    $order = $mypost['item_number']; 
    
    $amount = $mypost['mc_gross']; 
    
     
    
    require_once("../core.php"); 
    
     
    
    if(!$validate->blank(@$order)) 
    
    exit("Missing some details."); 
    
    elseif(!$validate->numeric($order)) 
    
    exit("Some of the fields contain fobidden symbols."); 
    
     
    
    $paymentData = $mysqlClientLoginServer->select("SELECT * FROM `acp_payments` WHERE `id` = ? ORDER BY `id` DESC LIMIT 1;",array($order)); 
    
     
    
    if(!$paymentData) 
    
    exit("There's no such order."); 
    
     
    
    $mysqlClientLoginServer->execute($queryLogin['disableAccount'],array($paymentData['account'])); 
    
     
    
    $log->add("Account has been banned for reversing the payment."); 
    
    } 
    
    } 
    
    } 
    
    ?>
    
    
    Paskutinį kartą redagavo: GAG 3 Rugpjūčio 2020 - 03:55
    3 Rugpjūčio 2020 - 03:52 / #1