Server Status Web Page
I am looking for a simple script that I can put on a web page that will display the server's status (ie. UP or DOWN) and maybe include an uptime report.
I would also like it to display a list of currently logged in characters with level/race/class and zone info. Does anyone have something like this currently in the works? Thanks! |
You can use a PHP Telnet script to get that information. However you will need telnet functions turned on the eq server.
If you are familiar with PHP scripting I will post a section of code for you to use. However you will need to edit the code for what suites you. If you are not familiar with PHP I would try and find someone that is. |
Thanks for the reply, I am working on learning php, and currently have a basic understanding of it. I would not mind checking out the code and seeing if I can make sense of it.
To turn on the telnet function I just edit the server's xml file correct? Thanks. |
i would be interested in the php code also, if it's not too much trouble that is =).
|
This is a partial code from my new EQ Editor release fixing to come out. This is built in a class, have fun. Feel free to ask questions.
Also some of the telnet code I copied from someone else, I have changed most of it but the majority is still intact. PHP Code:
|
Thanks for posting the code, seems I just get a blank page though when I load it. Currently the only things I changed were I added the php code tags, and I changed the 'address' to my eqemu server's local IP address and 'port' to '9000'. I enabled telnet in the eqemu xml config file and restarted the server. When I telnet to the server using a command prompt in windows I am able to connect and issue commands like status and who all.
I must be missing something... any ideas? |
Yea, LOTS....
This is a php class that you must call and then call each function you want performed, also you need to input your username/password. Replace $this->connection = fsockopen($cfg['telnet']['address'], $cfg['telnet']['port']); with $this->connection = fsockopen('your server ip address', 9000); 9000 is the default port, change it to match what your server's is. Also change fputs($this->connection, sprintf("%s\r", unserialize($_SESSION['EQ_EDT_USR']))); and fputs($this->connection, sprintf("%s\r", unserialize($_SESSION['EQ_EDT_PWD']))); and replace the unserialize($_SESSION'EQ_EDT_USR']) and unserialize($_SESSION['EQ_EDT_PWD']) with your EQ EMU Username and Password.. This checks the account table in the database. Make sure your username and password is like this: fputs($this->connection, sprintf("%s\r", 'username')); fputs($this->connection, sprintf("%s\r", 'password')); After that you need to call the class and then the functions below the script. Example: PHP Code:
PHP Code:
|
I made all the edits that you suggested and still end up with a blank page.
Here is my page called index.php PHP Code:
|
You are supposed to end up with a blank page.... There is nothing that is supposed to print out on the screen. All that I gave you is basically the "back end" of a program/script.
The real question is did it work for you? It should have, next time log in to the server and then run this script once more and see if it shows up in EQ... Also you might be missing something in PHP or apache or something.. Look in your error logs to see if this script had an error. |
Thanks for the contribution cybernine186.
|
I have been trying to figure out how I go about using this "back end" script to display the server status on a web page but keep coming up blank. Do you mind shedding some insight on how this would be accomplished. I would guess that I would need to call this script within the webpage somehow to have it display the data.
I am still new to PHP. Like I said before I would only like to display server status, uptime, and a list of currently logged in characters with lvl/class info. Thanks again. |
Quote:
PHP Code:
|
saw you wanted the players on as well:
PHP Code:
|
Spoon,
Thank you for that it looks perfect, but I am having issues integrating it. I tried to use the top part of the above script for the connection and authentication but it errored out at the beginning of your script. Here is what it looks like, I am sure I am doing something wrong. PHP Code:
And the error i get if I run php eqstatus.php from a command line on the server. Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /var/www/localhost/htdocs/game-servers/eq/status/eqstatus.php on line 27 |
You have a couple syntax errors. You didn't close out the class and were missing a required function in that class. Here is a more complete file. Don't forget to change the USER_NAME and PASSWORD.
PHP Code:
|
All times are GMT -4. The time now is 11:29 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.