Example #1
0
/**
 * Checks to see if the server check was passed
 * @return unknown_type
 */
function serverPass($content)
{
    exit('serverpass');
    if (!isset($_COOKIE['check_server']) || !$_COOKIE['check_server']) {
        if (checkServer($content)) {
            $content[] = dgettext('core', 'Server passed enough tests to allow installation.');
            $content[] = sprintf('<p><a href="index.php">%s</a></p>', dgettext('core', 'Continue...'));
            setcookie('check_server', 1, 0);
        } else {
            $content[] = dgettext('core', 'Server failed crucial tests. You may not install phpWebSite.');
            setcookie('check_server', 0, 0);
        }
        display(dgettext('core', 'Checking server'), implode('<br />', $content));
    }
}
Example #2
0
 public function signUpForm()
 {
     if (file_exists(DIR_APP . '/config.php')) {
         return;
     }
     $packages = glob(DIR_LANGUAGE . '/*');
     $langs = [];
     if (empty($packages)) {
         $langs = json_decode(getContentByUrl(API_HOST . 'languages/list'), true);
         if (!is_array($langs)) {
             return 'Please, download language package manually and unzip into /app/languages';
         }
     } else {
         foreach ($packages as $package) {
             $key = str_replace(DIR_LANGUAGE . '/', '', $package);
             $arr = (include $package . '/translation.php');
             $langs[$key] = $arr['lang_native_name'];
         }
     }
     return render(DIR_SYSTEM . '/modules/user/views/login-signup.php', ['langs' => $langs, 'lang' => app('request')->getPreferredLanguage(array_keys($langs)), 'errors' => checkServer(), 'title' => 'Sign up for', 'signUp' => true]);
 }
Example #3
0
 if ($server_starting) {
     if ($starting_count++ > 5) {
         $subject = "!! ALERT !! Socket Server {$_SERVER["HOSTNAME"]} failed to restart, trying again...";
         $message = "Server hasn't restarted in 5 seconds, trying again...\n";
         echo $message;
         startServer();
         mailPeeps($subject, $message);
     }
 } else {
     if ($server_running === 0) {
         echo "Server not running, starting executable: {$executable}\n";
         startServer();
     } else {
         $server_starting = false;
         echo "Server already running, checking if responding...\n";
         if (checkServer() === false) {
             echo "SERVER FAILED TO RESPOND!  #bad responses [{$bad_response}]\n";
             $bad_response++;
         } else {
             echo "Server responded with bin position {$bin_position}, last position {$last_bin_position}\n";
             $last_bin_position = $bin_position;
             if ($bad_response > 0) {
                 $bad_response--;
             }
         }
         if ($bad_response > 3) {
             $subject = "!! ALERT !! Socket Server {$_SERVER["HOSTNAME"]} is being restarted!";
             $message = "MORE THAN THREE BAD RESPONSES IN A ROW, RESTARTING SERVER!\n";
             echo $message;
             startServer();
             mailPeeps($subject, $message);
Example #4
0
$op = checkServer($hostIp, $hostPort);
if ($op) {
    echo "true for {$hostIp} <br>";
} else {
    echo "false for {$hostIp} <br>";
}
$hostIp = "127.0.0.1";
$op = checkServer($hostIp, $hostPort);
if ($op) {
    echo "true for {$hostIp} <br>";
} else {
    echo "false for {$hostIp} <br>";
}
$hostIp = "213.163.68.175";
$op = checkServer($hostIp, $hostPort);
if ($op) {
    echo "true for {$hostIp} <br>";
} else {
    echo "false for {$hostIp} <br>";
}
$hostIp = "200.200.200.200";
$op = checkServer($hostIp, $hostPort);
if ($op) {
    echo "true for {$hostIp} <br>";
} else {
    echo "false for {$hostIp} <br>";
}
?>
    </body>
</html>
<?php

$keys = getkeys();
$expired_keys = getexpiredkeys();
$config = getconfig();
$count = 0;
$server_running = checkServer();
?>
<h1>Server Status and Statistics <?php 
if (isAdministrativeUser()) {
    echo ' - Administrator';
}
?>
</h1>
<h2>Legend</h2>
<p><ul>
    <li><b>Available Keys:</b> Shows how many <b>not</b> expired keys  are available on the database.</li>
    <li><b>Maximum connections  Per Key (default: 15) (New) :</b> The maximum number of <b>concurrent</b> connections the server can handle for <b>each key</b>. When this number is reached the server stops for protecting the keys</li>
    <li><b>Active Connections:</b> The current number of concurrent connections. Refreshed every 10 sec. <b>When the server has no Validation Data or the key is overloaded then this is set to 999 for allowing a 4s to connect</b></li>
    <li><b>Maximum Keyload - (default: 500):</b> The maximum Requests based upon Session. When this value is reached the key pauses</li>
    <li><b>Keyload Dropdown -(default: 100):</b> How much the keyload will drops after the keyload interval has passed </li>
    <li><b>Keyload Dropdown Interval - (default: 1200):</b> How often the agent will check for an overloaded key and dropdown the keyload (see above)</li>
</ul></p>
<br />
<table>
    <tr>
        <th>Server status</th>
        <td>
            <?php 
if ($server_running == true) {
    echo '<p class="notification green">ON</p>';
$optString = 'H:p:w:h';
$longOpt = ['host:', 'port:', 'warn:', 'help'];
$options = getopt($optString, $longOpt);
if (isset($options['h']) || isset($options['help'])) {
    printHelp();
    exit(3);
} else {
    if (isset($options['H']) || isset($options['host'])) {
        $config['host'] = isset($options['host']) ? $options['host'] : $options['H'];
        if (isset($options['p']) || isset($options['port'])) {
            $config['port'] = isset($options['port']) ? $options['port'] : $options['p'];
        }
        if (isset($options['w']) || isset($options['warn'])) {
            $config['warn'] = isset($options['warn']) ? $options['warn'] : $options['w'];
        }
        exit(checkServer($config));
    } else {
        printSummary();
        exit(3);
    }
}
function checkServer($config)
{
    // Check array
    if (!is_array($config) || !isset($config['host']) || !isset($config['port']) || !isset($config['warn'])) {
        print 'Invalid arguments.' . EOL;
        printSummary();
        return 3;
    }
    $query = new MinePHPQuery($config['host'], $config['port']);
    // Server down
Example #7
0
 public function loginForm()
 {
     return view('user/login-signup', ['autoLogin' => app('user')->autologin, 'errors' => checkServer(), 'title' => 'Log in to', 'signUp' => false]);
 }
Example #8
0
    $owner = $row['user'];
    $hostname = $row['hostname'];
    $port = $row['port'];
    $hostip = $row['ip'];
    $srvId = $row['srvId'];
    $sshport = $row['sshport'];
    $startcmd = trim($row['startcmd']);
    $startcmd = str_replace("{port}", $port, $startcmd);
    $data = true;
    $task = "";
    if ($active) {
        //Before showing everything to the user, parse ALL servers which are active (not stopped) and check that are they running.
        if (!checkStatus($hostip, $sshport, $acc, $pwd)) {
            startServer($hostip, $sshport, $acc, $pwd, $startcmd);
        } else {
            if (!checkServer($hostip, $port)) {
                restartServer($hostip, $sshport, $acc, $pwd, $startcmd);
            }
        }
    }
}
$id = intval(trim($_SESSION['accid']));
?>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name=viewport content="width=device-width, initial-scale=1">
        <title><?php 
echo $user;
?>
 | 1fx. # Server Panel</title>