Server IP : 51.89.169.208 / Your IP : 3.148.107.92 Web Server : Apache System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : yellowleaf ( 1019) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/yellowleaf/public_html/members/paypal/ |
Upload File : |
<?php require_once('../../connect.php'); $adid = $_POST['adid']; $paypal_env = 'production'; include 'paypal_config.php'; /* //get access token// $ch = curl_init("{$paypal_row['url']}/v1/oauth2/token"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $paypal_row['client'].':'.$paypal_row['secret']); curl_setopt ($ch, CURLOPT_SSLVERSION, 6); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json')); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials"); $get = curl_exec($ch); print_r ( curl_error($ch)); curl_close($ch); $get=json_decode($get,1); if($get['access_token']==''){$error='Do not retry payment and contact us immediately. ACC-1. '.$paypal_row['client'].':'.$paypal_row['secret']."{$paypal_row['url']}/v1/oauth2/token";goto end;} $paypal_json=json_decode(stripslashes($_POST['paypal']),1); if($paypal_json['paymentID']==''){$error='Unable to complete payment. <br><a class="btn" href="'.$prev_page .'">Try again</a>';goto end;} //verify payment// $ch = curl_init("{$paypal_row['url']}/v1/payments/payment/{$paypal_json['paymentID']}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json',"Authorization: Bearer {$get['access_token']}")); $verify = curl_exec($ch); curl_close($ch); $verify=json_decode($verify,1); //print_r($verify); // Check if already used if($verify['debug_id']){ error_log( print_r($verify, TRUE) ); $error='Error with verification. Do not retry payment and please contact us immediately. Error code: VER-2';goto end; } $paypal_json['paymentID'] = addslashes($paypal_json['paymentID']); /* $q = mysql_query("SELECT * FROM `paypal_tokens` WHERE token_string='{$paypal_json['paymentID']}'") or die(mysql_error()); if(mysql_num_rows($q) > 0){ $error='Error with verification. Do not retry payment and please contact us immediately. Error code: VER-3'; goto end; } $q = mysql_query("INSERT INTO `paypal_tokens` SET token_string='{$paypal_json['paymentID']}'"); */ end: if(!$error){ foreach($_POST as $k=>$v){$v = nl2br($v); $mail_message .= "<b>$k</b><br>$v<br>"; } mail("bozlul@hotmail.com","YellowLeaf PAYMENT!!","<b>ad id:</b> {$adid}<br>","From: YellowLeaf <info@yellowleaf.com>\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=ISO-8859-1\r\n"); mail("masrurchy11@gmail.com","YellowLeaf PAYMENT!!","<b>ad id:</b> {$adid}<br>","From: YellowLeaf <info@yellowleaf.com>\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=ISO-8859-1\r\n"); $phptime = time(); $sql = "UPDATE ads SET paid='{$phptime}',active='1' WHERE adid='{$adid}' LIMIT 1";error_log($sql); mysql_query($sql) or error_log(mysql_error()); header("Location: http://www.yellowleaf.co.uk/members/"); }else{ $tpl = file_get_contents('message_tpl.html'); $tpl = str_replace('{message}',"An error occured",$tpl); $tpl = str_replace('{desc}',$error,$tpl); echo ($tpl); } ?>