【问题标题】:send payments to faucetbox将付款发送到水龙头箱
【发布时间】:2016-03-23 13:19:33
【问题描述】:

我已经尝试自己编写此代码来实现自动将比特币付款发送到水龙头盒,但我需要帮助解决一些错误。 它给了我这个错误

The bitcoinrotator.publiadds.org.pt page is not working bitcoinrotator.publiadds.org.pt can not process this request for time. 500

<?php
//custom parameters
$api_key = "my_api_key";
$userAddy = $_SESSION['user'];
require_once("faucetbox.php");
$currency = "BTC"; # or LTC or any other supported by FaucetBOX
$faucetbox = new FaucetBOX($api_key, $currency);
$users = array(
     'user_id' => clean($user_id), 
     'user_name' => clean($user_name), 
     'user_email' => clean($user_email), 
     'user_pass' => clean($user_pass), 
     'user_points' => clean($user_points), 
     'user_wallet' => clean($user_wallet)
);
session_start();
include_once 'dbconnect.php';

if(!isset($_SESSION['user']))
{
	header("Location: index.php");
}

$selfNav = mysqli_query($conn, "SELECT user_wallet, user_points FROM users WHERE user_id=".$_SESSION['user']);
$rowNav = mysqli_num_rows($selfNav);

$rowAssoc = mysqli_fetch_assoc($selfNav);

$balance = $rowAssoc['user_points'];
$wallet = $rowAssoc['user_wallet'];

//auto cashout if bal over 0.00010000
	
if($balance > 0.00010000){
	    
$amount = $rowAssoc['user_points'];
	   	
$currency = "BTC";
		
$faucetbox = new Faucetbox($api_key, $currency);
		
$result = $faucetbox->send($wallet, $amount);
		  
if($result["success"] === true){
		  
$_SESSION['cashout'] = $result["html"];
		  
//reset balance to zero
		  
mysqli_query($conn, "UPDATE `users` SET user_points = 0  WHERE user_id = " . $_SESSION['user')];
		  		
header('Location: ../home.php');
?>

【问题讨论】:

  • 能否编辑您的问题并提供您收到的错误消息?

标签: bitcoin payment-processing


【解决方案1】:

好吧,这是它的工作,但它仍然存在一些错误,但现在它的工作 错误是 数组 ( [user_wallet] => 11111111111111111111111111111111111 [user_points] => 0.00000010 ) 余额错误

<?php
session_start();//Session start is ALWAYS the first thing to do.
if(!isset($_SESSION['user']))
{
	header("Location: index.php"); //Sending headers its the next thing to do. Always. 
}
include_once 'dbconnect.php';


//custom parameters
$api_key = "my_api_key";
$userAddy = $_SESSION['user'];
require_once("faucetbox.php");
$currency = "BTC"; # or LTC or any other supported by FaucetBOX
$faucetbox = new FaucetBOX($api_key, $currency);
//$users = array(
//     'user_id' => clean($user_id), 
//     'user_name' => clean($user_name), 
//     'user_email' => clean($user_email), 
//     'user_pass' => clean($user_pass), 
//     'user_points' => clean($user_points), 
//     'user_wallet' => clean($user_wallet)
//);



//You are mixing mysql and mysqli, you need to choose one. Since you are on  a shared hosting, mysqli is probably
//not installed/available, so we will keep using mysql. mysqli is safer!
$selfNav = mysql_query("SELECT user_wallet, user_points FROM users WHERE user_id=".$_SESSION['user']);
$rowNav = mysql_num_rows($selfNav);

$rowAssoc = mysql_fetch_assoc($selfNav);

print_r($rowAssoc);

$balance = $rowAssoc['user_points'];
$wallet = $rowAssoc['user_wallet'];

//auto cashout if bal over 0.00010000
	
if($balance > 0.00010000){
	    
$amount = $rowAssoc['user_points'];
	   	
$currency = "BTC";

		
$result = $faucetbox->send($wallet,$amount); //$amount);
		  
if($result["success"] === true){
		  
$_SESSION['cashout'] = $result["html"];
		  
//reset balance to zero
		  
mysql_query("UPDATE `users` SET user_points = 0  WHERE user_id = " . $_SESSION['user']);
		  		echo "result sucess and location go";
//header('Location: ../home.php');
}else{
	echo "Error on faucet";
	var_dump($result);
	//What happens if there is an error?
}
}else{
	echo "do not have enough credit to cash out";
	//what happens if they dont have enough balance?
}
?>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-30
    • 1970-01-01
    • 2022-11-02
    • 2018-01-06
    • 2017-05-22
    • 1970-01-01
    • 2019-06-20
    • 1970-01-01
    相关资源
    最近更新 更多