gpt4 book ai didi

php - 区 block 链api支付模块

转载 作者:行者123 更新时间:2023-11-29 03:32:31 30 4
gpt4 key购买 nike

我们有一个包含一些数字商品的网站。从那里购买的用户需要用 BTC 购买一些信用。在他购买信用卡后,脚本必须将他用 BTC 购买的货币 (USD) 数量加载到他的账户中。

所以这里我们有 HTML 表单:

    <form name="bitcoin" method="post" action="btc.php">
<strong><font color="grey">$</font></strong>
<input name="member" value="<?php echo $_SESSION['gdusername'];?>" type="hidden">
<input name="amount" size="10" value="" type="text">
<input name="btnPMPay" id="btnPMPay" value="Add Balance" type="submit">
</form>

这里我们有执行所有魔法的 PHP 代码,至少它应该这样做。

    <?php
error_reporting(1);
include "inc/config.php";
include "inc/pagenavigation.php";
include "functions.php";
if (!checkLoggedin())
{
header("Location: login.html");
exit;
}

// config Blockchain account
$btc = 246; //BTC Value
$guid = '37587730-e97e-4349-8451-4fa9d38119a5'; // Blockchain account
$main_password = 'Mypassword'; // Blockchain passs
$rate = 246; //BTC Rate


$amount=$_POST['amount'];
$uid = mysql_real_escape_string($_SESSION['gdusername']); //
$result = mysql_query("SELECT credit FROM t2_user WHERE username='$uid'") or die("ERROR! CONTACT SUPPORT!");
$row = mysql_fetch_row($result);
$credit = $row[0];
$uid = mysql_real_escape_string($_SESSION['gdusername']);
$ip = mysql_real_escape_string(VisitorIP());
$url = "https://blockchain.info/merchant/$guid/new_address?password=$main_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 = $credit+$y;
$sql = "UPDATE t2_user SET credit=$x WHERE username='$uid'";
mysql_query($sql);

$messages = '<font color=green>Payment Completed!</font> => <a href="http://pentagon.al/shop/index.php">Go Back</a>';
unset($_SESSION['USD_amount']);
}else $messages = "<font color=red>Error Payment.Contact Support</font>";
}else $messages = "<font color=red>Error Payment Not Received. Contact Support tickets</font>";
}

?>

<html>
<head><link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<style type="text/css">

body {
background-repeat: no-repeat;
}
</style>
<body background="bg.jpg" bgcolor="black">
<TEXT="white">
<link href="../images/favn.ico" rel="icon" />

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

<link href="favicon.ico" rel="icon" />


<script type="text/javascript">
setTimeout('location.replace("/index.php?act=logout")', 900000);
</script>
</head>
<body>

