Ejemplo n.º 1
0
 $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 {