• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP transaction_cycle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中transaction_cycle函数的典型用法代码示例。如果您正苦于以下问题:PHP transaction_cycle函数的具体用法?PHP transaction_cycle怎么用?PHP transaction_cycle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了transaction_cycle函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: mysql_fetch_array

 if ($sql_num_results > 0) {
     $sql_row = mysql_fetch_array($sql_result);
     $ip_address = $sql_row["IP_Address"];
     $domain = $sql_row["domain"];
     $subfolder = $sql_row["subfolder"];
     $port_number = $sql_row["port_number"];
     $poll_peer = poll_peer($ip_address, $domain, $subfolder, $port_number, 65, "transclerk.php?action=block_hash&block_number={$random_block}");
     if (empty($poll_peer) == TRUE) {
         // Add failure points to the peer in case further issues
         modify_peer_grade($ip_address, $domain, $subfolder, $port_number, 4);
     }
     if (empty($poll_peer) == FALSE && strlen($poll_peer) > 60) {
         // Do a real hash compare
         $current_generation_block = transaction_cycle(0, TRUE);
         $time1 = transaction_cycle(0 - $current_generation_block + $random_block);
         $time2 = transaction_cycle(0 - $current_generation_block + 1 + $random_block);
         $sql = "SELECT hash FROM `transaction_history` WHERE `timestamp` >= {$time1} AND `timestamp` < {$time2} ORDER BY `timestamp`, `hash`";
         $sql_result = mysql_query($sql);
         $sql_num_results = mysql_num_rows($sql_result);
         $random_hash_build = 0;
         if ($sql_num_results > 0) {
             for ($i = 0; $i < $sql_num_results; $i++) {
                 $sql_row = mysql_fetch_array($sql_result);
                 $random_hash_build .= $sql_row["hash"];
             }
         }
         $random_hash_build = hash('sha256', $random_hash_build);
         if ($poll_peer !== $random_hash_build && empty($poll_peer) == FALSE) {
             // Something is wrong, transaction history has an error.
             // Schedule a check in case the peer has an error and not us.
             mysql_query("UPDATE `main_loop_status` SET `field_data` = '{$random_block}' WHERE `main_loop_status`.`field_name` = 'transaction_history_block_check' LIMIT 1");
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:transclerk.php


示例2: mysql_query

         } else {
             if ($loop_active == 3) {
                 mysql_query("DELETE FROM `main_loop_status` WHERE `main_loop_status`.`field_name` = 'treasurer_heartbeat_active'");
                 exit;
             } else {
                 // Script called while still working
                 exit;
             }
         }
     }
 }
 //***********************************************************************************
 //***********************************************************************************
 $previous_transaction_cycle = transaction_cycle(-1);
 $current_transaction_cycle = transaction_cycle(0);
 $next_transaction_cycle = transaction_cycle(1);
 //*****************************************************************************************************
 //*****************************************************************************************************
 // Check my transaction queue and copy pending transaction to the main transaction queue, giving priority
 // to self created transactions over 3rd party submitted transactions
 $sql = "(SELECT * FROM `my_transaction_queue` WHERE `public_key` = '" . my_public_key() . "' ORDER BY `my_transaction_queue`.`timestamp` ASC) \n\tUNION (SELECT * FROM `my_transaction_queue` ORDER BY `my_transaction_queue`.`timestamp` ASC) LIMIT 100";
 $sql_result = mysql_query($sql);
 $sql_num_results = mysql_num_rows($sql_result);
 if ($sql_num_results > 0) {
     // Can we copy my transaction queue to the main queue in the allowed time?
     // Not allowed 180 seconds before and 20 seconds after transaction cycle.
     if ($next_transaction_cycle - time() > 180 && time() - $current_transaction_cycle > 20) {
         $firewall_blocked = intval(mysql_result(mysql_query("SELECT field_data FROM `main_loop_status` WHERE `field_name` = 'firewall_blocked_peer' LIMIT 1"), 0, 0));
         for ($i = 0; $i < $sql_num_results; $i++) {
             $sql_row = mysql_fetch_array($sql_result);
             $public_key = $sql_row["public_key"];
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:treasurer.php


示例3: mysql_result

 $transclerk_block_check = mysql_result(mysql_query("SELECT * FROM `main_loop_status` WHERE `field_name` = 'block_check_start' LIMIT 1"), 0, "field_data");
 if ($transclerk_block_check < ($i + 1) * 500 && $transclerk_block_check != "0") {
     // Break out of loop; Don't do anything until transclerk is finished with this range
     break;
 }
 write_log("Building New Transaction Foundation #{$i}", "FO");
 // Start the process to rebuild the transaction foundation
 // but walk the history of that range first to check for errors.
 $foundation_time_start = $i * 500;
 $foundation_time_end = $i * 500 + 500;
 $do_history_walk = walkhistory($foundation_time_start, $foundation_time_end);
 if ($do_history_walk == 0) {
     // History walk checks out, start building the transaction foundation hash
     // out of every piece of data in the database
     $time1 = transaction_cycle(0 - $current_generation_block + $foundation_time_start);
     $time2 = transaction_cycle(0 - $current_generation_block + $foundation_time_end);
     $sql = "SELECT timestamp, public_key_from, public_key_to, hash, attribute FROM `transaction_history` WHERE `timestamp` >= {$time1} AND `timestamp` <= {$time2} ORDER BY `timestamp`, `hash`";
     $sql_result2 = mysql_query($sql);
     $sql_num_results2 = mysql_num_rows($sql_result2);
     $hash = $sql_num_results2;
     for ($f = 0; $f < $sql_num_results2; $f++) {
         $sql_row2 = mysql_fetch_array($sql_result2);
         $hash .= $sql_row2["timestamp"] . $sql_row2["public_key_from"] . $sql_row2["public_key_to"] . $sql_row2["hash"] . $sql_row2["attribute"];
     }
     $hash = hash('sha256', $hash);
     $sql = "INSERT INTO `transaction_foundation` (`block` ,`hash`)VALUES ('{$i}', '{$hash}')";
     if (mysql_query($sql) == TRUE) {
         // Success
         write_log("New Transaction Foundation #{$i} Complete", "FO");
         // Wipe Balance Index table to reset index creation of public key balances
         if (mysql_query("TRUNCATE TABLE `balance_index`") == FALSE) {
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:foundation.php


示例4: mysql_query

             mysql_query("UPDATE `main_loop_status` SET `field_data` = '1' WHERE `main_loop_status`.`field_name` = 'queueclerk_heartbeat_active' LIMIT 1");
         } else {
             if ($loop_active == 3) {
                 mysql_query("DELETE FROM `main_loop_status` WHERE `main_loop_status`.`field_name` = 'queueclerk_heartbeat_active'");
                 exit;
             } else {
                 // Script called while still working
                 exit;
             }
         }
     }
 }
 //***********************************************************************************
 //***********************************************************************************
 $next_transaction_cycle = transaction_cycle(1);
 $current_transaction_cycle = transaction_cycle(0);
 $treasurer_status = intval(mysql_result(mysql_query("SELECT field_data FROM `main_loop_status` WHERE `field_name` = 'treasurer_heartbeat_active' LIMIT 1"), 0, 0));
 // Can we work on the transactions in the database?
 // Not allowed 30 seconds before and 30 seconds after transaction cycle.
 if ($next_transaction_cycle - time() > 30 && time() - $current_transaction_cycle > 30 && $treasurer_status == 2) {
     // Create a hash of my own transaction queue
     $transaction_queue_hash = queue_hash();
     $db_queue_hash = mysql_result(mysql_query("SELECT field_data FROM `options` WHERE `field_name` = 'transaction_queue_hash' LIMIT 1"), 0, 0);
     if ($db_queue_hash !== $transaction_queue_hash) {
         // Store in database for proper update when peers are polling this info
         mysql_query("UPDATE `options` SET `field_data` = '{$transaction_queue_hash}' WHERE `options`.`field_name` = 'transaction_queue_hash' LIMIT 1");
     }
     // How does my transaction queue compare to others?
     // Ask all of my active peers
     $sql = "SELECT * FROM `active_peer_list` ORDER BY RAND() LIMIT 10";
     $sql_result = mysql_query($sql);
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:queueclerk.php


示例5: transaction_queue

function transaction_queue()
{
    $next_transaction_cycle = transaction_cycle(1);
    $current_transaction_cycle = transaction_cycle(0);
    $results;
    // Wipe transaction queue of all old transaction from current to previous cycle
    if (rand(1, 2) == 2) {
        mysql_query("DELETE QUICK FROM `transaction_queue` WHERE `transaction_queue`.`timestamp` < {$current_transaction_cycle}");
    }
    // Create a hash of my own transaction queue
    $transaction_queue_hash = queue_hash();
    // How does my transaction queue compare to others?
    // Ask all of my active peers
    ini_set('user_agent', 'Timekoin Client (Queueclerk) v' . TIMEKOIN_VERSION);
    ini_set('default_socket_timeout', 2);
    // Timeout for request in seconds
    $transaction_queue_hash_match = 0;
    $transaction_queue_hash_different = 0;
    $hash_different = array();
    $sql = "SELECT * FROM `active_peer_list` ORDER BY RAND()";
    $sql_result = mysql_query($sql);
    $sql_num_results = mysql_num_rows($sql_result);
    $transaction_queue_hash_match = 0;
    $transaction_queue_hash_different = 0;
    if ($sql_num_results > 0) {
        $hash_different = array();
        for ($i = 0; $i < $sql_num_results; $i++) {
            $sql_row = mysql_fetch_array($sql_result);
            $ip_address = $sql_row["IP_Address"];
            $domain = $sql_row["domain"];
            $subfolder = $sql_row["subfolder"];
            $port_number = $sql_row["port_number"];
            $poll_peer = poll_peer($ip_address, $domain, $subfolder, $port_number, 40, "queueclerk.php?action=trans_hash&client=api");
            if ($transaction_queue_hash === $poll_peer) {
                $transaction_queue_hash_match++;
            } else {
                if (empty($poll_peer) == FALSE) {
                    $transaction_queue_hash_different++;
                    $hash_different["ip_address{$transaction_queue_hash_different}"] = $ip_address;
                    $hash_different["domain{$transaction_queue_hash_different}"] = $domain;
                    $hash_different["subfolder{$transaction_queue_hash_different}"] = $subfolder;
                    $hash_different["port_number{$transaction_queue_hash_different}"] = $port_number;
                }
            }
        }
        // End for Loop
    }
    // End number of results check
    // Compare tallies
    if ($transaction_queue_hash_different > 0) {
        // Transaction Queue still not in sync with all peers
        $hash_array = array();
        $transaction_counter = 0;
        for ($i = 1; $i < $transaction_queue_hash_different + 1; $i++) {
            $ip_address = $hash_different["ip_address{$i}"];
            $domain = $hash_different["domain{$i}"];
            $subfolder = $hash_different["subfolder{$i}"];
            $port_number = $hash_different["port_number{$i}"];
            $poll_peer = poll_peer($ip_address, $domain, $subfolder, $port_number, 8200, "queueclerk.php?action=queue&client=api");
            // Bring up first match (if any) to compare agaist our database
            $match_number = 1;
            $current_hash = find_string("---queue{$match_number}=", "---end{$match_number}", $poll_peer);
            $transaction_counter = 0;
            $peer_transaction_limit = 100;
            $mismatch_error_count = 0;
            $mismatch_error_limit = 10;
            while (empty($current_hash) == FALSE) {
                // Count transactions coming from this peer
                $transaction_counter++;
                if ($transaction_counter > $peer_transaction_limit) {
                    break;
                }
                if ($mismatch_error_count > $mismatch_error_limit) {
                    break;
                }
                //Check if this transaction is already in our queue
                $hash_match = mysql_result(mysql_query("SELECT hash FROM `transaction_queue` WHERE `hash` = '{$current_hash}' LIMIT 1"), 0, 0);
                if (empty($hash_match) == TRUE) {
                    // This peer has a different transaction, ask for the full details of it
                    $poll_hash = poll_peer($ip_address, $domain, $subfolder, $port_number, 1500, "queueclerk.php?action=transaction&number={$current_hash}&client=api");
                    $transaction_timestamp = filter_sql(find_string("-----timestamp=", "-----public_key", $poll_hash));
                    $transaction_public_key = find_string("-----public_key=", "-----crypt1", $poll_hash);
                    $transaction_crypt1 = filter_sql(find_string("-----crypt1=", "-----crypt2", $poll_hash));
                    $transaction_crypt2 = filter_sql(find_string("-----crypt2=", "-----crypt3", $poll_hash));
                    $transaction_crypt3 = filter_sql(find_string("-----crypt3=", "-----hash", $poll_hash));
                    $transaction_hash = filter_sql(find_string("-----hash=", "-----attribute", $poll_hash));
                    $transaction_attribute = find_string("-----attribute=", "-----end", $poll_hash);
                    $transaction_qhash = find_string("---qhash=", "---endqhash", $poll_hash);
                    // If a qhash is included, use this to verify the data
                    if (empty($transaction_qhash) == FALSE) {
                        $qhash = $transaction_timestamp . $transaction_public_key . $transaction_crypt1 . $transaction_crypt2 . $transaction_crypt3 . $transaction_hash . $transaction_attribute;
                        $qhash = hash('md5', $qhash);
                        // Compare hashes to make sure data is intact
                        if ($transaction_qhash != $qhash) {
                            $transaction_attribute = "mismatch";
                            $mismatch_error_count++;
                        }
                    } else {
                        // Qhash is required to match hash now
                        $transaction_attribute = "mismatch";
//.........这里部分代码省略.........
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:101,代码来源:task.php


示例6: mysql_query

             mysql_query("UPDATE `main_loop_status` SET `field_data` = '1' WHERE `main_loop_status`.`field_name` = 'genpeer_heartbeat_active' LIMIT 1");
         } else {
             if ($loop_active == 3) {
                 mysql_query("DELETE FROM `main_loop_status` WHERE `main_loop_status`.`field_name` = 'genpeer_heartbeat_active'");
                 exit;
             } else {
                 // Script called while still working
                 exit;
             }
         }
     }
 }
 //***********************************************************************************
 //***********************************************************************************
 $next_generation_cycle = transaction_cycle(1);
 $current_generation_cycle = transaction_cycle(0);
 // Can we work on the transactions in the database?
 // Not allowed 35 seconds before and 35 seconds after generation cycle.
 if ($next_generation_cycle - time() > 35 && time() - $current_generation_cycle > 35) {
     //***********************************************************************************
     if (election_cycle() == TRUE) {
         // Find all transactions between the Previous Transaction Cycle and the Current
         $sql = "SELECT * FROM `generating_peer_queue` WHERE `timestamp` < {$current_generation_cycle} ORDER BY `generating_peer_queue`.`IP_Address` ASC";
         $sql_result = mysql_query($sql);
         $sql_num_results = mysql_num_rows($sql_result);
         if ($sql_num_results > 0) {
             if ($sql_num_results == 1) {
                 // Winner by default
                 $sql_row = mysql_fetch_array($sql_result);
                 $public_key = $sql_row["public_key"];
                 $IP_Address = $sql_row["IP_Address"];
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:genpeer.php


示例7: while

            } else {
                $show_last = 10;
                // Default number of last items to show
            }
            $body_string = '<strong>Showing Last <font color="blue">' . $show_last . '</font> Transaction Cycles</strong>';
            // Start the Transaction Browser section
            $body_string .= '<div class="table"><table class="listing" border="0" cellspacing="0" cellpadding="0" ><tr><th>Transaction Cycle</th>
				<th>Transactions</th></tr>';
            // How many transactions back from the present time to display?
            $show_last_counter = $show_last;
            $counter = -1;
            // Transaction back from present cycle
            while ($show_last_counter > 0) {
                $start_transaction_cycle = transaction_cycle($counter);
                $end_transaction_cycle = transaction_cycle($counter + 1);
                $jump_to_transaction = transaction_cycle($counter + 5);
                $sql = "SELECT * FROM `transaction_history` WHERE `timestamp` >= '{$start_transaction_cycle}' AND `timestamp` < '{$end_transaction_cycle}'";
                $sql_result = mysql_query($sql);
                $sql_num_results = mysql_num_rows($sql_result);
                if ($_POST["highlight_cycle"] - 1500 == $start_transaction_cycle) {
                    $body_string .= '<tr><td class="style2"><p style="font-size: 12px;"><h9 id="' . $start_transaction_cycle . '"></h9><font color="blue">' . $start_transaction_cycle . '<br>' . unix_timestamp_to_human($start_transaction_cycle) . '</font></p></td>
						<td class="style2"><table border="0" cellspacing="0" cellpadding="0"><tr>';
                } else {
                    $body_string .= '<tr><td class="style2"><p style="font-size: 12px;"><h9 id="' . $start_transaction_cycle . '"></h9>' . $start_transaction_cycle . '<br>' . unix_timestamp_to_human($start_transaction_cycle) . '</p></td>
						<td class="style2"><table border="0" cellspacing="0" cellpadding="0"><tr>';
                }
                $koin_kounter = 0;
                $row_count_limit = 12;
                if ($sql_num_results > 1) {
                    // Build row with icons
                    for ($i = 0; $i < $sql_num_results; $i++) {
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:index.php


示例8: visual_repair

function visual_repair($block_start = 0)
{
    $current_generation_block = transaction_cycle(0, TRUE);
    $output;
    // Wipe all blocks ahead
    $time_range = transaction_cycle(0 - $current_generation_block + $block_start);
    $sql = "DELETE QUICK FROM `transaction_history` WHERE `transaction_history`.`timestamp` >= {$time_range} AND `attribute` = 'H'";
    if (mysql_query($sql) == TRUE) {
        $output .= '<tr><td class="style2">Clearing Hash Timestamps Ahead of Block #' . $block_start . '</td></tr>';
    } else {
        return '<tr><td class="style2">Database ERROR, stopping repair process...</td></tr>';
    }
    $generation_arbitrary = ARBITRARY_KEY;
    for ($t = $block_start; $t < $current_generation_block; $t++) {
        $output .= "<tr><td><strong>Repairing Block# {$t}</strong>";
        $time1 = transaction_cycle(0 - $current_generation_block - 1 + $t);
        $time2 = transaction_cycle(0 - $current_generation_block + $t);
        $sql = "SELECT timestamp, hash, attribute FROM `transaction_history` WHERE `timestamp` >= {$time1} AND `timestamp` < {$time2} ORDER BY `timestamp`, `hash` ASC";
        $sql_result = mysql_query($sql);
        $sql_num_results = mysql_num_rows($sql_result);
        $hash = 0;
        for ($i = 0; $i < $sql_num_results; $i++) {
            $sql_row = mysql_fetch_array($sql_result);
            $hash .= $sql_row["hash"];
        }
        // Transaction hash
        $hash = hash('sha256', $hash);
        $sql = "INSERT INTO `transaction_history` (`timestamp` ,`public_key_from` ,`public_key_to` ,`crypt_data1` ,`crypt_data2` ,`crypt_data3` ,`hash` ,`attribute`)\n\t\tVALUES ('{$time2}', '{$generation_arbitrary}', '{$generation_arbitrary}', '{$generation_arbitrary}', '{$generation_arbitrary}', '{$generation_arbitrary}', '{$hash}', 'H')";
        if (mysql_query($sql) == FALSE) {
            // Something failed
            $output .= '<br><strong><font color="red">Repair ERROR in Database</font></strong></td></tr>';
        } else {
            $output .= '<br><strong><font color="blue">Repair Complete...</font></strong></td></tr>';
        }
    }
    // End for loop
    return $output;
}
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:38,代码来源:function.php


示例9: mysql_query

            $sql = "SELECT * FROM `transaction_history` WHERE `timestamp` >= '{$start_transaction_cycle}' AND `timestamp` < '{$end_transaction_cycle}'";
            $sql_result = mysql_query($sql);
            $sql_num_results = mysql_num_rows($sql_result);
            if ($sql_num_results > 1) {
                // Build row with icons
                for ($i = 0; $i < $sql_num_results; $i++) {
                    $sql_row = mysql_fetch_array($sql_result);
                    if ($sql_row["attribute"] == 'G' || $sql_row["attribute"] == 'T') {
                        // Transaction Amount
                        $transaction_info = tk_decrypt($sql_row["public_key_from"], base64_decode($sql_row["crypt_data3"]));
                        $amount += intval(find_string("AMOUNT=", "---TIME", $transaction_info));
                        $transaction_counter++;
                    }
                }
            }
            echo "---TIMESTAMP{$output_counter}=" . transaction_cycle($counter);
            echo "---NUM{$output_counter}={$transaction_counter}";
            echo "---AMOUNT{$output_counter}={$amount}---END{$output_counter}";
            $output_counter++;
            $counter--;
            $last--;
        }
    }
    // End Permission Check
    // Log inbound IP activity
    log_ip("AP", scale_trigger(100));
    exit;
}
//***********************************************************************************
//***********************************************************************************
if ($_GET["action"] == "pk_recv") {
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:api.php


示例10: send_timekoins

function send_timekoins($my_private_key, $my_public_key, $send_to_public_key, $amount, $message)
{
    if (empty($my_private_key) == TRUE || empty($my_public_key) == TRUE || empty($send_to_public_key) == TRUE) {
        return FALSE;
    }
    ini_set('user_agent', 'Timekoin Client v' . TIMEKOIN_VERSION);
    ini_set('default_socket_timeout', 3);
    // Timeout for request in seconds
    $arr1 = str_split($send_to_public_key, 181);
    $encryptedData1 = tk_encrypt($my_private_key, $arr1[0]);
    $encryptedData64_1 = base64_encode($encryptedData1);
    $encryptedData2 = tk_encrypt($my_private_key, $arr1[1]);
    $encryptedData64_2 = base64_encode($encryptedData2);
    // Sanitization of message
    // Filter symbols that might lead to a transaction hack attack
    $symbols = array("|", "?", "=");
    // SQL + URL
    $message = str_replace($symbols, "", $message);
    // Trim any message to 64 characters max and filter any sql
    $message = filter_sql(substr($message, 0, 64));
    $transaction_data = "AMOUNT={$amount}---TIME=" . time() . "---HASH=" . hash('sha256', $encryptedData64_1 . $encryptedData64_2) . "---MSG={$message}";
    $encryptedData3 = tk_encrypt($my_private_key, $transaction_data);
    $encryptedData64_3 = base64_encode($encryptedData3);
    $triple_hash_check = hash('sha256', $encryptedData64_1 . $encryptedData64_2 . $encryptedData64_3);
    $timestamp = transaction_cycle(0) + 1;
    $attribute = "T";
    $qhash = $timestamp . base64_encode($my_public_key) . $encryptedData64_1 . $encryptedData64_2 . $encryptedData64_3 . $triple_hash_check . $attribute;
    $qhash = hash('md5', $qhash);
    // Create map with request parameters
    $params = array('timestamp' => $timestamp, 'public_key' => base64_encode($my_public_key), 'crypt_data1' => $encryptedData64_1, 'crypt_data2' => $encryptedData64_2, 'crypt_data3' => $encryptedData64_3, 'hash' => $triple_hash_check, 'attribute' => $attribute, 'qhash' => $qhash);
    // Build Http query using params
    $query = http_build_query($params);
    // Create Http context details
    $contextData = array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($query) . "\r\n", 'content' => $query);
    // Create context resource for our request
    $context = stream_context_create(array('http' => $contextData));
    // Try all Active Peer Servers
    $sql_result = mysql_query("SELECT * FROM `active_peer_list` ORDER BY RAND()");
    $sql_num_results = mysql_num_rows($sql_result);
    $return_results;
    for ($i = 0; $i < $sql_num_results; $i++) {
        $sql_row = mysql_fetch_array($sql_result);
        $ip_address = $sql_row["IP_Address"];
        $domain = $sql_row["domain"];
        $subfolder = $sql_row["subfolder"];
        $port_number = $sql_row["port_number"];
        $code = $sql_row["code"];
        $poll_peer = filter_sql(poll_peer($ip_address, $domain, $subfolder, $port_number, 5, "api.php?action=send_tk&hash={$code}", $context));
        if ($poll_peer == "OK") {
            write_log("Peer: [{$ip_address}{$domain}:{$port_number}/{$subfolder}] Accepted the Transaction for Processing", "T");
            $return_results = TRUE;
        }
    }
    if ($return_results == TRUE) {
        // Success in sending transaction
        return TRUE;
    } else {
        // No peer servers accepted the transaction data :(
        write_log("No Peers Accepted the Transaction", "T");
        return FALSE;
    }
}
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:62,代码来源:function.php


示例11: tools_bar

function tools_bar()
{
    $default_walk = foundation_cycle(0, TRUE) * 500;
    $default_check = transaction_cycle(0, TRUE) - 10;
    $default_current = transaction_cycle(0, TRUE);
    return '<FORM ACTION="index.php?menu=tools&amp;action=walk_history" METHOD="post">
	<table style="float: left;" cellspacing="5" border="0"><tr><td><input type="submit" value="History Walk"/></td>
	<td>Cycle#<input type="text" size="6" name="walk_history" value="' . $default_walk . '" /></td></tr></table></FORM>
	<FORM ACTION="index.php?menu=tools&amp;action=schedule_check" METHOD="post">
	<table style="float: left;" cellspacing="5" border="0"><tr><td><input type="submit" value="Check"/></td>
	<td>Cycle#<input type="text" size="6" name="schedule_check" value="' . $default_check . '" /></td></tr></table></FORM>
	<FORM ACTION="index.php?menu=tools&amp;action=repair" METHOD="post">
	<table style="float: left;" cellspacing="5" border="0"><tr><td><input type="submit" value="Repair" onclick="return confirm(\'Transaction Repair Can Take a Long Time. Continue?\');" /></td>
	<td>From Cycle#<input type="text" size="6" name="repair_from" value="' . $default_check . '" /></td></tr></table></FORM>
	<br><br><hr>
	<FORM ACTION="index.php?menu=tools&amp;action=check_tables" METHOD="post" onclick="return confirm(\'Database Check Can Take a Long Time. Continue?\');">
	<table style="float: left;" cellspacing="6" border="0"><tr><td><input type="submit" value="Check DB"/></td></tr></table></FORM>
	<FORM ACTION="index.php?menu=tools&amp;action=optimize_tables" METHOD="post" onclick="return confirm(\'Database Optimize Can Take a Long Time. Continue?\');">
	<table style="float: left;" cellspacing="6" border="0"><tr><td><input type="submit" value="Optimize DB"/></td></tr></table></FORM>
	<FORM ACTION="index.php?menu=tools&amp;action=repair_tables" METHOD="post" onclick="return confirm(\'Database Repair Can Take a Long Time. Continue?\');">
	<table style="float: left;" cellspacing="6" border="0"><tr><td><input type="submit" value="Repair DB"/></td></tr></table></FORM>
	<FORM ACTION="index.php?menu=tools&amp;action=clear_foundation" METHOD="post" onclick="return confirm(\'This Will Clear All Foundation Hashes. Continue?\');">
	<table style="float: left;" cellspacing="6" border="0"><tr><td><input type="submit" value="Clear Foundation"/></td></tr></table></FORM>
	<FORM ACTION="index.php?menu=tools&amp;action=clear_banlist" METHOD="post" onclick="return confirm(\'This Will Clear All Banned IPs. Continue?\');">
	<table style="float: left;" cellspacing="6" border="0"><tr><td><input type="submit" value="Clear Banlist"/></td></tr></table></FORM>
	<FORM ACTION="index.php?menu=tools&amp;action=clear_gen" METHOD="post" onclick="return confirm(\'This Will Clear The Peer Generation List & Election Queue. Continue?\');">
	<table style="float: left;" cellspacing="6" border="0"><tr><td><input type="submit" value="Clear Gen"/></td></tr></table></FORM>
	<br><br>';
}
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:29,代码来源:templates.php


示例12: transaction_cycle

                 // Script called while still working
                 exit;
             }
         }
     }
 }
 //***********************************************************************************
 //***********************************************************************************
 $current_transaction_cycle = transaction_cycle(0);
 $next_transaction_cycle = transaction_cycle(1);
 $foundation_status = intval(mysql_result(mysql_query("SELECT field_data FROM `main_loop_status` WHERE `field_name` = 'foundation_heartbeat_active' LIMIT 1"), 0, 0));
 // Can we work on the key balances in the database?
 // Not allowed 120 seconds before and 40 seconds after transaction cycle.
 // Don't run if the Foundation Manager is busy (idle = 2)
 if ($next_transaction_cycle - time() > 120 && time() - $current_transaction_cycle > 40 && $foundation_status == 2) {
     $current_transaction_block = transaction_cycle(0, TRUE);
     $current_foundation_block = foundation_cycle(0, TRUE);
     // Check to make sure enough lead time exist in advance to building
     // another balance index. (60 cycles) or 5 hours
     if ($current_transaction_block - $current_foundation_block * 500 > 60) {
         // -1 Foundation Blocks (Standard)
         $cache_block = foundation_cycle(-1, TRUE);
     } else {
         // -2 Foundation Blocks - Buffers 5 hours after the newest foundation block
         $cache_block = foundation_cycle(-2, TRUE);
     }
     // Build self balance index first
     $public_key_hash = hash('md5', my_public_key());
     $balance_index = mysql_result(mysql_query("SELECT block FROM `balance_index` WHERE `public_key_hash` = '{$public_key_hash}' AND `block` = {$cache_block} LIMIT 1"), 0, 0);
     if ($balance_index === FALSE) {
         // Create self first :)
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:balance.php


示例13: mysql_query

 }
 // End New Peers vs Max New Peers check
 //***********************************************************************************
 //***********************************************************************************
 // Send a heartbeat to all active peers in our list to make sure they are still online
 $sql = "SELECT * FROM `active_peer_list`";
 $sql_result = mysql_query($sql);
 $sql_num_results = mysql_num_rows($sql_result);
 // Grab random Transaction Foundation Hash
 $rand_block = rand(0, foundation_cycle(0, TRUE) - 5);
 // Range from Start to Last 5 Foundation Hash
 $random_foundation_hash = mysql_result(mysql_query("SELECT hash FROM `transaction_foundation` WHERE `block` = {$rand_block} LIMIT 1"), 0, 0);
 // Grab random Transaction Hash
 $rand_block2 = rand(transaction_cycle(0 - transaction_cycle(0, TRUE), TRUE), transaction_cycle(-1000, TRUE));
 // Range from Start to Last 1000 Transaction Hash
 $rand_block2 = transaction_cycle(0 - $rand_block2);
 $random_transaction_hash = mysql_result(mysql_query("SELECT hash FROM `transaction_history` WHERE `timestamp` = {$rand_block2} LIMIT 1"), 0, 0);
 $rand_block2 = ($rand_block2 - TRANSACTION_EPOCH - 300) / 300;
 for ($i = 0; $i < $sql_num_results; $i++) {
     $sql_row = mysql_fetch_array($sql_result);
     if (rand(1, 2) == 2) {
         $ip_address = $sql_row["IP_Address"];
         $domain = $sql_row["domain"];
         $subfolder = $sql_row["subfolder"];
         $port_number = $sql_row["port_number"];
         $last_heartbeat = $sql_row["last_heartbeat"];
         $join_peer_list = $sql_row["join_peer_list"];
         // Choose the type polling done
         $poll_type = rand(1, 6);
         // 1&2=CRC32
         // 3&4=Server Full Check
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:peerlist.php


示例14: str_replace

                     $new_string = str_replace("---enable=1", "---enable=0", $new_string);
                     // Update DB to Disable Task When Finished
                     mysql_query("UPDATE `options` SET `field_data` = '{$new_string}' WHERE `options`.`field_name` = '{$tx_record_name}' LIMIT 1");
                     write_log("Auto Transfer Task ({$tx_name}) Has Completed.", "T");
                 }
             }
         }
         // One Shot Amount Match Transfer
         if ($tx_type == "repeatamount") {
             $tx_key3 = find_string("---key3=", "---amount", $sql_row["field_data"]);
             $tx_key3 = mysql_result(mysql_query("SELECT field_data FROM `my_keys` WHERE `field_name` = '{$tx_key3}' LIMIT 1"), 0, 0);
             $tx_amount = find_string("---amount=", "---amount_match", $sql_row["field_data"]);
             $amount_match = find_string("---amount_match=", "---end", $sql_row["field_data"]);
             // Only check once per transaction cycle or otherwise it will just make a transfer every time it scans
             // Check allowed 180 seconds before and 60 seconds after transaction cycle.
             if (transaction_cycle(1) - time() > 180 && time() - transaction_cycle(0) >= 60) {
                 if (check_crypt_balance($tx_key2) >= $amount_match) {
                     // Create Transaction
                     if (send_timekoins($tx_key1, $tx_key2, $tx_key3, $tx_amount, NULL) == TRUE) {
                         write_log("Auto Transfer Task ({$tx_name}) Has Completed.", "T");
                     }
                 }
             }
         }
         // Repeating Amount Match Transfer
     }
     // Check if enabled
 }
 // Looping through all task
 // Idle State
 mysql_query("UPDATE `main_loop_status` SET `field_data` = '2' WHERE `main_loop_status`.`field_name` = 'autotransfer.php' LIMIT 1");
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:autotransfer.php



注:本文中的transaction_cycle函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP transaction_history_hash函数代码示例发布时间:2022-05-23
下一篇:
PHP trans_url函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap