Esempio n. 1
0
chdir(dirname(__FILE__));
// Change wd to this files location
include_once "includes/config.inc.php";
include_once "includes/functions.php";
run_location_tracker();
// Have servers moved if moved update configuration
print "\n";
// === Reset Cron =============================================================
if (!apache_running()) {
    // Apache not running however Cron may have been
    set_cron_tracker("stop");
    // left set to run after a power fail hence reset
}
// ========================================================= End Reset Cron ===
print " ================== UNIFORM SERVER STATUS ==================\n\n";
if (get_ip_current()) {
    // Current IP address
    print " Your Internet IP Address = {$ip_current}\n";
    // as seen from Internet
} else {
    // Either not connected
    print " Your Internet IP Address = Not connected or error! \n";
    // to Internet
}
// or errors returned
if (test_access()) {
    // Can server be accessed
    print " Accessible from Internet = YES\n";
    // from Internet uses
} else {
    print " Accessible from Internet = NO\n";
Esempio n. 2
0
function test_access()
{
    global $ip_current;
    // IP address result of running get_ip_current()
    // get_ip_current()
    if (!get_ip_current()) {
        // Cannot get current IP address
        return false;
        // give up
    }
    $port = get_apache_port();
    // Get apache port from configuration
    // Build complete URL string
    $str = 'http://' . $ip_current . ':' . $port . '/test_access/index.html';
    // Access page using Curl SSL
    $ch = curl_init();
    // Initialize Curl get handle
    curl_setopt($ch, CURLOPT_URL, $str);
    // Set the Curl URL option
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
    // timeout set to 3 sceonds
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // force curl_exec ouput string
    $buffer = curl_exec($ch);
    // save returned page to buffer
    curl_close($ch);
    // Close Curl frees memory
    // Test returned page
    if (preg_match("/UniServer\\saccess/", $buffer)) {
        // Is value "UniServer access"
        return true;
        // yes: update OK
    } else {
        // no: Failed
        return false;
    }
}