160 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			160 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<head>
 | 
						|
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js" type="text/javascript"></script>
 | 
						|
    <style>
 | 
						|
        .hiddenRow { display: none; }
 | 
						|
    </style>
 | 
						|
    <script>
 | 
						|
        function toggleNextRow(row) {
 | 
						|
            var nextRow = $(row).next();
 | 
						|
            nextRow.toggle();
 | 
						|
        }
 | 
						|
	function togglebodykworld() {
 | 
						|
            $('#kworldstable tbody').toggle();
 | 
						|
        }
 | 
						|
 | 
						|
    </script>
 | 
						|
</head>
 | 
						|
<?php
 | 
						|
/*
 | 
						|
* Script: Server Status
 | 
						|
* Author: Martin Dixon
 | 
						|
* From: Tutorial-Resource.com
 | 
						|
* URL: www.tutorial-resource.com
 | 
						|
* Version: 1.0
 | 
						|
* License: Free
 | 
						|
*/
 | 
						|
 | 
						|
# Load the configurations.
 | 
						|
require "ss_configs_kworld.php";
 | 
						|
 | 
						|
# Start a variable to contain Service Status.
 | 
						|
if ($serverstatusvisible > "0") {
 | 
						|
    $serverStatus = "<div class=\"Widgets\"><table id='kworldstable' width='190' border='0' cellspacing='0' cellpadding='1'><thead><tr onclick='togglebodykworld()'><th>K-World Status</font></th><th><font color='white'></font></th></tr></thead>";
 | 
						|
 }
 | 
						|
	
 | 
						|
# Process all services1 montiored.
 | 
						|
foreach( $configs['services1'] as $serviceName => $servicePort )
 | 
						|
{
 | 
						|
	# Determine Port Status.
 | 
						|
	$status = @fsockopen($configs['server_ip'], $servicePort, $errno, $errstr, 5);
 | 
						|
	
 | 
						|
	# What is the result.
 | 
						|
	if( !$status )
 | 
						|
	{
 | 
						|
		$statusText = "<font color='red'>Down</font>";
 | 
						|
	}
 | 
						|
	else
 | 
						|
	{
 | 
						|
		$statusText = "<font color='green'>Up</font>";
 | 
						|
	}
 | 
						|
	
 | 
						|
	# Set the status Row.
 | 
						|
	$serverStatus .= "<tbody><td BGCOLOR='#FFFFFF'>{$serviceName}</td><td BGCOLOR='#FFFFFF'>{$statusText}</td></tr>";
 | 
						|
}
 | 
						|
 | 
						|
# Process all services1 montiored.
 | 
						|
foreach( $configs['services2'] as $serviceName => $servicePort )
 | 
						|
{
 | 
						|
	# Determine Port Status.
 | 
						|
	$status = @fsockopen($configs['server_ip2'], $servicePort, $errno, $errstr, 5);
 | 
						|
	
 | 
						|
	# What is the result.
 | 
						|
	if( !$status )
 | 
						|
	{
 | 
						|
		$statusText = "<font color='red'>Down</font>";
 | 
						|
	}
 | 
						|
	else
 | 
						|
	{
 | 
						|
		$statusText = "<font color='green'>Up</font>";
 | 
						|
	}
 | 
						|
	
 | 
						|
	# Set the status Row.
 | 
						|
	$serverStatus .= "<td BGCOLOR='#FFFFFF'>{$serviceName}</td><td BGCOLOR='#FFFFFF'>{$statusText}</td></tr>";
 | 
						|
}
 | 
						|
 | 
						|
# Process all services1 montiored.
 | 
						|
foreach( $configs['services3'] as $serviceName => $servicePort )
 | 
						|
{
 | 
						|
	# Determine Port Status.
 | 
						|
	$status = @fsockopen($configs['http://k-loud.tk'], 80, $errno, $errstr, 5);
 | 
						|
	
 | 
						|
	# What is the result.
 | 
						|
	if( !$status )
 | 
						|
	{
 | 
						|
		$statusText = "<font color='red'>Down</font>";
 | 
						|
	}
 | 
						|
	else
 | 
						|
	{
 | 
						|
		$statusText = "<font color='green'>Up</font>";
 | 
						|
	}
 | 
						|
	
 | 
						|
	# Set the status Row.
 | 
						|
	$serverStatus .= "<td BGCOLOR='#FFFFFF'>{$serviceName}</td><td BGCOLOR='#FFFFFF'>{$statusText}</td></tr>";
 | 
						|
}
 | 
						|
 | 
						|
# Process all services1 montiored.
 | 
						|
foreach( $configs['services4'] as $serviceName => $servicePort )
 | 
						|
{
 | 
						|
	# Determine Port Status.
 | 
						|
	$status = @fsockopen($configs['server_ip4'], $servicePort, $errno, $errstr, 5);
 | 
						|
	
 | 
						|
	# What is the result.
 | 
						|
	if( !$status )
 | 
						|
	{
 | 
						|
		$statusText = "<font color='red'>Down</font>";
 | 
						|
	}
 | 
						|
	else
 | 
						|
	{
 | 
						|
		$statusText = "<font color='green'>Up</font>";
 | 
						|
	}
 | 
						|
	
 | 
						|
	# Set the status Row.
 | 
						|
	$serverStatus .= "<td BGCOLOR='#FFFFFF'>{$serviceName}</td><td BGCOLOR='#FFFFFF'>{$statusText}</td></tbody></tr>";
 | 
						|
}
 | 
						|
 | 
						|
# Process all services1 montiored.
 | 
						|
foreach( $configs['services5'] as $serviceName => $servicePort )
 | 
						|
{
 | 
						|
	# Determine Port Status.
 | 
						|
	$status = @fsockopen($configs['server_ip5'], $servicePort, $errno, $errstr, 5);
 | 
						|
	
 | 
						|
	# What is the result.
 | 
						|
	if( !$status )
 | 
						|
	{
 | 
						|
		$statusText = "<font color='red'>Down</font>";
 | 
						|
	}
 | 
						|
	else
 | 
						|
	{
 | 
						|
		$statusText = "<font color='green'>Up</font>";
 | 
						|
	}
 | 
						|
	
 | 
						|
	# Set the status Row.
 | 
						|
	$serverStatus .= "<td BGCOLOR='#FFFFFF'>{$serviceName}</td><td BGCOLOR='#FFFFFF'>{$statusText}</td></tbody></tr>";
 | 
						|
}
 | 
						|
 | 
						|
# Process all services1 montiored.
 | 
						|
foreach( $configs['services6'] as $serviceName => $servicePort )
 | 
						|
{
 | 
						|
	# Determine Port Status.
 | 
						|
	$status = @fsockopen($configs['server_ip6'], $servicePort, $errno, $errstr, 5);
 | 
						|
	
 | 
						|
	# What is the result.
 | 
						|
	if( !$status )
 | 
						|
	{
 | 
						|
		$statusText = "<font color='red'>Down</font>";
 | 
						|
	}
 | 
						|
	else
 | 
						|
	{
 | 
						|
		$statusText = "<font color='green'>Up</font>";
 | 
						|
	}
 | 
						|
	
 | 
						|
	# Set the status Row.
 | 
						|
	$serverStatus .= "<td BGCOLOR='#FFFFFF'>{$serviceName}</td><td BGCOLOR='#FFFFFF'>{$statusText}</td></tbody></tr>";
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
# Finish service status table.
 | 
						|
$serverStatus .= "</table>";
 | 
						|
# File Complete.
 | 
						|
 | 
						|
?>
 |