当前位置: 首页>>代码示例>>PHP>>正文


PHP peer_gen_amount函数代码示例

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


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

示例1: tk_decrypt

 $crypt1 = $sql_row["crypt_data1"];
 $crypt2 = $sql_row["crypt_data2"];
 $crypt3 = $sql_row["crypt_data3"];
 $hash_check = $sql_row["hash"];
 // Check generation amount to make sure it has not been tampered with
 $transaction_info = tk_decrypt($public_key, base64_decode($crypt3));
 $transaction_amount_sent = find_string("AMOUNT=", "---TIME", $transaction_info);
 $transaction_amount_sent_test = intval($transaction_amount_sent);
 if ($transaction_amount_sent_test == $transaction_amount_sent && $transaction_amount_sent > 0) {
     // Is a valid integer
     $amount_valid = TRUE;
 } else {
     // Is NOT a valid integer
     $amount_valid = FALSE;
 }
 if ($transaction_amount_sent <= peer_gen_amount($public_key) && $amount_valid == TRUE) {
     // Everything checks out for valid integer and generation amount
 } else {
     // Either the amount to generate was wrong or the amount itself is not an integer
     $amount_valid = FALSE;
 }
 if (hash('sha256', $crypt1 . $crypt2 . $crypt3) == $hash_check && $amount_valid == TRUE) {
     // Public key not found, insert into final transaction history
     $sql = "INSERT INTO `transaction_history` (`timestamp` ,`public_key_from`, `public_key_to` ,`crypt_data1` ,`crypt_data2` ,`crypt_data3` ,`hash` ,`attribute`)\n\t\t\t\t\t\t\t\t\tVALUES ({$time_created}, '{$public_key}', '{$public_key}', '{$crypt1}', '{$crypt2}', '{$crypt3}', '{$hash_check}', 'G');";
     if (mysql_query($sql) == FALSE) {
         //Something didn't work
         write_log("Generation Insert Failed for this Key:" . base64_encode($public_key), "G");
     }
     // Update the last generation timestamp
     $sql = "UPDATE `generating_peer_list` SET `last_generation` = '{$current_generation_cycle}' WHERE `generating_peer_list`.`public_key` = '{$public_key}' LIMIT 1";
     if (mysql_query($sql) == FALSE) {
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:treasurer.php

示例2: log_ip

            log_ip("AP", scale_trigger(100));
            exit;
        }
        // Sent from Public Key
    }
    // Valid Permissions Check
    log_ip("AP", scale_trigger(100));
    exit;
}
//***********************************************************************************
//***********************************************************************************
if ($_GET["action"] == "pk_gen_amt") {
    if (check_hashcode_permissions($hash_permissions, "pk_gen_amt") == TRUE) {
        // The amount of Timekoins being generated by a public key
        $public_key = filter_sql(base64_decode($_POST["public_key"]));
        echo peer_gen_amount($public_key);
    }
    // Log inbound IP activity
    log_ip("AP", scale_trigger(100));
    exit;
}
//***********************************************************************************
//***********************************************************************************
if ($_GET["action"] == "tk_trans_total") {
    if (check_hashcode_permissions($hash_permissions, "tk_trans_total") == TRUE) {
        $last = intval($_GET["last"]);
        if ($last > 100 || $last < 1) {
            $last = 1;
        }
        $counter = -1;
        // Transaction back from present cycle
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:api.php

示例3: peer_gen_amount

            if (time() - $join_peer_list < 3600) {
                // Can't generate yet
                $generate_currency = 'Generation <font color="green"><strong>Enabled</strong></font>';
                $generate_rate = '@ <font color="green"><strong>' . peer_gen_amount($my_public_key) . '</strong></font> per Cycle';
                $continuous_production = '<font color="blue">Generation not allowed for ' . tk_time_convert(3600 - (time() - $join_peer_list)) . '</font>';
            } else {
                if ($join_peer_list === FALSE) {
                    // Not elected to the generating peer list yet
                    $generate_currency = 'Generation <font color="green"><strong>Enabled</strong></font>';
                    $generate_rate = '@ <font color="green"><strong>' . peer_gen_amount($my_public_key) . '</strong></font> per Cycle';
                    $continuous_production = '<font color="red"><strong>This Peer Has Not<br> Been Elected Yet</strong></font>';
                } else {
                    $production_time = tk_time_convert(time() - $join_peer_list);
                    $last_generation = tk_time_convert(time() - $last_generation);
                    $generate_currency = 'Generation <font color="green"><strong>Enabled</strong></font>';
                    $generate_rate = '@ <font color="green"><strong>' . peer_gen_amount($my_public_key) . '</strong></font> per Cycle';
                    $continuous_production = 'Continuous Production for ' . $production_time . '<br>Last Generated ' . $last_generation . ' ago';
                }
            }
        } else {
            $generate_currency = 'Generation <font color="red">Disabled</font>';
        }
        $body_string = generation_body($generate_currency_enabled);
        if ($_GET["generate"] == "showlist") {
            $default_public_key_font = mysql_result(mysql_query("SELECT * FROM `options` WHERE `field_name` = 'public_key_font_size' LIMIT 1"), 0, "field_data");
            $my_public_key = my_public_key();
            $body_string = $body_string . '<hr><strong>Current Generation List</strong>
				<div class="table"><table class="listing" border="0" cellspacing="0" cellpadding="0" ><tr><th>Public Key</th><th>Joined</th><th>Last Generated</th></tr>';
            $sql = "SELECT * FROM `generating_peer_list` ORDER BY `join_peer_list` ASC";
            $sql_result = mysql_query($sql);
            $sql_num_results = mysql_num_rows($sql_result);
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:index.php

示例4: my_private_key

         // End duplicate request check
     }
     // End Election cycle available check
 }
 if (empty($found_public_key) == FALSE) {
     // Look into the future with the magic of math to see if the next generation will even be allowed.
     if (generation_cycle(1) == TRUE) {
         $my_private_key = my_private_key();
         // Server public key is listed as a qualified generation server.
         // Has the server submitted it's currency generation to the transaction queue?
         $found_public_key_my_queue = mysql_result(mysql_query("SELECT * FROM `my_transaction_queue` WHERE `attribute` = 'G' LIMIT 1"), 0, "timestamp");
         $found_public_key_trans_queue = mysql_result(mysql_query("SELECT * FROM `transaction_queue` WHERE `public_key` = '{$my_public_key}' AND `attribute` = 'G' LIMIT 1"), 0, "timestamp");
         $join_peer_list = mysql_result(mysql_query("SELECT * FROM `generating_peer_list` WHERE `public_key` = '{$my_public_key}' LIMIT 1"), 0, "join_peer_list");
         if (empty($found_public_key_my_queue) == TRUE && empty($found_public_key_trans_queue) == TRUE && time() - $join_peer_list >= 3600) {
             // How much can be generated at one time?
             $allowed_amount = peer_gen_amount($my_public_key);
             //Not found, add it to transaction queue
             $arr1 = str_split($my_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);
             $transaction_data = "AMOUNT={$allowed_amount}---TIME=" . time() . "---HASH=" . hash('sha256', $encryptedData64_1 . $encryptedData64_2);
             $encryptedData3 = tk_encrypt($my_private_key, $transaction_data);
             $encryptedData64_3 = base64_encode($encryptedData3);
             $duplicate_hash_check = hash('sha256', $encryptedData64_1 . $encryptedData64_2 . $encryptedData64_3);
             $sql = "INSERT INTO `my_transaction_queue` (`timestamp`,`public_key`,`crypt_data1`,`crypt_data2`,`crypt_data3`, `hash`, `attribute`)\n\t\t\t\t\tVALUES ('" . time() . "', '{$my_public_key}', '{$encryptedData64_1}', '{$encryptedData64_2}' , '{$encryptedData64_3}', '{$duplicate_hash_check}' , 'G')";
             mysql_query($sql);
         }
     }
     // Future generation allowed check
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:generation.php


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