} } else { invalid_input('Transaction ID is empty. Go back and try again.'); } // save the transaction data to individual variables list($pubAdd, $price, $quantity, $item, $seller, $success_url, $cancel_url, $note, $baggage) = explode('|', $_SESSION['t_data']); // check for errors in price and quantity if (empty($price) || !is_numeric($price) || empty($quantity) || !is_numeric($quantity)) { invalid_input('Error calculating item price. Go back and try again.'); } // get the total price if (empty($_SESSION['total_price'])) { $_SESSION['total_price'] = $price * $quantity; } // check for errors in address if (!bitcoin::checkAddress($pubAdd)) { invalid_input('Invalid bitcoin address. Go back and try again.'); } // success? confirm for a 2nd time then redirect if (isset($_GET['success'])) { $check_result = bitsci::check_payment($_SESSION['total_price'], $pubAdd, $confirm_num); if ($check_result === true) { //change mysql to btc verified inhand //MYSQL CONNECT $con = mysql_connect($mysvr, $myusr, $mypass); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($mydb) or die(mysql_error()); // Insert a row of information into the table "payment" mysql_query("INSERT INTO payment \n(inhand) VALUES('YES') ") or die(mysql_error());
$item = rawurldecode($_GET['item']); $quantity = 1; $note = rawurldecode($_GET['notes']); $buyer = rawurldecode($_GET['buyer']); $seller = rawurldecode($_GET['seller']); $frpin = rawurldecode($_GET['pin']); $vpin = rawurldecode($_GET['vpin']); $baggage = 'null'; $pubAdd = $keySet['pubAdd']; $privwif = $keySet['privWIF']; $_SESSION['total_price'] = bitsci::btc_num_format($price * $quantity); $privkey = $key_data; // generate unique random string $random_str = bitcoin::randomString(26); while (file_exists('t_data/' . $random_str)) { $random_str = bitcoin::randomString(26); } //send data to mysql //MYSQL CONNECT $con = mysql_connect($mysvr, $myusr, $mypass); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($mydb) or die(mysql_error()); // Insert a row of information into the table "payment" mysql_query("INSERT INTO payment \n(price, quantity, item, seller, buyer, note, baggage, key_data, pubAdd, privwif, privkey, frpin, buyrel, verifypin) VALUES('{$price}', '{$quantity}', '{$item}', '{$seller}', '{$buyer}', '{$note}', '{$baggage}', '{$key_data}', '{$pubAdd}', '{$privwif}', '{$privkey}', '{$frpin}', 'NO', '{$vpin}') ") or die(mysql_error()); // encrypt transaction data and save to file $t_data = bitsci::build_pay_query($keySet['pubAdd'], $price, $quantity, $item, $seller, $success_url, $cancel_url, $note, $baggage); if (file_put_contents('t_data/' . $random_str, $t_data) !== false) { chmod('t_data/' . $random_str, 0600); } else {