Jump to content

Orphros

New Members
  • Posts

    1
  • Joined

  • Last visited

Orphros's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have this php : <?php $email = 'yourpaypalemail'; $url = 'locationofdatabase'; $user = 'username'; $password = 'password'; $database = 'DatabaseName'; $sandbox = 'false'; $packages = array( "package1" => "ExamplePackage", "package2" => "Yourpackagetwo", "package3" => "Yourpackagethree" ); function anti_injection($sql) { foreach ($sql as &$value) { if (!is_array($value)) { $value = mysql_real_escape_string(stripslashes(trim($value))); } } unset($value); return $sql; } $link = mysql_connect($url, $user, $password); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db($database, $link); if (!$db_selected) { die ('Can\'t use database : ' . mysql_error()); } $req = 'cmd=' . urlencode('_notify-validate'); foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } if($sandbox == 'true'){ $url = '[url="https://www.sandbox.paypal.com/cgi-bin/webscr%27;"]https://www.sandbox....in/webscr';[/url] } else { $url = '[url="https://www.paypal.com/cgi-bin/webscr%27;"]https://www.paypal.c...in/webscr';[/url] } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($req))); curl_setopt($ch, CURLOPT_HEADER , 0); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $curl_result = @curl_exec($ch); $curl_err = curl_error($ch); curl_close($ch); $_POST = anti_injection($_POST); $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $player = mysql_real_escape_string(stripslashes(trim($_POST['custom']))); $settle = $_POST['settle_amount']; $package=false; foreach($packages as $pack){ if($pack == $item_name){ $package=true; } } //if($settle!=''){ //$amount = $settle; //} if (strpos($curl_result, "VERIFIED")==0) { if ($payment_status == 'Completed' && $receiver_email == $email){ $query = "INSERT INTO toothtransaction (player, amount, used, ipn) VALUES ('{$player}', {$amount}, 0, '{$txn_id}')"; mysql_query($query); if($package==true){ $query = "INSERT INTO toothpackages (player, cost, status, package) VALUES ('{$player}', {$amount}, 0, '{$item_name}')"; mysql_query($query); } mysql_close(); } } ?> And I need help cutting it down becasue evertime someone connect to the remote database on my minecraft server it lags alot. Im stuck and need help. I need to find out what part is causing the lag and I am debating between a remote database vs a local database.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.