<?php

	//Security
	if( ! defined( 'IS_INIT' ) )
	{
		die( 'Unauthorized Access');
	}
	
class ajax 
{
	private $Handler;
	
	public function __construct()
	{
		global $Handler;
		
		$this->Handler = $Handler;
	}
	
	public function ServerStatus( $port )
	{
		$ports = array( 9120 , 9122 , 9124 , 9126 );
		if( in_array( $port , $ports ) )
		{
			if( @fsockopen( GAME_IP , $port , $errrno , $errstr , 1 ) )
			{
				echo '<span style="color:green">Online</span>';
			}
			else
			{
				echo '<span style="color:red">Offline</span>';
			}
		}
		else
		{
			$this->BadRequest();
		}
	}
	
	public function BadRequest()
	{
		header("HTTP/1.1 400 Bad Request");
		header("Status: 400 Bad Request");
		exit();
	}
}

?>