JoccE
CopyLeft (ɔ)
So.... i have made a weird admin panel script to start/stop the server from www. if you for example wants to start the server from the phone or like me renting servers too people and don't want them to have ssh access.
The old thread in discussing section: http://otland.net/f251/simple-admin-panel-ots-178011/#post1726553
So.
Begin with creating a adminserver.php in your /var/www/ and add this:
On line 7 you need to change the path to the server files.
Then go to /var/www/layout/widget/loggedin.php
and add this under the "if (is_admin($user_data)) {"
The startup login wont work until you make a "ln -s" from the my.log in serverpath too somewhere in the www folder example: ln -s /home/server1/my.log /var/www/my.log
I know that this is not "professionally made" or anything, but i suck at PHP and HTML. But it works and you can only use it if your name is in config.php as web admin.
I have not seen anything like it tho and it is a pretty nice function.
If anyone wants too remake it. Go ahead, please release it. The word of ZNOTE: Because open communities are good communities. :3
The old thread in discussing section: http://otland.net/f251/simple-admin-panel-ots-178011/#post1726553
So.
Begin with creating a adminserver.php in your /var/www/ and add this:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
protect_page();
admin_only($user_data);
// start
if(isset($_POST['test'])) {
if (check_if_process_is_running("theforgottenserver"))
{
echo "<h2><b><font color='green'>Server is already running</font></b></h2>";
} else
{
shell_exec('cd /home/server1/ && ./theforgottenserver > my.log 2>&1 &'); //Serverpath
}
}
if(isset($_POST['kill'])) {
shell_exec('killall -9 theforgottenserver');
}
if(isset($_POST['safe'])) {
shell_exec('killall -QUIT theforgottenserver');
}
function check_if_process_is_running($process)
{
exec("/bin/pidof $process",$response);
if ($response)
{
return true;
} else
{
return false;
}
}
if (check_if_process_is_running("theforgottenserver"))
{
echo "<h2><b><font color='green'>Server is running</font></b></h2>";
} else
{
echo "<h3><b><font color='red'>Server is NOT running</font></b></h3>";
}
?>
<div id="text">
This is the beta version of JoccEs Admin panel to start/stop tibia servers<br>
<b>Functions:</b><br>
<b>Start:</b> Starts the server using ./theforgottenserver (no Autorestarter) Now with logging enabled.<br>
<b>Save and Quit:</b> Saves the server the stops it.<br>
<b>Kill Server:</b> Instantly Stops the server using "killall -9 theforgottenserver"<br>
<b>Logs:</b> Shows the startup output after you have shut down server (a bit buggy server need to be offline to read it)
<br>
<br>
</div>
<script type="text/javascript">
function newPopup(url) {
popupWindow = window.open(
url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
<!-- Buttons -->
<div id="buttons>">
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="test" value="Start Server">
</form>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="safe" value="Save and Quit">
</form>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="kill" value="Kill Server">
</form>
<!--<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="test" value="Test Button do not use">
</form> -->
<button onclick="newPopup('my.log')">Startup Logs</button>
</div>
<div id="info">
<br>
<b>Current Bugs:</b><br>
--NONE<br>
<br>
<b>Future Features:</b><br>
--Be able to start server with auto restarter.<br>
--More functions: Examples: Clean map and Save Server. (done just not added)<br>
</div>
<?php
// end
include 'layout/overall/footer.php'; ?>
On line 7 you need to change the path to the server files.
Then go to /var/www/layout/widget/loggedin.php
and add this under the "if (is_admin($user_data)) {"
PHP:
<li>
<a href='adminserver.php'>Admin Startup</a>
</li>
The startup login wont work until you make a "ln -s" from the my.log in serverpath too somewhere in the www folder example: ln -s /home/server1/my.log /var/www/my.log
I know that this is not "professionally made" or anything, but i suck at PHP and HTML. But it works and you can only use it if your name is in config.php as web admin.
I have not seen anything like it tho and it is a pretty nice function.
If anyone wants too remake it. Go ahead, please release it. The word of ZNOTE: Because open communities are good communities. :3
Last edited: