Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: BITCOIN mokejimas puslapyje, reik pagalbos

Parašė Saausainis· 2016 Vas. 29 21:02:07
#1

Sveiki, kuriu toki puslapy, kuriame lankytojai gales uzsiregistruot, rinkt puslapio taskus, kuriuos gales isimainyt i virtualius daiktus, ar kitas elektronines valiutas. Tai va, man reikia padaryti mokejima BITCOIN elektronine valiuta, kad kiekvienam vartotojui automatiskai sukurtu nauja bitcoin adresa, ji rodytu mokejimo puslapyje ir i ji pervedes tam tikra suma btc, gautu i savo vartotojo saskaita. Gal kas yra susidure su bitcoin mokejimu sistemomis, arba siaip paziureje koda, galetu man padet? Kodas kaip ir surasytas, viskas atrodo turetu veikti, taciau nesugeneruoja bitcoin adreso, tai nezinau ar tai galetu but del to, kad tas blockchain atsinaujino, ar del to kad kazkaip suklysti galejau. Stai kodas:
<?php

error_reporting(0);
include("./includes/db.php");
include("./includes/config.php");
include("./includes/header.php");

// auto rate

         $url_btc =    'https://blockchain.info/ticker';


                  $response_btc = file_get_contents($url_btc);
                  $object_btc = json_decode($response_btc);
                     //print_r($object_btc);                  
                  $usdprice = $object_btc->{"USD"}->{"last"};
                  $rate['rate'] =  $object_btc->{"USD"}->{"last"};

// config Blockchain account

$btc = $rate['rate'];
$guid = 'MANOLOGINAS';  // Blockchain account prisijungimas
$main_password = 'PASSWORDAS1'; // Blockchain slaptazodis
$second_password = 'PASSWORDAS1'; // Blockchain slaptazodis
$rate = $rate['rate'];


$amount=$_POST['amount'];
$uid = mysql_real_escape_string($_SESSION['member']); //
$result = mysql_query("SELECT balance FROM users WHERE username='$uid'") or die("ERROR! CONTACT SUPPORT!");
$row = mysql_fetch_row($result);
$balance = $row[0];
$uid = mysql_real_escape_string($_SESSION['member']);
$ip = mysql_real_escape_string(VisitorIP());
$url = "https://blockchain.info/merchant/$guid/new_address?password=$main_password&second_password=$second_password&label=$uid";
if (isset($_POST['amount'])){
    $_SESSION['USD_amount'] = $_POST['amount'];
    $_SESSION['BTC_amount'] = number_format($_SESSION['USD_amount']/$rate, 8, '.', '');
    $temp = _curl($url, '', '');
    $_SESSION['BTC_Address'] = get_string_between($temp, 'address":"', '"');     
}
if (!isset($_SESSION['USD_amount']) || $_SESSION['USD_amount'] < 5)
    die("Minimum payment 5$");

if (isset($_POST['bitcoin']))
{

    $a = $_SESSION['BTC_Address'];
    $url = "https://blockchain.info/q/addressbalance/$a?confirmations=0";
    $page = _curl($url, '', '');
    if ($page > 0) {
        $amount = $page/100000000;

        if($amount>= $_SESSION['BTC_amount']){
        $y = $_SESSION['USD_amount'];
              $x = $balance+$y;
            $sql = "UPDATE users SET balance=$x WHERE username='$uid'";
            mysql_query($sql);

            $sql2 = "INSERT INTO orders(amount,btcamount,username,lrpaidby,lrtrans,ip,state,date) VALUES('$y','$ba','$uid','$a','$a','$ip','Bitcoin',now())";
            mysql_query($sql2);
            unset($_SESSION['USD_amount']);
         header("location: index.php");
          }else $messages = "<center><font size=2 color=red>Payment not yet completed ! </font></h5></center>";
    }else $messages = "<center><font size=2 color=red>Payment not yet completed !</font></cetner>";
}

?>
<html lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<title>Horta.in</title>
<link rel="icon" href="./index.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="./images/favicon.png"/>

<link href="style.css" rel="stylesheet" type="text/css"/>
<link href="css/main2.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="css/dataTables.bootstrap.css">
<link href="css/datepicker.css" rel="stylesheet" type="text/css"/>
<!--[if IE]> <link href="css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->
<script src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">var $hidew = jQuery.noConflict();</script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="js/jNewsbar.jquery.min.js"></script>
<script>


</script>

