本文整理汇总了PHP中my_port_number函数的典型用法代码示例。如果您正苦于以下问题:PHP my_port_number函数的具体用法?PHP my_port_number怎么用?PHP my_port_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了my_port_number函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call_script
function call_script($script, $priority = 1, $plugin = FALSE, $web_server_call = FALSE)
{
if ($web_server_call == TRUE) {
// No Properly working PHP CLI Extensions for some odd reason, call from web server instead
$cli_port = mysql_result(mysql_query("SELECT field_data FROM `options` WHERE `field_name` = 'cli_port' LIMIT 1"), 0, 0);
if (empty($cli_port) == TRUE) {
// Use the same server port that is reported to other peers
if ($plugin == TRUE) {
poll_peer(NULL, "localhost", my_subfolder() . "/plugins", my_port_number(), 1, $script);
} else {
poll_peer(NULL, "localhost", my_subfolder(), my_port_number(), 1, $script);
}
} else {
// Use a different port number than what is reported to other peers.
// Useful for port forwarding where the External Internet port is different than
// the Internal web server port being forwarded through the router.
if ($plugin == TRUE) {
poll_peer(NULL, "localhost", my_subfolder() . "/plugins", $cli_port, 1, $script);
} else {
poll_peer(NULL, "localhost", my_subfolder(), $cli_port, 1, $script);
}
}
} else {
if ($priority == 1) {
// Normal Priority
if (getenv("OS") == "Windows_NT") {
pclose(popen("start /B php-win {$script}", "r"));
// This will execute without waiting for it to finish
} else {
exec("php {$script} &> /dev/null &");
// This will execute without waiting for it to finish
}
} else {
if ($plugin == TRUE) {
// Normal Priority
if (getenv("OS") == "Windows_NT") {
pclose(popen("start /B php-win plugins/{$script}", "r"));
// This will execute without waiting for it to finish
} else {
exec("php plugins/{$script} &> /dev/null &");
// This will execute without waiting for it to finish
}
} else {
// Below Normal Priority
if (getenv("OS") == "Windows_NT") {
pclose(popen("start /BELOWNORMAL /B php-win {$script}", "r"));
// This will execute without waiting for it to finish
} else {
exec("nice php {$script} &> /dev/null &");
// This will execute without waiting for it to finish
}
}
}
}
return;
}
示例2: find_string
$peer_domain = find_string("---domain=", "---subfolder", $sql_row["field_data"]);
$peer_subfolder = find_string("---subfolder=", "---port", $sql_row["field_data"]);
$peer_port_number = find_string("---port=", "---end", $sql_row["field_data"]);
// Insert into database as first contact server(s)
$sql = "INSERT INTO `active_peer_list` (`IP_Address` ,`domain` ,`subfolder` ,`port_number` ,`last_heartbeat`, `join_peer_list`, `failed_sent_heartbeat`)\n\t\tVALUES ('{$peer_ip}', '{$peer_domain}', '{$peer_subfolder}', '{$peer_port_number}', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), '0');";
mysql_query($sql);
}
}
if ($active_peers < $max_active_peers) {
//Start polling peers from the new peers list
$sql = "SELECT * FROM `new_peers_list` ORDER BY RAND() LIMIT 10";
$sql_result = mysql_query($sql);
$sql_num_results = mysql_num_rows($sql_result);
$my_server_domain = my_domain();
$my_server_subfolder = my_subfolder();
$my_server_port_number = my_port_number();
// Peer difference
$peer_difference_count = $max_active_peers - $active_peers;
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_failures = $sql_row["poll_failures"];
// Check to make sure that this peer is not already in our active peer list
$duplicate_check1 = mysql_result(mysql_query("SELECT last_heartbeat FROM `active_peer_list` WHERE `IP_Address` = '{$ip_address}' LIMIT 1"), 0, 0);
$duplicate_check2 = mysql_result(mysql_query("SELECT last_heartbeat FROM `active_peer_list` WHERE `domain` LIKE '{$domain}' LIMIT 1"), 0, 0);
if (empty($ip_address) == TRUE) {
//Don't have an IP address, check for duplicate domain or my own domain
if (empty($duplicate_check2) == TRUE && $my_server_domain != $domain) {
示例3: clone_script
function clone_script($script)
{
// No Properly working PHP CLI Extensions for some odd reason, call from web server instead
$cli_port = mysql_result(mysql_query("SELECT field_data FROM `options` WHERE `field_name` = 'cli_port' LIMIT 1"), 0, 0);
if (empty($cli_port) == TRUE) {
// Use the same server port that is reported to other peers
poll_peer(NULL, "localhost", my_subfolder(), my_port_number(), 1, $script);
} else {
// Use a different port number than what is reported to other peers.
// Useful for port forwarding where the External Internet port is different than
// the Internal web server port being forwarded through the router.
poll_peer(NULL, "localhost", my_subfolder(), $cli_port, 1, $script);
}
}
示例4: tab
There also exist a setting in the system tab to auto-update the server IP if it changes frequently.<br><br>
You can manually update this field if the IP address detected is incorrect.<br><br>
Next Peer Election in<br>' . $time_election . '</strong></font><br><br>
Currency Generation in<br>' . $time_generate . '</strong></font>';
if ($_GET["firewall"] == "tool") {
$body_string = '<strong>This will use the settings set in the system tab (domain,folder, & port) to attempt a reverse connection attempt.</strong><br><br>
<FORM ACTION="index.php?menu=generation&firewall=test" METHOD="post"><input type="submit" value="Check My Firewall"/></FORM>';
home_screen('Crypto Currency Generation', $text_bar, $body_string, $quick_info);
exit;
}
if ($_GET["firewall"] == "test") {
ini_set('user_agent', 'Timekoin Server (GUI) v' . TIMEKOIN_VERSION);
ini_set('default_socket_timeout', 25);
// Timeout for request in seconds
// Create map with request parameters
$params = array('domain' => my_domain(), 'subfolder' => my_subfolder(), 'port' => my_port_number());
// 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));
$firewall_poll = filter_sql(file_get_contents('http://timekoin.com/utility/firewall.php', FALSE, $context, NULL, 1024));
if (empty($firewall_poll) == TRUE) {
$firewall_poll = '<font color="red">No Response</font>';
}
$body_string = '<strong>Test Response:</strong><br><br>
' . $firewall_poll . '<br><br>
<FORM ACTION="index.php?menu=generation&firewall=test" METHOD="post"><input type="submit" value="Check My Firewall Again"/></FORM>';
home_screen('Crypto Currency Generation', $text_bar, $body_string, $quick_info);
exit;
示例5: write_log
}
// Finish Starting Plugin Services
echo 1;
} else {
// Already Active
echo 2;
}
}
// End Main System Start
if ($active == 2) {
write_log("Main Process Sent STOP Command from IP: " . $_SERVER['REMOTE_ADDR'], "AP");
$script_loop_active = mysql_result(mysql_query("SELECT field_data FROM `main_loop_status` WHERE `field_name` = 'main_heartbeat_active' LIMIT 1"), 0, 0);
$script_last_heartbeat = mysql_result(mysql_query("SELECT field_data FROM `main_loop_status` WHERE `field_name` = 'main_last_heartbeat' LIMIT 1"), 0, 0);
// Use uPNP to delete inbound ports for Windows systems
if (getenv("OS") == "Windows_NT" && file_exists("utils\\upnpc.exe") == TRUE) {
pclose(popen("start /B utils\\upnpc.exe -d " . my_port_number() . " TCP", "r"));
}
if ($script_loop_active > 0) {
// Main should still be active
if (time() - $script_last_heartbeat > 30) {
// Main stop was unexpected
$sql = "UPDATE `main_loop_status` SET `field_data` = '0' WHERE `main_loop_status`.`field_name` = 'main_heartbeat_active' LIMIT 1";
if (mysql_query($sql) == TRUE) {
// Clear transaction queue to avoid unnecessary peer confusion
mysql_query("TRUNCATE TABLE `transaction_queue`");
// Clear Status for other Scripts
mysql_query("DELETE FROM `main_loop_status` WHERE `main_loop_status`.`field_name` = 'balance_heartbeat_active' LIMIT 1");
mysql_query("DELETE FROM `main_loop_status` WHERE `main_loop_status`.`field_name` = 'foundation_heartbeat_active' LIMIT 1");
mysql_query("DELETE FROM `main_loop_status` WHERE `main_loop_status`.`field_name` = 'generation_heartbeat_active' LIMIT 1");
mysql_query("DELETE FROM `main_loop_status` WHERE `main_loop_status`.`field_name` = 'genpeer_heartbeat_active' LIMIT 1");
mysql_query("DELETE FROM `main_loop_status` WHERE `main_loop_status`.`field_name` = 'peerlist_heartbeat_active' LIMIT 1");
示例6: str_split
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]);
$encryptedPublicKey = base64_encode($encryptedPublicKey);
// Update in the database.
mysql_query("UPDATE `options` SET `field_data` = '{$encryptedPublicKey}' WHERE `options`.`field_name` = 'generation_key_crypt' LIMIT 1");
}
// Crypt3 field will contain the IP address/Domain/etc of where the election request originates from.
// This will allow a reverse check for a valid Timekoin server.
$my_domain = my_domain();
$my_subfolder = my_subfolder();
$my_port = my_port_number();
$crypt3_data = "---ip={$my_generation_IP}---domain={$my_domain}---subfolder={$my_subfolder}---port={$my_port}---end";
$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\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) == FALSE) {
// Look into the future with the magic of math to see if the next generation will even be allowed.