예제 #1
0
function parseSendManyList(&$strOut, $strText)
{
    $tmpList = explode(",", $strText);
    $tobj = new stdClass();
    if (count($tmpList) < 1) {
        return FALSE;
    }
    foreach ($tmpList as $val) {
        $tmp = explode(":", $val);
        if (count($tmp) != 2 || !isWalletAddress(trim($tmp[0])) || floatval($tmp[1]) <= 0) {
            return FALSE;
        }
        $tmp[0] = trim($tmp[0]);
        $tobj->{$tmp}[0] = floatval(trim($tmp[1]));
    }
    $strOut = $tobj;
    return TRUE;
}
예제 #2
0
 if ($currentAction == "sendtoaddress") {
     $srv = array();
     $rpcOut;
     if (!isLoggedIn()) {
         $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Login Required', 'reason' => 'You have to login for this operation.'));
     } else {
         if (defined("DEMO_MODE") && DEMO_MODE) {
             $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Demo Mode Enabled', 'reason' => 'Change is not allowed in demo mode!'));
         } else {
             if (empty($_POST['serverID']) || intval($_POST['serverID']) < 1) {
                 $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Error!', 'reason' => 'Unable to load server ID.'));
             } else {
                 if (!DB_GetRow($srv, DB_TABLE_RPC_SERVER, $rDbStruct[DB_TABLE_RPC_SERVER], array('WHERE' => "`id`='" . intval($_POST['serverID']) . "'"))) {
                     $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Error!', 'reason' => 'Unable to get server information.'));
                 } else {
                     if (empty($_POST['sendTo']) || !isWalletAddress($_POST['sendTo'])) {
                         $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Error!', 'reason' => 'You entered invalid wallet address.'));
                     } else {
                         if (empty($_POST['sendAmount']) || floatval($_POST['sendAmount']) <= 0) {
                             $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Error!', 'reason' => 'Send amount is invalid.'));
                         } else {
                             if (!rpc_request($rpcOut, $srv, array('method' => 'sendtoaddress', 'params' => array($_POST['sendTo'], floatval($_POST['sendAmount']), '', '')))) {
                                 $jsonData = array('success' => false, 'root' => array(), 'error' => array('title' => 'Error!', 'reason' => $rpcOut->error->message));
                                 insertLog("ERROR", "sendtoaddress", "unable to send coins!", sprintf("code:#%d,message:%s", $rpcOut->error->code, $rpcOut->error->message));
                             } else {
                                 $jsonData = array('success' => true, 'root' => array(), 'error' => array());
                                 insertLog("OK", "sendtoaddress", "successfully send!", sprintf("TXID:%s", $rpcOut->result));
                             }
                         }
                     }
                 }