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


PHP my_public_key函数代码示例

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


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

示例1: transaction_cycle

                 exit;
             }
         }
     }
 }
 //***********************************************************************************
 //***********************************************************************************
 $previous_generation_cycle = transaction_cycle(-1);
 $current_generation_cycle = transaction_cycle(0);
 $next_generation_cycle = transaction_cycle(1);
 $current_generation_block = transaction_cycle(0, TRUE);
 //*****************************************************************************************************
 //*****************************************************************************************************
 // 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 120 seconds before and 20 seconds after transaction cycle.
     if ($next_generation_cycle - time() > 120 && time() - $current_generation_cycle > 20) {
         $firewall_blocked = mysql_result(mysql_query("SELECT * FROM `main_loop_status` WHERE `field_name` = 'firewall_blocked_peer' LIMIT 1"), 0, "field_data");
         for ($i = 0; $i < $sql_num_results; $i++) {
             $sql_row = mysql_fetch_array($sql_result);
             $time_created = $sql_row["timestamp"];
             $public_key = $sql_row["public_key"];
             $crypt1 = $sql_row["crypt_data1"];
             $crypt2 = $sql_row["crypt_data2"];
             $crypt3 = $sql_row["crypt_data3"];
             $hash_check = $sql_row["hash"];
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:treasurer.php

示例2: base64_decode

 if ($_GET["task"] == "save_new") {
     $taskname = $_POST["taskname"];
     $type = $_POST["type"];
     $fromprivatekey = base64_decode($_POST["fromprivatekey"]);
     $frompublickey = base64_decode($_POST["frompublickey"]);
     $topublickey = base64_decode($_POST["topublickey"]);
     $amount = intval($_POST["amount"]);
     $amount_match = intval($_POST["amount_match"]);
     $delay_days = $_POST["delay_days"];
     $delay_hours = $_POST["delay_hours"];
     $delay_minutes = $_POST["delay_minutes"];
     $easy_key = $_POST["easy_key"];
     $user_server_keys = intval($_POST["use_private"]);
     if ($user_server_keys == TRUE) {
         $fromprivatekey = my_private_key();
         $frompublickey = my_public_key();
     }
     if (empty($easy_key) == FALSE) {
         // Look up destination public key from Easy Key database
         ini_set('user_agent', 'Timekoin Server (AutoTransfer Plugin) v' . TIMEKOIN_VERSION);
         ini_set('default_socket_timeout', 7);
         // Timeout for request in seconds
         // Translate Easy Key to Public Key and fill in field with
         $context = stream_context_create(array('http' => array('header' => 'Connection: close')));
         // Force close socket after complete
         $easy_key = filter_sql(file_get_contents("http://timekoin.net/easy.php?s={$easy_key}", FALSE, $context, NULL, 500));
         if ($easy_key == "ERROR" || empty($easy_key) == TRUE) {
             // No Response :(
             header("Location: autotransfer.php?task=new&error=2");
             exit;
         } else {
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:autotransfer.php

示例3: mysql_query

     }
 }
 // Does the public key half match what is encrypted in the 3rd crypt field from
 // the same peer?
 if ($arr1[0] == $gen_key_crypt && empty($peer_ip) == FALSE && empty($IP_exist1) == TRUE && $domain_fail == FALSE && is_private_ip($peer_ip) == FALSE) {
     if ($delete_request == "DELETE_IP") {
         // Delete my IP and any public key linked to it as it belongs to a previous unknown owner
         mysql_query("DELETE FROM `generating_peer_list` WHERE `generating_peer_list`.`IP_Address` = '{$peer_ip}' LIMIT 1");
         write_log("DELETE IP Request ({$peer_ip}) was allowed for Public Key: " . base64_encode($public_key), "GP");
     } else {
         // My server has moved to another IP, update the list
         mysql_query("UPDATE `generating_peer_list` SET `IP_Address` = '{$peer_ip}' WHERE `generating_peer_list`.`public_key` = '{$public_key}' LIMIT 1");
         write_log("New Generation Peer IP Address ({$peer_ip}) was updated for Public Key: " . base64_encode($public_key), "GP");
     }
 } else {
     if (my_public_key() == $public_key) {
         if (election_cycle(1) == TRUE) {
             if (empty($IP_exist1) == TRUE) {
                 mysql_query("UPDATE `generating_peer_list` SET `IP_Address` = '{$peer_ip}' WHERE `generating_peer_list`.`public_key` = '{$public_key}' LIMIT 1");
                 write_log("Generation Peer List was updated with My New IP Address ({$peer_ip})", "GP");
             }
         }
     } else {
         // Log Error Reasons for Reverse Verification Issues
         if ($arr1[0] != $gen_key_crypt) {
             write_log("Could Not Reverse Verify Half-Crypt String for Public Key: " . base64_encode($public_key), "GP");
         } else {
             if (empty($peer_ip) == TRUE) {
                 write_log("No IP Address To Reverse Verify Public Key: " . base64_encode($public_key), "GP");
             } else {
                 if (empty($IP_exist1) == FALSE) {
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:genpeer.php

示例4: foundation_cycle

 $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 :)
     check_crypt_balance(my_public_key());
 }
 // Build Balance Index for Transactions about to be Processed in the Queue
 $sql = "SELECT public_key FROM `transaction_queue` WHERE `attribute` = 'T'";
 $sql_result = mysql_query($sql);
 $sql_num_results = mysql_num_rows($sql_result);
 $queue_index_created = FALSE;
 if ($sql_num_results > 0) {
     for ($i = 0; $i < $sql_num_results; $i++) {
         if ($next_transaction_cycle - time() > 120) {
             $sql_row = mysql_fetch_array($sql_result);
             $public_key_hash = hash('md5', $sql_row["public_key"]);
             // Run a balance index if one does not already exist
             $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) {
                 // No index balance, go ahead and create one
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:balance.php

示例5: base64_decode

            } else {
                $server_message = '<br><font color="red"><strong>Private Key Restore FAILED!</strong></font><br><br>';
            }
        }
        if ($_GET["dorestore"] == "public" && empty($_POST["restore_public_key"]) == FALSE) {
            $sql = "UPDATE `my_keys` SET `field_data` = '" . base64_decode($_POST["restore_public_key"]) . "' WHERE `my_keys`.`field_name` = 'server_public_key' LIMIT 1";
            if (mysql_query($sql) == TRUE) {
                // Blank reverse crypto data field
                mysql_query("UPDATE `options` SET `field_data` = '' WHERE `options`.`field_name` = 'generation_key_crypt' LIMIT 1");
                $server_message = '<br><font color="blue"><strong>Public Key Restore Complete!</strong></font><br><br>';
            } else {
                $server_message = '<br><font color="red"><strong>Public Key Restore FAILED!</strong></font><br><br>';
            }
        }
        $my_private_key = my_private_key();
        $my_public_key = my_public_key();
        if ($_GET["restore"] == "private" && empty($_POST["restore_private_key"]) == FALSE) {
            $body_string = backup_body($_POST["restore_private_key"], NULL, TRUE, NULL);
        } else {
            if ($_GET["restore"] == "public" && empty($_POST["restore_public_key"]) == FALSE) {
                $body_string = backup_body(NULL, $_POST["restore_public_key"], NULL, TRUE);
            } else {
                $body_string = backup_body();
            }
        }
        $body_string .= $server_message;
        $text_bar = '<table border="0" cellpadding="6"><tr><td><strong><font color="blue">Private Key</font> to send transactions:</strong></td></tr>
			<tr><td><textarea readonly="readonly" rows="8" cols="75">' . base64_encode($my_private_key) . '</textarea></td></tr></table>
			<table border="0" cellpadding="6"><tr><td><strong><font color="green">Public Key</font> to receive:</strong></td></tr>
			<tr><td><textarea readonly="readonly" rows="6" cols="75">' . base64_encode($my_public_key) . '</textarea></td></tr></table>';
        $quick_info = '<strong>Do Not</strong> share your Private Key with anyone for any reason.<br><br>
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:index.php

示例6: transaction_history_query

function transaction_history_query($to_from, $last = 1)
{
    // Ask one of my active peers
    ini_set('user_agent', 'Timekoin Client v' . TIMEKOIN_VERSION);
    ini_set('default_socket_timeout', 5);
    // Timeout for request in seconds
    $cache_refresh_time = 60;
    // Default cache time in seconds
    if ($to_from == 1) {
        $trans_history_sent_to = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'trans_history_sent_to' LIMIT 1"), 0, "field_data");
        $timestamp_cache = intval(find_string("---time=", "---last", $trans_history_sent_to));
        $last_cache = intval(find_string("---last=", "---hdata", $trans_history_sent_to));
        if (time() - $cache_refresh_time < $timestamp_cache && $last == $last_cache) {
            // Return Cache Data
            return find_string("---hdata=", "---hend", $trans_history_sent_to);
        }
    }
    if ($to_from == 2) {
        $trans_history_sent_from = mysql_result(mysql_query("SELECT * FROM `data_cache` WHERE `field_name` = 'trans_history_sent_from' LIMIT 1"), 0, "field_data");
        $timestamp_cache = intval(find_string("---time=", "---last", $trans_history_sent_from));
        $last_cache = intval(find_string("---last=", "---hdata", $trans_history_sent_from));
        if (time() - $cache_refresh_time < $timestamp_cache && $last == $last_cache) {
            // Return Cache Data
            return find_string("---hdata=", "---hend", $trans_history_sent_from);
        }
    }
    $my_public_key = base64_encode(my_public_key());
    if ($to_from == 1) {
        $params = array('public_key' => $my_public_key, 'last' => $last, 'sent_to' => '1');
    }
    if ($to_from == 2) {
        $params = array('public_key' => $my_public_key, 'last' => $last, 'sent_from' => '1');
    }
    // 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));
    $sql_result = mysql_query("SELECT * FROM `active_peer_list` ORDER BY RAND()");
    $sql_num_results = mysql_num_rows($sql_result);
    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, 200000, "api.php?action=pk_history&hash={$code}", $context));
        if (strlen($poll_peer) > 60) {
            // Update data cache
            if ($to_from == 1) {
                mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---last={$last}---hdata={$poll_peer}---hend' WHERE `data_cache`.`field_name` = 'trans_history_sent_to' LIMIT 1");
            }
            if ($to_from == 2) {
                mysql_query("UPDATE `data_cache` SET `field_data` = '---time=" . time() . "---last={$last}---hdata={$poll_peer}---hend' WHERE `data_cache`.`field_name` = 'trans_history_sent_from' LIMIT 1");
            }
            return $poll_peer;
        }
    }
    // No peers would respond
    write_log("No Peers Answered the Transaction History Poll", "GU");
    return;
}
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:64,代码来源:function.php

示例7: base64_decode

         $server_message = '<br><font color="blue"><strong>Private Key Restore Complete!</strong></font><br><br>';
     } else {
         $server_message = '<br><font color="red"><strong>Private Key Restore FAILED!</strong></font><br><br>';
     }
 }
 if ($_GET["dorestore"] == "public" && empty($_POST["restore_public_key"]) == FALSE) {
     $sql = "UPDATE `my_keys` SET `field_data` = '" . base64_decode($_POST["restore_public_key"]) . "' WHERE `my_keys`.`field_name` = 'server_public_key' LIMIT 1";
     if (mysql_query($sql) == TRUE) {
         // Blank reverse crypto data field
         mysql_query("UPDATE `options` SET `field_data` = '' WHERE `options`.`field_name` = 'generation_key_crypt' LIMIT 1");
         $server_message = '<br><font color="blue"><strong>Public Key Restore Complete!</strong></font><br><br>';
     } else {
         $server_message = '<br><font color="red"><strong>Public Key Restore FAILED!</strong></font><br><br>';
     }
 }
 $my_public_key = base64_encode(my_public_key());
 $my_private_key = base64_encode(my_private_key());
 $private_key_crypt = mysql_result(mysql_query("SELECT * FROM `options` WHERE `field_name` = 'private_key_crypt' LIMIT 1"), 0, 1);
 if ($private_key_crypt == TRUE) {
     $key_encrypted = '<font color="red"><strong>WARNING:</strong></font> <font color="blue"><strong><i>Private Key Is Encrypted</i></strong></font>';
 }
 if ($_GET["restore"] == "private" && empty($_POST["restore_private_key"]) == FALSE) {
     $body_string = backup_body($_POST["restore_private_key"], NULL, TRUE, NULL);
 } else {
     if ($_GET["restore"] == "public" && empty($_POST["restore_public_key"]) == FALSE) {
         $body_string = backup_body(NULL, $_POST["restore_public_key"], NULL, TRUE);
     } else {
         $body_string = backup_body();
     }
 }
 $body_string .= $server_message;
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:index.php


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