本文整理汇总了PHP中election_cycle函数的典型用法代码示例。如果您正苦于以下问题:PHP election_cycle函数的具体用法?PHP election_cycle怎么用?PHP election_cycle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了election_cycle函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: base64_encode
if ($my_public_key == $sql_row["public_key"]) {
$public_key = '<p style="font-size:12px;"><font color="green"><strong>My Public Key</strong></font>';
} else {
$public_key = '<p style="word-wrap:break-word; width:425px; font-size:' . $default_public_key_font . 'px;">' . base64_encode($sql_row["public_key"]);
}
$body_string .= '<tr>
<td class="style2">' . $public_key . '</p></td>
<td class="style2"><p style="font-size:10px;">' . tk_time_convert(time() - $sql_row["timestamp"]) . ' ago</p></td></tr>';
}
$body_string .= '</table></div>';
}
// Next Election Calculator
$max_cycles_ahead = 723;
for ($i = 0; $i < $max_cycles_ahead; $i++) {
$current_generation_cycle = transaction_cycle($i);
if (election_cycle($i) == TRUE) {
$time_election = '<font color="blue"><strong>' . tk_time_convert($current_generation_cycle - time());
break;
}
}
for ($i = 0; $i < $max_cycles_ahead; $i++) {
$current_generation_cycle = transaction_cycle($i);
if (generation_cycle($i) == TRUE) {
$time_generate = '<font color="blue"><strong>' . tk_time_convert($current_generation_cycle - time());
break;
}
}
$text_bar = '<table cellspacing="10" border="0"><tr><td valign="top" width="230">' . $generate_currency . '</td><td>Generating Peers: <font color="green"><strong>' . $generating_peers_now . '</strong></font><br>
Queue for Election: <font color="blue"><strong>' . $generate_peer_queue . '</strong></font></td></tr>
<tr><td align="right">' . $continuous_production . '</td><td>' . $generate_rate . '</td></tr>
<tr><td colspan="2">' . $my_gen_IP_form . '</td></tr></table>';
示例2: 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) {
write_log("IP Address ({$peer_ip}) Already Exist in the Generation List for Public Key: " . base64_encode($public_key), "GP");
示例3: tk_encrypt
$encryptedData3 = tk_encrypt($my_private_key, $crypt3_data);
$encryptedData64_3 = base64_encode($encryptedData3);
// Encrypt Generation Request into Crypt1 field
$encryptedData1 = tk_encrypt($my_private_key, $generation_request);
$encryptedData64_1 = base64_encode($encryptedData1);
$duplicate_hash_check = hash('sha256', $encryptedData64_1 . $generation_request . $encryptedData64_3);
mysql_query("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}', '{$generation_request}' , '{$encryptedData64_3}', '{$duplicate_hash_check}' , 'R')");
}
// End duplicate request check
}
// End Election cycle available check
}
if (empty($found_public_key) == TRUE || $update_generation_IP == TRUE) {
// Not in the allowed generation list, send a request to be elected
// when the next transaction cycle does an election.
if (election_cycle(1) == TRUE || election_cycle(2) == TRUE || election_cycle(3) == TRUE || election_cycle(4) == TRUE || election_cycle(5) == TRUE) {
// Check to see if this request is already in my transaction queue
$found_public_trans_queue = mysql_result(mysql_query("SELECT * FROM `my_transaction_queue` WHERE `attribute` = 'R' LIMIT 1"), 0, 0);
if (empty($found_public_trans_queue) == TRUE) {
$my_private_key = my_private_key();
// Generate a network request to be added to the generation peer list
$generation_request = ARBITRARY_KEY . rand(1, 999999);
// Update Reverse Crypto Testing Data
$generation_key_crypt = mysql_result(mysql_query("SELECT * FROM `options` WHERE `field_name` = 'generation_key_crypt' LIMIT 1"), 0, "field_data");
if (empty($generation_key_crypt) == TRUE) {
// Reverse Crypto Test is empty, create a new one.
// This is just the first 181 characters of the public key encrypted via the private key.
// This is then stored as a data field that is easy to access and quickly output to any
// peer that is going to query this one as a potential generating peer.
$arr1 = str_split($my_public_key, 181);
$encryptedPublicKey = tk_encrypt($my_private_key, $arr1[0]);