Exemplo n.º 1
0
 session_id($_GET['sid']);
 session_start();
 // save the transaction data to individual variables
 list($pubAdd, $price, $quantity, $item, $seller, $success_url, $cancel_url, $note, $baggage) = explode('|', $_SESSION['t_data']);
 // get the total price
 $total = $price * $quantity;
 // reset or increase the progress
 if (!isset($_SESSION[$pubAdd . '-confirms'])) {
     $_SESSION[$pubAdd . '-confirms'] = 1;
     $_SESSION['progress'] = 0;
 } else {
     $_SESSION['progress'] += $prog_inc;
     $_SESSION[$pubAdd . '-confirms']++;
 }
 // check if the payment has been recieved
 $check_result = bitsci::check_payment($total, $pubAdd, $_SESSION[$pubAdd . '-confirms']);
 if ($check_result === false) {
     // the payment isn't confirmed yet
     $_SESSION[$pubAdd . '-confirms']--;
     $payment_status = 'confirming payment';
 } elseif ($check_result === 'e1') {
     // we have no working API's...
     $_SESSION[$pubAdd . '-confirms']--;
     $payment_status = 'All API\'s are unavailable';
 } elseif ($check_result === 'e2') {
     // this really shouldn't happen...
     $_SESSION[$pubAdd . '-confirms']--;
     $payment_status = 'address is invalid!';
 } elseif ($check_result === 'e3') {
     // something weird happened...
     $_SESSION[$pubAdd . '-confirms']--;
Exemplo n.º 2
0
  <br/><br/>
  <p>You are buying <b><?php 
echo $quantity;
?>
 x <?php 
safe_echo($item);
?>
 @ <?php 
echo $price;
?>
 BTC</b> from <b><?php 
safe_echo($seller);
?>
</b></p>
  <p>Please transfer <i>exactly</i> <b><?php 
echo bitsci::btc_num_format($_SESSION['total_price']);
?>
 BTC</b> to the following address:</p>
  
  <h3>
    <b><?php 
echo '<a href="bitcoin:' . $pubAdd . '?amount=' . $_SESSION['total_price'] . '" title="Click this address to launch your Bitcoin client" target="_blank">' . safe_str($pubAdd) . '</a>';
?>
</b>
  </h3> 
  <div id="qrcode"></div>
  
  <?php 
if (empty($_GET['u'])) {
    ?>
 
Exemplo n.º 3
0
<?php

require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/../lib/common.lib.php';
session_start();
if (!empty($_GET['address'])) {
    echo bitsci::get_balance(urlencode($_GET['address']), 1);
}
Exemplo n.º 4
0
 // 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 {
     echo "<p class='error_txt'>There was an error creating the transaction. Please go back and try again.</p>";
     mysql_close($con);
     exit;
 }
 // build the URL for the bitcoin payment gateway
 $payment_gateway = $site_url . $bitsci_url . 'payment.php?sid=' . session_id() . '&t=' . $random_str;
 // save encrypted private WIF key to file (along with address).
 // you might want to save these keys to a database instead.
 //$fp=fopen(dirname(__FILE__)."/wif-keys.csv","a");
 // if ($fp) {
 //  if (flock($fp, LOCK_EX)) {
 //    @fwrite($fp, $key_data.",\n");
Exemplo n.º 5
0
<?php

require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/../lib/bit-sci.lib.php';
if (!empty($_GET['sid'])) {
    echo "updateProgress('" . bitsci::curl_simple_post($site_url . $bitsci_url . 'check-status.php?sid=' . urlencode($_GET['sid'])) . "');";
}