<?php
#######################################################|#
#|                    HabboMCMS - TheRox
#|                    Powered by HoloCMS 
#|            Copyright 2011-2012 ALL RIGHTS RESERVED
#######################################################|#


require_once('../global.php');
if($hkzone !== true){ header("Location: index.php?throwBack=true"); exit; }
if(!session_is_registered(acp)){ header("Location: index.php?p=login"); exit; }

$pagename = "Server Configuration";

if(isset($_POST['game_port'])){

	$game_port = $_POST['game_port'];
	$mus_port = $_POST['mus_port'];
	$game_maxconnections = $_POST['game_maxconnections'];
	$mus_maxconnections = $_POST['mus_maxconnections'];
	$mus_host = $_POST['mus_host'];


	if(!empty($game_port) && !empty($mus_port) && !empty($game_maxconnections) && !empty($mus_maxconnections) && !empty($mus_host)){

		mysql_query("UPDATE system_config SET sval = '".$game_port."' WHERE skey = 'server_game_port' LIMIT 1") or die(mysql_error());
		mysql_query("UPDATE system_config SET sval = '".$mus_port."' WHERE skey = 'server_mus_port' LIMIT 1") or die(mysql_error());
		mysql_query("UPDATE system_config SET sval = '".$game_maxconnections."' WHERE skey = 'server_game_maxconnections' LIMIT 1") or die(mysql_error());
		mysql_query("UPDATE system_config SET sval = '".$mus_maxconnections."' WHERE skey = 'server_mus_maxconnections' LIMIT 1") or die(mysql_error());
		mysql_query("UPDATE system_config SET sval = '".$mus_host."' WHERE skey = 'server_mus_host' LIMIT 1") or die(mysql_error());
		mysql_query("UPDATE system_config SET sval = '".$trading_enable."' WHERE skey = 'trading_enable' LIMIT 1") or die(mysql_error());
		mysql_query("UPDATE system_config SET sval = '".$chatanims_enable."' WHERE skey = 'chatanims_enable' LIMIT 1") or die(mysql_error());

		$msg = "Réglages sauvegardés avec succès.";

		mysql_query("INSERT INTO system_stafflog (action,message,note,userid,targetid,timestamp) VALUES ('Housekeeping','Updated Server Settings (General Configuration)','server.php','".$my_id."','','".$date_full."')") or die(mysql_error());

	} else {

		$msg = "Merci de remplir les champs vides. Non enregistrer";

	}

}

@include('subheader.php');
@include('header.php');
?>
<table cellpadding='0' cellspacing='8' width='100%' id='tablewrap'>
<tr> <td width='22%' valign='top' id='leftblock'>
 <div>
 <!-- LEFT CONTEXT SENSITIVE MENU -->
<?php @include('servermenu.php'); ?>
 <!-- / LEFT CONTEXT SENSITIVE MENU -->
 </div>
 </td>
 <td width='78%' valign='top' id='rightblock'>
 <div><!-- RIGHT CONTENT BLOCK -->
 
<?php if(isset($msg)){ ?><p><strong><?php echo $msg; ?></strong></p><?php } ?>
 
<form action='index.php?p=server&do=save' method='post' name='theAdminForm' id='theAdminForm'>
<div class='tableborder'>
<div class='tableheaderalt'>Configurations Générales</div>

<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Game Port</b><div class='graytext'>Port du serveur JEU.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='game_port' value="<?php echo FetchServerSetting('server_game_port'); ?>" size='30' class='textinput'></td>
</tr>

<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>MUS Port</b><div class='graytext'>Port du serveur MUS.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='mus_port' value="<?php echo FetchServerSetting('server_mus_port'); ?>" size='30' class='textinput'></td>
</tr>

<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Connection maximum</b><div class='graytext'>The amount of users online is limited to this value.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='game_maxconnections' value="<?php echo FetchServerSetting('server_game_maxconnections'); ?>" size='30' class='textinput'></td>
</tr>

<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Maximum de connection au MUS</b><div class='graytext'>The amount of allowed MUS socket connections is limited to this value.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='mus_maxconnections' value="<?php echo FetchServerSetting('server_mus_maxconnections'); ?>" size='30' class='textinput'></td>
</tr>

<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Host</b><div class='graytext'>Adresse IP du serveur dédié.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='mus_host' value="<?php echo FetchServerSetting('server_mus_host'); ?>" size='30' class='textinput'></td>
</tr>

<tr>
</tr>


</tr>

<tr>
<tr><td align='center' class='tablesubheader' colspan='2' ><input type='submit' value='Save Configuration' class='realbutton' accesskey='s'></td></tr>
</form></table></div><br />	 </div><!-- / RIGHT CONTENT BLOCK -->
	 </td></tr>
</table>
</div><!-- / OUTERDIV -->
<div align='center'><br />
<?php
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
printf('Time: %.3f', $totaltime);
?>
</div>