</style>
<script type="text/javascript" src="js/jquery_ui_custom.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.resize.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.sparkline.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.autosize.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validate.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.uniform.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.select2.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fancybox.js"></script>
<script type="text/javascript" src="js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="js/plugins/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="js/functions/custom.js"></script>
<script src="js/core.js" type="text/javascript"></script>
<script src="js/t.js" type="text/javascript"></script>
<script type="text/javascript" src="js/date_time.js"></script>
<script type='text/javascript'>

   
(function($)
{
    $hidew(document).ready(function()
    {
        $hidew.ajaxSetup(
        {
            cache: false,
            beforeSend: function() {
                //$('#content').hide();
                //$('#loading').show();
            },
            complete: function() {
                //$('#loading').hide();
                $hidew('#content').show();
            },
            success: function() {
                //$('#loading').hide();
                $hidew('#content').show();
            }
        });
        var $container = $("#content");
        $container.load("infos.php");

        var refreshId = setInterval(function()
        {
            $container.load('infos.php');
         $hidew(".tooltip").hide();
        }, 50000);
    });
})(jQuery);
</script>


<script language="JavaScript">

  function selectText(textField)

  {

    textField.focus();

    textField.select();

  }

</script>

<script type="text/javascript">

    $('#pmconfirm').click(function(){

       $('#fcaptcha').submit();

    });

         

</script>

<script language="JavaScript"><!--



setTimeout('document.fcaptcha.submit()',20000);

//--></script>
<body>
<div id="top">
<div class="top-wrapper">
<a href="index.php" title=""><img src="img/logo.png" class="logo" alt=""/></a>
</div>
</div>

<br/><br/>
<div class="row">
<center>
<table class="table table-bordered" style="width:700px">
<tr><td colspan="2">
<div class="sex columns">
<div class="panel">
<h3 align="center"><img alt="Bitcoin" src="images/7464893de18766233d353e922594feba.jpeg" style="margin-top: -3px; margin-right: 5px;" height="26" width="26"> Pay With BitCoin</h3>
</div>
<hr/>
<div class="panel">
<p>Dear <strong><?php echo $_SESSION['member']; ?></strong> Pay <strong><?=($_SESSION['BTC_amount']+0.0005)?> BTC</strong>.</p>
</div>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title><?php echo htmlspecialchars($SHOP['maintitle'], ENT_QUOTES, 'UTF-8'); ?></title>
<body>

    <p class="button" align="left">
    <table width="760" border="0"
      <tr>
      </tr>
      <tr>
<br>

  <form action="" id="fcaptcha" name="fcaptcha" method="post">
  </p>
<p class="btn">Send exactly  : </p><input type="text" name="sometext" size="10" value="<?=($_SESSION['BTC_amount']+0.0005)?>" onClick="selectText(this);"> <font color="black"><b>BTC</b></font> to the following address:</p>
     <p class="btn"> BTC Address : </p><input type="text" name="sometext" size="37" value="<?=$_SESSION['BTC_Address'] ?>" onClick="selectText(this);"></br>
          </h3>
        <br>
        <div id="actua" align="left" style="color:orange;align:left;font-size:13px;"><strong>Rate: 1BTC = <?=$btc?> USD</strong></div></p>

          <h6>After sending to the above address This page will refresh automatically upon receiving bitcoins.</h6>
     
      <hr style="width:300px" />
<input type="hidden" id="bitcoin" name="bitcoin">
  </form>
<h5 align="center"><img alt="Bitcoin" src="images/warning.png" style="margin-top: -3px; margin-right: 5px;" height="26" width="26">Do not close this Page if the status of Your payment is not yet completed ! </h5>
<br>
<div align="center" class="pat"><img src="images/loading.gif"></div>
<h3><?=

$messages

?></h3>
</center>
<script type="text/javascript">
    $('#pmconfirm').click(function(){
       $('#fcaptcha').submit();
    });
         
</script>
</body>
</html>

<?


function _curl($url, $post = "", $sock, $usecookie = false)
{
    $ch = curl_init();
    if ($post) {
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    }
    if (!empty($sock)) {
        curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
        curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
        curl_setopt($ch, CURLOPT_PROXY, $sock);
    }
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_USERAGENT,
        "Mozilla/6.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3");
    if ($usecookie) {
        curl_setopt($ch, CURLOPT_COOKIEJAR, $usecookie);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $usecookie);
    }
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
function get_string_between($string, $start, $end)
{
    $string = " " . $string;
    $ini = strpos($string, $start);
    if ($ini == 0)
        return "";
    $ini += strlen($start);
    $len = strpos($string, $end, $ini) - $ini;
    return substr($string, $ini, $len);
}
function VisitorIP()
{
    if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    else $ip = $_SERVER['REMOTE_ADDR'];
 
   return trim($ip);
}
?>