update server to use new functionnality openal-manager

This commit is contained in:
AleaJactaEst 2018-10-09 18:03:04 +02:00
parent 8d0a6efba2
commit 06880da7b6
8 changed files with 898 additions and 33 deletions

View file

@ -67,8 +67,8 @@ table, th, td {
xhr.open("POST", url, true); xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
console.log(xhr.readyState); console.log(xhr.readyState);
console.log(xhr.status); console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText); //var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText); console.log(xhr.responseText);
@ -86,8 +86,8 @@ table, th, td {
xhr.open("POST", url, true); xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
console.log(xhr.readyState); console.log(xhr.readyState);
console.log(xhr.status); console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText); //var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText); console.log(xhr.responseText);
@ -188,23 +188,40 @@ if (file_exists('/home/gameserver/opennelmanager.flag')) {
$total=count($data); $total=count($data);
echo '<div>Number command:'.$total.'<br/>'; echo '<div>Number command:'.$total.'<br/>';
echo "<table>"; echo "<table>";
echo "<tr><th>Command</th><th>Start</th><th>Stop</th><th>State</th><th>Log</th></tr>"; echo "<tr><th>Command</th><th>Start</th><th>Stop</th><th>State</th><th>Num. launch</th><th>Last line log</th><th>Detail</th></tr>";
ksort($data); ksort($data);
foreach ($data as $key => $value) foreach ($data as $key => $value)
{ {
if ( $value == 'started' ) { list($val1, $val2) = explode(':', $value, 2);
$fond = "bgcolor=\"SpringGreen \""; $state=$value['state'];
} else { $number_launch=$value['number_launch'];
$fond = "bgcolor=\"Tomato\""; $number_launch=$value['number_launch'];
} $last_line=$value['last_line'];
list($type, $command) = explode(':', $key, 2); $filter=$value['filter'];
echo "<tr><td>$command</td><td><button onclick=\"start('$rooturl', '$key')\">Start</button></td><td><button onclick=\"stop('$rooturl', '$key')\">Stop</button></td><td $fond>$value</td><td><a href=\"/opennelmanager_log.php?command=$key\">log</a></td></tr>"; $egs=$value['egs'];
$extra="";
if ( $state == 'started' ) {
$fond = "bgcolor=\"SpringGreen \"";
} else {
$fond = "bgcolor=\"Tomato\"";
}
if ( $filter == 'True' ) {
$extra="$extra <a href=\"/opennelmanager_filter.php?command=$key\">filter</a>";
}
if ( $egs == 'True' ) {
$extra="$extra <a href=\"/opennelmanager_player.php?command=$key\">player</a>";
$extra="$extra <a href=\"/opennelmanager_admin.php?command=$key\">admin</a>";
}
list($type, $command) = explode(':', $key, 2);
echo "<tr><td>$command</td><td><button onclick=\"start('$rooturl', '$key')\">Start</button></td>";
echo "<td><button onclick=\"stop('$rooturl', '$key')\">Stop</button></td><td $fond>$state</td><";
echo "td align=\"right\">$number_launch</td><td align=\"right\">$last_line</td>";
echo "<td><a href=\"/opennelmanager_log.php?command=$key\">log</a> <a href=\"/opennelmanager_config.php?command=$key\">config</a> <a href=\"/opennelmanager_info.php?command=$key\">info</a> $extra</td></tr>";
} }
echo "</table></div>"; echo "</table></div>";
} else { } else {
echo "<a>OpenNelManager not used</a>"; echo "<a>OpenNelManager not used</a>";
} }
} else { } else {
echo "<a>OpenNelManager not actiavted</a>"; echo "<a>OpenNelManager not actiavted</a>";
} }

View file