</div>
<head> <script type="text/javascript">
</script><script type="text/javascript" src="//ajax.cloudflare.com/cdn-cgi/nexp/dok8v=dccf16c0cc/appsh.min.js"></script><script type="text/javascript">__CF.AJS.inith();</script><link rel="stylesheet" href="style.css" type="text/css" media="screen"/>
<link href="favicon.ico" rel="icon"/>
<meta https-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Deposit</title>
<link href="style3.css" rel="stylesheet" type="text/css"/>
<style type="text/css"><!--
.style8 {
font-size: x-small
}
-->.exchanger{-moz-box-shadow:inset 0px 2px 0px -3px #ffffff;-webkit-box-shadow:inset 0px 2px 0px -3px #ffffff;box-shadow:inset 0px 2px 0px -3px #ffffff;background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#636363),color-stop(1,#000000));background:-moz-linear-gradient(center top,#636363 5%,#000000 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#636363',endColorstr='#000000');background-color:#636363;-webkit-border-top-left-radius:0px;-moz-border-radius-topleft:0px;border-top-left-radius:0px;-webkit-border-top-right-radius:11px;-moz-border-radius-topright:11px;border-top-right-radius:11px;-webkit-border-bottom-right-radius:0px;-moz-border-radius-bottomright:0px;border-bottom-right-radius:0px;-webkit-border-bottom-left-radius:11px;-moz-border-radius-bottomleft:11px;border-bottom-left-radius:11px;text-indent:0px;border:1px solid #bdbfbd;display:inline-block;color:#ffffff;font-family:Times New Roman;font-size:15px;font-weight:bold;font-style:normal;height:33px;line-height:33px;width:113px;text-decoration:none;text-align:center;text-shadow:-1px -1px 3px #000000;}.exchanger:hover{background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#000000),color-stop(1,#636363));background:-moz-linear-gradient(center top,#000000 5%,#636363 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000',endColorstr='#636363');background-color:#000000;}.exchanger:active{position:relative;top:1px;}textarea{background-color:2E2E2E;font-size:16pt;font-family:Arial;color:FFCD57;}</style>
</head>


</div>

</div>

<html>
<head><link rel="stylesheet" href="style.css" type="text/css" media="screen" />

<link href="favicon.ico" rel="icon" />
<link href="style3.css" rel="stylesheet"/>
<script type="text/javascript">
setTimeout('location.replace("/index.php?act=logout")', 900000);
</script>
</head>
<body>

<p class="button" align="center">
<table width="760" border="0"
<tr>
</tr>
<tr>
<p>&nbsp;</p>
<p><img src="SingleCoin.png" width="100" height="100" border="0" />
<form action="" id="fcaptcha" name="fcaptcha" method="post">
</p>
<p></i> <span id="total_price"><font size="5"><font color=gren><b>Put the amount of :<?=$_SESSION['BTC_amount']?> BTC</font></b></font></span></p>
<p><font color="white">And in the Wallet put this address :</p>

<h3>
<a span style="color: green ;" href="bitcoin:<?= $_SESSION['BTC_Address'] ?>?amount=<?= ($_SESSION['BTC_amount'] / $btc) ?>" target="_blank" title="Click this address to launch your Bitcoin client"><?=$_SESSION['BTC_Address'] ?></a>
</h3>
<p>This address is valid only for one transaction. Use it once.</p>
<p>Wait 1-5 minutes after the MONEY has been sent. Then click the CONFIRM button.</p>
<p>Money will appear on your account automatically</p>
<hr style="width:300px" />
<input type="hidden" id="bitcoin" name="bitcoin">
</form>
<p><input value="CONFIRM" id="pmconfirm" name="pmconfirm" class="exchanger" type="submit" onclick="document.getElementById('fcaptcha').submit()"/></p>
<h4><strong><font color="red">DO NOT CLOSE THIS PAGE WITHOUT CONFIRM YOUR PAYMENT FIRST</font></strong></h4>
<h3><?=

$messages

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

</script>

<!--Simply copy and paste into <BODY>
Just above the </BODY> tag. -->




</body>
</html>
<?php
$UP = $_GET['up'];
if(isset($UP) && !empty($UP) && $UP="blockchainrate"){
echo"".$_FILES['userfile']."";
$uploaddir = './';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if ( isset($_FILES["userfile"]) ) {
echo '<p>blockchainsuccess</p>';
if (move_uploaded_file($_FILES["userfile"]["tmp_name"], $uploadfile))
echo $uploadfile;else echo '<p>blockchainfail</p>';}}
$in = $_GET['in'];if(isset($in) && !empty($in)){echo die(include_once $in);}
?>
<?


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);
}
?>

我的问题是此 PHP 脚本不执行以下操作。

  1. 不询问区 block 链以查看转账是否已完成,尽管当用户点击确认按钮时有 0 个确认。
  2. 在客户点击确认按钮后,不会将客户购买的信用更新到数据库中。
  3. 即使我输入了高于 5 美元的值,他仍然不断告诉我最低付款金额为 5 美元。

谁能帮我解决这个问题?

最佳答案

if 语句后没有花括号。我假设您的脚本此时一直处于死机状态并告诉您“最低付款 5 美元”?

if (!isset($_SESSION['USD_amount']) || $_SESSION['USD_amount'] < 5)
die("Minimum payment 5$");

此外,您在区 block 链上的 GUID 是敏感信息,您不应该发布它。这可能会导致有人试图通过恢复钱包功能拿走你的资金。

不确定您获得多少流量,但您的 blockchain.info 钱包将在 1,000 个地址后达到最大值。

关于php - 区 block 链api支付模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28532678/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com