<?php
	if($_SESSION['level'] < 9)
			{
			$_SESSION['error'] = "You have NO ACCESS to Server Check";
			include('error.php');
			} else {
			
	$ip = "127.0.0.1";
	if ($_GET['exec'] == 'startaccdb' && $_SESSION['level'] == 9) { exec('net start "_Account DB Server"'); writelog($_SESSION["username"],"started Account Server"); }
	if ($_GET['exec'] == 'stopaccdb' && $_SESSION['level'] == 9) { exec('net stop "_Account DB Server"'); writelog($_SESSION["username"],"stopped Account Server"); }
	if ($_GET['exec'] == 'startacclog' && $_SESSION['level'] == 9) { exec('net start "_AccountLog DB Server"');  writelog($_SESSION["username"],"started AccountLog Server");}
	if ($_GET['exec'] == 'stopacclog' && $_SESSION['level'] == 9) { exec('net stop "_AccountLog DB Server"');  writelog($_SESSION["username"],"stopped AccountLog Server");}
	if ($_GET['exec'] == 'startlogin' && $_SESSION['level'] == 9) { exec('net start "_Login Server"');  writelog($_SESSION["username"],"started Login Server");}
	if ($_GET['exec'] == 'stoplogin' && $_SESSION['level'] == 9) { exec('net stop "_Login Server"');  writelog($_SESSION["username"],"stopped Login Server");}
	if ($_GET['exec'] == 'startcharserver' && $_SESSION['level'] == 9) { exec('net start "_World00 Character DB Server"');  writelog($_SESSION["username"],"started Character Server");}
	if ($_GET['exec'] == 'stopcharserver' && $_SESSION['level'] == 9) { exec('net stop "_World00 Character DB Server"');  writelog($_SESSION["username"],"stopped Character Server");}
	if ($_GET['exec'] == 'startgamelog' && $_SESSION['level'] == 9) { exec('net start "_World00 GameLog DB Server"');  writelog($_SESSION["username"],"started GameLog Server");}
	if ($_GET['exec'] == 'stopgamelog' && $_SESSION['level'] == 9) { exec('net stop "_World00 GameLog DB Server"');  writelog($_SESSION["username"],"stopped GameLog Server");}
	if ($_GET['exec'] == 'startworld' && $_SESSION['level'] == 9) { exec('net start "_World00 Manager Server"');  writelog($_SESSION["username"],"started Manager Server");}
	if ($_GET['exec'] == 'stopworld' && $_SESSION['level'] == 9) { exec('net stop "_World00 Manager Server"');  writelog($_SESSION["username"],"stopped Manager Server");}
	if ($_GET['exec'] == 'startzone1' && $_SESSION['level'] == 9) { exec('net start "_Zone Server"');  writelog($_SESSION["username"],"started Zone 1");}
	if ($_GET['exec'] == 'stopzone1' && $_SESSION['level'] == 9) { exec('net stop "_Zone Server"');  writelog($_SESSION["username"],"stopped Zone 1");}
	if ($_GET['exec'] == 'startzone2' && $_SESSION['level'] == 9) { exec('net start "_Zone Server1"');  writelog($_SESSION["username"],"started Zone 2");}
	if ($_GET['exec'] == 'stopzone2' && $_SESSION['level'] == 9) { exec('net stop "_Zone Server1"');  writelog($_SESSION["username"],"stopped Zone 2");}
	if ($_GET['exec'] == 'startzone3' && $_SESSION['level'] == 9) { exec('net start "_Zone Server2"');  writelog($_SESSION["username"],"started Zone 3");}
	if ($_GET['exec'] == 'stopzone3' && $_SESSION['level'] == 9) { exec('net stop "_Zone Server2"');  writelog($_SESSION["username"],"stopped Zone 3");}


?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
	        <tr>
	          <td class="sitemenu"><strong>Server Check</strong></td>
	          </tr>
	        <tr>
	          <td class="sitemenu"><hr size="1" /></td>
	          </tr>
	        <tr>
	          <td align="left" valign="top" class="sitemenu"><table width="70%" border="0" cellspacing="3" cellpadding="0">
			  <tr>
	              <td colspan="4" align="left" valign="top" class="sitemenu">On the zones server is not displayed immediately are they online. But should the message be that the server is started, it is so!<br><br></td>
	              </tr>
	            <tr>
<?php
			$fp = @fsockopen($ip, 9000, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						
					}
			
?>
	            <tr>
	              <td width="28%" align="right" valign="middle" class="sitemenu">Account Server</td>
	              <td width="5%" align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td width="12%" align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td width="55%" align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startaccdb">
	                	<input type="submit" name="button" id="button" value="Start Server" /> 
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stopaccdb">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
				  </td>
	              </tr>
<?php
			$fp = @fsockopen($ip, 9005, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						@fclose($fp);
					}
			
?>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">Account Log Server</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startacclog">
	                	<input type="submit" name="button" id="button" value="Start Server" />
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stopacclog">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
                  </td>
	              </tr>
<?php
			$fp = @fsockopen($ip, 9016, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						@fclose($fp);
					}
			
?>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">Loginserver </td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startlogin">
	                	<input type="submit" name="button" id="button" value="Start Server" />
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stoplogin">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
                  </td>
	              </tr>
<?php
			$fp = @fsockopen($ip, 9100, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						@fclose($fp);
					}
			
?>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">Character Server</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startcharserver">
	                	<input type="submit" name="button" id="button" value="Start Server" />
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stopcharserver">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
                  </td>
	              </tr>
<?php
			$fp = @fsockopen($ip, 9101, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						@fclose($fp);
					}
			
?>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">Gamelog Server</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startgamelog">
	                	<input type="submit" name="button" id="button" value="Start Server" />
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stopgamelog">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
                  </td>
	              </tr>
<?php
			$fp = @fsockopen($ip, 9116, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						@fclose($fp);
					}
			
?>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">World Server</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startworld">
	                	<input type="submit" name="button" id="button" value="Start Server" />
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stopworld">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
                  </td>
	              </tr>
<?php
			$fp = @fsockopen($ip, 9121, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						@fclose($fp);
					}
			
?>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">Zone 1</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startzone1">
	                	<input type="submit" name="button" id="button" value="Start Server" />
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stopzone1">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
                  </td>
	              </tr>
<?php
			$fp = @fsockopen($ip, 9123, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						@fclose($fp);
					}
			
?>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">Zone 2</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startzone2">
	                	<input type="submit" name="button" id="button" value="Start Server" />
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stopzone2">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
                  </td>
	              </tr>
<?php
			$fp = @fsockopen($ip, 9125, $errno, $errstr, 0.1);
				if(!$fp)
					{
						$check = "<img src='gfx/icon_server_offline.gif' width='27' height='16' />";
						@fclose($fp);
					} else {
						$check = "<img src='gfx/icon_server_online.gif' width='27' height='16' />";
						@fclose($fp);
					}
			
?>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">Zone 3</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu"><?php echo $check; ?></td>
	              <td align="left" valign="middle" class="sitemenu">
                  <table width="65%" border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=startzone3">
	                	<input type="submit" name="button" id="button" value="Start Server" />
				  	  </form>
				  	  </td>
	                  <td>
                      <form id="form1" name="form1" method="post" action="index.php?show=server_menu&content=server_check&exec=stopzone3">
	                	<input type="submit" name="button2" id="button2" value="Stop Server" />
	              	  </form>
                      </td>
	                 </tr>
	               </table>
                  </td>
	              </tr>
	            <tr>
	              <td align="right" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              <td align="left" valign="middle" class="sitemenu">&nbsp;</td>
	              </tr>
	            </table>	            <p>&nbsp;</p></td>
	          </tr>
          </table>
<?php
	}
?>