@ -0,0 +1,170 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</title>
</head>
<style>
#command_shell{
background: #F3E2A9;
border:3px solid #151515;
color: #000000;
margin:10px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
max-width:100vw;
}
#title_info{
background: #00FFFF;
border:3px solid #8A0808;
color: #000000;
font-size:20px;
font-weight:500;
margin:50px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
}
#important_info{
background: #A9E2F3;
border:3px solid #088A08;
color: #000000;
font-size:15px;
font-weight:500;
margin:30px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
#alert_javascript{
background: #F3F781;
border:3px solid #610B0B;
color: #DF0101;
font-size:20px;
font-weight:700;
margin:0;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
max-width:100vw;
}
</style>
<script>
function setHref() {
document.getElementById('admin-href').href = window.location.protocol + "//" + window.location.hostname + ":40916/ams/";
}
</script>
<noscript>
<div id='alert_javascript'>
This website need Javascript.<br>
Could you please enable Javascript?
</div>
</noscript>
<body onload="setHref()">
<p>
<a href="/" id="home" >Home</a>
<?php
if (file_exists('/home/gameserver/opennelmanager.flag')) {
echo "<a href=\"/opennelmanager.php\">OpenNelManager</a>";
} else {
echo "<a>opennelmanager not used</a>";
}
?>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<a href="/phpmyadmin/">phpmyadmin</a>
<a href="/patch/">patch</a>
</p>
<div id='title_info'>KHANAT SERVER DOCKER (TEST ENVIRONMENT - ADMIN COMMAND)</div>
<div id='important_info'><?php echo $_GET['command']; ?></div>
<?php
function get_port($filecfg)
{
// $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
if ($fp) {
while (($line = fgets($fp)) !== false) {
list($data, $comment) = explode('#', $line, 2);
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
if ( $key == "port" ) {
return trim($value);
}
}
fclose($fp);
}
return "8000";
}
$cfgfile = "/home/gameserver/khanat/khaganat.cfg";
if (file_exists($cfgfile)) {
$info = get_port($cfgfile);
$rooturl = "http://" . getHostByName(gethostname()) . ":" . $info ;
$url = $rooturl . "/ADMINCOMMAND";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG HTTP/1.0",
'Content-type: application/json',
'Content-Length: ' . strlen($data)
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$data = json_decode($result,true);
ksort($data);
echo "<table>";
echo "<tr><th>Line</th>";
foreach ($data as $key => $value)
{
foreach ($value as $key2 => $value2)
{
echo "<th>$key2</th>";
}
break;
}
echo "</tr>";
foreach ($data as $key => $value)
{
echo "<tr><td>$key</td>";
foreach ($value as $key2 => $value2)
{
echo "<td align=\"right\">$value2</td>";
}
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</title>
</head>
<style>
#command_shell{
background: #F3E2A9;
border:3px solid #151515;
color: #000000;
margin:10px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
max-width:100vw;
}
#title_info{
background: #00FFFF;
border:3px solid #8A0808;
color: #000000;
font-size:20px;
font-weight:500;
margin:50px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
}
#important_info{
background: #A9E2F3;
border:3px solid #088A08;
color: #000000;
font-size:15px;
font-weight:500;
margin:30px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
#alert_javascript{
background: #F3F781;
border:3px solid #610B0B;
color: #DF0101;
font-size:20px;
font-weight:700;
margin:0;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
max-width:100vw;
}
</style>
<script>
function setHref() {
document.getElementById('admin-href').href = window.location.protocol + "//" + window.location.hostname + ":40916/ams/";
}
</script>
<noscript>
<div id='alert_javascript'>
This website need Javascript.<br>
Could you please enable Javascript?
</div>
</noscript>
<body onload="setHref()">
<p>
<a href="/" id="home" >Home</a>
<?php
if (file_exists('/home/gameserver/opennelmanager.flag')) {
echo "<a href=\"/opennelmanager.php\">OpenNelManager</a>";
} else {
echo "<a>opennelmanager not used</a>";
}
?>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<a href="/phpmyadmin/">phpmyadmin</a>
<a href="/patch/">patch</a>
</p>
<div id='title_info'>KHANAT SERVER DOCKER (TEST ENVIRONMENT - CONFIG)</div>
<div id='important_info'><?php echo $_GET['command']; ?></div>
<?php
function get_port($filecfg)
{
// $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
if ($fp) {
while (($line = fgets($fp)) !== false) {
list($data, $comment) = explode('#', $line, 2);
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
if ( $key == "port" ) {
return trim($value);
}
}
fclose($fp);
}
return "8000";
}
$cfgfile = "/home/gameserver/khanat/khaganat.cfg";
if (file_exists($cfgfile)) {
$info = get_port($cfgfile);
$rooturl = "http://" . getHostByName(gethostname()) . ":" . $info ;
$url = $rooturl . "/CONFIG";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG HTTP/1.0",
'Content-type: application/json',
'Content-Length: ' . strlen($data)
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$data = json_decode($result,true);
echo "<table>";
echo "<tr><th>Key</th><th>Value</th></tr>";
ksort($data);
foreach ($data as $key => $value)
{
echo "<tr><td>$key</td><td align=\"right\">$value</td>";
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</title>
</head>
<style>
#command_shell{
background: #F3E2A9;
border:3px solid #151515;
color: #000000;
margin:10px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
max-width:100vw;
}
#title_info{
background: #00FFFF;
border:3px solid #8A0808;
color: #000000;
font-size:20px;
font-weight:500;
margin:50px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
}
#important_info{
background: #A9E2F3;
border:3px solid #088A08;
color: #000000;
font-size:15px;
font-weight:500;
margin:30px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
#alert_javascript{
background: #F3F781;
border:3px solid #610B0B;
color: #DF0101;
font-size:20px;
font-weight:700;
margin:0;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
max-width:100vw;
}
</style>
<script>
function setHref() {
document.getElementById('admin-href').href = window.location.protocol + "//" + window.location.hostname + ":40916/ams/";
}
</script>
<noscript>
<div id='alert_javascript'>
This website need Javascript.<br>
Could you please enable Javascript?
</div>
</noscript>
<body onload="setHref()">
<p>
<a href="/" id="home" >Home</a>
<?php
if (file_exists('/home/gameserver/opennelmanager.flag')) {
echo "<a href=\"/opennelmanager.php\">OpenNelManager</a>";
} else {
echo "<a>opennelmanager not used</a>";
}
?>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<a href="/phpmyadmin/">phpmyadmin</a>
<a href="/patch/">patch</a>
</p>
<div id='title_info'>KHANAT SERVER DOCKER (TEST ENVIRONMENT - FILTER)</div>
<div id='important_info'><?php echo $_GET['command']; ?></div>
<?php
function get_port($filecfg)
{
// $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
if ($fp) {
while (($line = fgets($fp)) !== false) {
list($data, $comment) = explode('#', $line, 2);
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
if ( $key == "port" ) {
return trim($value);
}
}
fclose($fp);
}
return "8000";
}
$cfgfile = "/home/gameserver/khanat/khaganat.cfg";
if (file_exists($cfgfile)) {
$info = get_port($cfgfile);
$rooturl = "http://" . getHostByName(gethostname()) . ":" . $info ;
$url = $rooturl . "/FILTER";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG HTTP/1.0",
'Content-type: application/json',
'Content-Length: ' . strlen($data)
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$data = json_decode($result,true);
ksort($data);
foreach ($data as $key => $value)
{
echo "<p><div>$key</div>";
echo "<table>";
echo "<tr><th>Key</th><th>Value</th></tr>";
foreach ($value as $key2 => $value2)
{
echo "<tr><td>$key2</td><td align=\"right\">$value2</td>";
}
echo "</table></div>";
echo "</p>";
}
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</title>
</head>
<style>
#command_shell{
background: #F3E2A9;
border:3px solid #151515;
color: #000000;
margin:10px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
max-width:100vw;
}
#title_info{
background: #00FFFF;
border:3px solid #8A0808;
color: #000000;
font-size:20px;
font-weight:500;
margin:50px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
}
#important_info{
background: #A9E2F3;
border:3px solid #088A08;
color: #000000;
font-size:15px;
font-weight:500;
margin:30px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
#alert_javascript{
background: #F3F781;
border:3px solid #610B0B;
color: #DF0101;
font-size:20px;
font-weight:700;
margin:0;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
max-width:100vw;
}
</style>
<script>
function setHref() {
document.getElementById('admin-href').href = window.location.protocol + "//" + window.location.hostname + ":40916/ams/";
}
</script>
<noscript>
<div id='alert_javascript'>
This website need Javascript.<br>
Could you please enable Javascript?
</div>
</noscript>
<body onload="setHref()">
<p>
<a href="/" id="home" >Home</a>
<?php
if (file_exists('/home/gameserver/opennelmanager.flag')) {
echo "<a href=\"/opennelmanager.php\">OpenNelManager</a>";
} else {
echo "<a>opennelmanager not used</a>";
}
?>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<a href="/phpmyadmin/">phpmyadmin</a>
<a href="/patch/">patch</a>
</p>
<div id='title_info'>KHANAT SERVER DOCKER (TEST ENVIRONMENT - INFO)</div>
<div id='important_info'><?php echo $_GET['command']; ?></div>
<?php
function get_port($filecfg)
{
// $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
if ($fp) {
while (($line = fgets($fp)) !== false) {
list($data, $comment) = explode('#', $line, 2);
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
if ( $key == "port" ) {
return trim($value);
}
}
fclose($fp);
}
return "8000";
}
$cfgfile = "/home/gameserver/khanat/khaganat.cfg";
if (file_exists($cfgfile)) {
$info = get_port($cfgfile);
$rooturl = "http://" . getHostByName(gethostname()) . ":" . $info ;
$url = $rooturl . "/INFO";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG HTTP/1.0",
'Content-type: application/json',
'Content-Length: ' . strlen($data)
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$data = json_decode($result,true);
echo "<table>";
echo "<tr><th>Key</th><th>Value</th></tr>";
ksort($data);
foreach ($data as $key => $value)
{
echo "<tr><td>$key</td><td align=\"right\">$value</td>";
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -68,8 +68,8 @@ table, th, td {
xhr.open("POST", url, true); xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
console.log(xhr.readyState); console.log(xhr.readyState);
console.log(xhr.status); console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText); //var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText); console.log(xhr.responseText);
@ -210,17 +210,25 @@ if (file_exists($cfgfile)) {
echo "<a>OpenNelManager not enabled</a>"; echo "<a>OpenNelManager not enabled</a>";
} }
?> ?>
<br>
Send to STDIN: <input type="text" id="command" value="command" size="100"/>
<input type="submit" value="Submit" onclick="send('<?php echo $rooturl; ?>', 'command');"/>
<br>
</p>
<div> <div>
Command line : Command line :
<div id='command_shell'> <div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\", \"first-line\": 0}";?>' <?php print $url;?> curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\", \"first-line\": 0}";?>' <?php print $url;?>
</div> </div>
</div> </div>
</p>
<p>
<br>
Send to STDIN: <input type="text" id="command" value="help" size="100"/>
<input type="submit" value="Submit" onclick="send('<?php echo $rooturl; ?>', 'command');"/>
<br>
<div>
Command line :
<div id='command_shell'>
curl -XPOST --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\", \"action\": \"help\"}";?>' <?php print $rooturl . "/STDIN";?>
</div>
</div>
</p>
<p id="info"></p> <p id="info"></p>
</body> </body>
</html> </html>

View file

@ -0,0 +1,171 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</title>
</head>
<style>
#command_shell{
background: #F3E2A9;
border:3px solid #151515;
color: #000000;
margin:10px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
max-width:100vw;
}
#title_info{
background: #00FFFF;
border:3px solid #8A0808;
color: #000000;
font-size:20px;
font-weight:500;
margin:50px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
}
#important_info{
background: #A9E2F3;
border:3px solid #088A08;
color: #000000;
font-size:15px;
font-weight:500;
margin:30px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
#alert_javascript{
background: #F3F781;
border:3px solid #610B0B;
color: #DF0101;
font-size:20px;
font-weight:700;
margin:0;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
max-width:100vw;
}
</style>
<script>
function setHref() {
document.getElementById('admin-href').href = window.location.protocol + "//" + window.location.hostname + ":40916/ams/";
}
</script>
<noscript>
<div id='alert_javascript'>
This website need Javascript.<br>
Could you please enable Javascript?
</div>
</noscript>
<body onload="setHref()">
<p>
<a href="/" id="home" >Home</a>
<?php
if (file_exists('/home/gameserver/opennelmanager.flag')) {
echo "<a href=\"/opennelmanager.php\">OpenNelManager</a>";
} else {
echo "<a>opennelmanager not used</a>";
}
?>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<a href="/phpmyadmin/">phpmyadmin</a>
<a href="/patch/">patch</a>
</p>
<div id='title_info'>KHANAT SERVER DOCKER (TEST ENVIRONMENT - PLAYER)</div>
<div id='important_info'><?php echo $_GET['command']; ?></div>
<?php
function get_port($filecfg)
{
// $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
if ($fp) {
while (($line = fgets($fp)) !== false) {
list($data, $comment) = explode('#', $line, 2);
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
if ( $key == "port" ) {
return trim($value);
}
}
fclose($fp);
}
return "8000";
}
$cfgfile = "/home/gameserver/khanat/khaganat.cfg";
if (file_exists($cfgfile)) {
$info = get_port($cfgfile);
$rooturl = "http://" . getHostByName(gethostname()) . ":" . $info ;
$url = $rooturl . "/PLAYER";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG HTTP/1.0",
'Content-type: application/json',
'Content-Length: ' . strlen($data)
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$data = json_decode($result,true);
ksort($data);
echo "<table>";
echo "<tr><th>Player</th>";
foreach ($data as $key => $value)
{
foreach ($value as $key2 => $value2)
{
echo "<th>$key2</th>";
}
break;
}
echo "</tr>";
foreach ($data as $key => $value)
{
echo "<tr><td>$key</td>";
foreach ($value as $key2 => $value2)
{
echo "<td align=\"right\">$value2</td>";
}
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -87,6 +87,26 @@ command = ryzom_entities_game_service -A/home/gameserver/khanat/server -C/home/g
path = /home/gameserver/khanat/server/ path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout) # size buffer log for each program launched (number line stdout)
logsize = 3000 logsize = 3000
# keep some data on array/dict state
activate_filter = yes
# size array/dict state
size_max_filter = 1000
# search regex to add state (python regex)
# "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<ActivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P<InactivePlayer>.*)[\s]+(is disconnected))"
# add_filter = "^(.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<ActivePlayer>.*)"
# search regex to del state (python regex)
# del_filter = "^(.*)(disconnectPlayer).+[\s]+(?P<ActivePlayer>.*)[\s]+(is disconnected)"
# add_filter = "^(.*)(setActiveCharForPlayer)(.*)(: set active char )[\d]+( for )(?P<ActivePlayer>.*)"
# del_filter = "^(.*)(disconnectPlayer).+[\s]+(?P<ActivePlayer>.*)[\s]+(is disconnected)"
add_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<ActivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P<InactivePlayer>.*)[\s]+(is disconnected))"
del_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<InactivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P<ActivePlayer>.*)[\s]+(is disconnected))"
# autostart (when start OpenNelManager, launch this program)
autostart = yes
# restart after crash
restart_after_crash = yes
# Delay after each restart (second)
restart_delay = 10
egs_filter = yes
############################## ##############################
# gpms : gpm_service # gpms : gpm_service